public override OhlcData Include(TimeRange rangeAttempted, OhlcData data, bool acceptLiveRange = false) { base.Include(rangeAttempted, data, acceptLiveRange); this.SavePublic(); return(data); }
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); }
public OhlcData(OhlcData data) : this(data.Resolution, data) { Resolution = data.Resolution; ConvertedFrom = data.ConvertedFrom; Network = data.Network; }