コード例 #1
0
        public OhlcData GetRange(TimeRange timeRange)
        {
            lock (Lock) {
                Ctx.Status("Requesting local data @" + Ctx.Network.Name);

                var seriesId = _adapter.SeriesId;

                var r = GetDbCollection().Where(x => x.SeriesId == seriesId && x.DateTimeUtcTicks >= timeRange.UtcFrom.Ticks && x.DateTimeUtcTicks <= timeRange.UtcTo.Ticks).ToList();
                var d = new OhlcData(timeRange.TimeResolution);
                d.AddRange(r);
                return(d);
            }
        }
コード例 #2
0
        public OhlcData GetRange(TimeRange timeRange)
        {
            lock (Lock) {
                Ctx.Status("Requesting in-memory data");

                var seriesId = _adapter.SeriesId;

                if (!CoverageMap.Covers(timeRange))
                {
                    return(null);
                }

                var r = MemoryCache.Where(x => x.SeriesId == seriesId && x.DateTimeUtc >= timeRange.UtcFrom && x.DateTimeUtc <= timeRange.UtcTo).ToList();
                var d = new OhlcData(timeRange.TimeResolution);
                d.AddRange(r);
                return(d);
            }
        }