コード例 #1
0
        private void RequestFullDaily()
        {
            var range = TimeRange.EveryDayTillNow;

            OverviewOhlc = Request(range, true);

            if (OverviewOhlc.IsEmpty())
            {
                throw new Exception("Data range missing during " + nameof(Init));
            }

            UtcDataStart = OverviewOhlc.Min(x => x.DateTimeUtc);
        }
コード例 #2
0
        private OhlcData RequestInternal(TimeRange timeRange, bool allowLive = false)
        {
            if (!_apiAdapters.Any() && !_storageAdapters.Any())
            {
                return(null);
            }

            if (!StorageEnabled && !ApiEnabled)
            {
                return(null);
            }

            lock (_lock)
            {
                OhlcData results = null;

                if (StorageEnabled)
                {
                    results = ContinuousOrMergedStorage(timeRange, allowLive);
                }

                var hasRemaining = results.IsEmpty() ? null : results.Remaining(timeRange);

                if (ApiEnabled && (results.IsEmpty() || hasRemaining != null))
                {
                    results = CollectApi(hasRemaining ?? timeRange, results);
                }

                Ctx.Status(results.IsNotEmpty() ? "Data received, processing." : "No data received.");

                if (StorageEnabled && results.IsNotEmpty())
                {
                    StoreResults(timeRange, results);
                }

                return(results);
            }
        }