Exemple #1
0
        public override OhlcData Include(TimeRange rangeAttempted, OhlcData data, bool acceptLiveRange = false)
        {
            base.Include(rangeAttempted, data, acceptLiveRange);

            this.SavePublic();

            return(data);
        }
Exemple #2
0
 public void Merge(OhlcData data)
 {
     foreach (var i in data)
     {
         RemoveAll(x => x.DateTimeUtc == i.DateTimeUtc);
         Add(i);
     }
 }
        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);
        }
Exemple #4
0
 public OhlcData(OhlcData data) : this(data.Resolution, data)
 {
     Resolution    = data.Resolution;
     ConvertedFrom = data.ConvertedFrom;
     Network       = data.Network;
 }