コード例 #1
0
ファイル: CoverageMapBase.cs プロジェクト: whiteneutron/prime
        public virtual OhlcData Include(TimeRange rangeAttempted, OhlcData data, bool acceptLiveRange = false)
        {
            var range = data.GetTimeRange(rangeAttempted.TimeResolution);

            if (!acceptLiveRange)
            {
                range          = range.RemoveLiveRange();
                rangeAttempted = rangeAttempted.RemoveLiveRange();
            }

            if (data.IsNotEmpty())
            {
                Found.Add(range);
            }
            else
            {
                Unavailable.Add(rangeAttempted);
            }

            if (!Unavailable.Covers(rangeAttempted) && !Found.Covers(rangeAttempted))
            {
                Requested.Add(rangeAttempted);
            }

            var foundMin   = Found.MinimumFrom();
            var missingMin = Unavailable.MinimumFrom();

            var minDate = foundMin < missingMin ? foundMin : missingMin;

            if (minDate != DateTime.MaxValue)
            {
                UtcEarliestEntry = UtcEarliestEntry > minDate ? minDate : UtcEarliestEntry;
            }

            return(data);
        }