private void UpdateEmptyCollections(DateTime algorithmTime) { // just in case _emptyTradeBars.Clear(); _emptyQuoteBars.Clear(); _emptyTicks.Clear(); _emptySplits.Clear(); _emptyDividends.Clear(); _emptyDelistings.Clear(); _emptyOptionChains.Clear(); _emptyFuturesChains.Clear(); _emptySymbolChangedEvents.Clear(); #pragma warning disable 0618 // DataDictionary.Time is deprecated, ignore until removed entirely _emptyTradeBars.Time = _emptyQuoteBars.Time = _emptyTicks.Time = _emptySplits.Time = _emptyDividends.Time = _emptyDelistings.Time = _emptyOptionChains.Time = _emptyFuturesChains.Time = _emptySymbolChangedEvents.Time = algorithmTime; #pragma warning restore 0618 }
public void Recalculate(double min, double max, double fixedSpacingMajor, double fixedSpacingMinor) { Ticks.Clear(); double firstMajorTickPosition = min - (min % fixedSpacingMajor); if (min > 0) { firstMajorTickPosition += fixedSpacingMajor; } for (double i = firstMajorTickPosition; i <= max; i += fixedSpacingMajor) { Ticks.Add(new Tick(i, Math.Round(i, 8).ToString(), true)); } double[] majorTickPositions = Ticks.Select(x => x.Position).ToArray(); double firstMinorTickPosition = min - (min % fixedSpacingMinor); if (min > 0) { firstMinorTickPosition += fixedSpacingMinor; } for (double i = firstMinorTickPosition; i <= max; i += fixedSpacingMinor) { if (!majorTickPositions.Contains(i)) { Ticks.Add(new Tick(i)); } } }
private async Task <bool> ExecuteLoadTickDataAsync(object parameter) { IsBusy = true; StatusText = "Loading..."; if (parameter != null) { _lastLoadedDuration = (DurationEnum)Enum.Parse(typeof(DurationEnum), parameter.ToString()); } Duration = _lastLoadedDuration.ToString(); var ticks = await _xtbWrapper.LoadData(Name, _lastLoadedDuration); Ticks.Clear(); foreach (var tick in ticks) { Ticks.Add(tick); } UpdatePlot(_lastLoadedDuration); StatusText = "Ready"; IsBusy = false; IsLoaded = true; return(true); }
/// <summary> /// Get queued tick data /// </summary> /// <returns></returns> public IEnumerable <Data.BaseData> GetNextTicks() { lock (Ticks) { var copy = Ticks.ToArray(); Ticks.Clear(); return(copy); } }
/// <summary> /// Get queued tick data /// </summary> /// <returns></returns> public IEnumerable <BaseData> GetNextTicks() { lock (TickLocker) { //workaround for mono bug on ToArray. var copy = new List <Data.Market.Tick>(); Ticks.ForEach(t => copy.Add(t)); Ticks.Clear(); return(copy); } }
public override void Initialize(LinkedNavigationEvent linkedNavigationEvent) { var ticks = IoC.Get <IBacktestRepository>().GetBacktestTicks(linkedNavigationEvent.Key); Ticks.Clear(); foreach (var tick in ticks) { Ticks.Add(tick); } TickView = CollectionViewSource.GetDefaultView(Ticks); base.Initialize(linkedNavigationEvent); }
private void ReCalculateTimelineTicks() { // for now Ticks.Clear(); // do a tick for each hour var hours = (int)(TickEndDateTime - TickStartDateTime).TotalHours; // round up to the nearest hour // need to get the tick based rounding code DateTime baseHourTick = TickStartDateTime.AddHours(1).AddMinutes(TickStartDateTime.Minute * -1); for (int i = 0; i < hours; i++) { Ticks.Add( new TimelineTick() { Time = baseHourTick.AddHours(i) } ); } }
private void UpdateEmptyCollections(DateTime algorithmTime) { // just in case _emptyTradeBars.Clear(); _emptyQuoteBars.Clear(); _emptyTicks.Clear(); _emptySplits.Clear(); _emptyDividends.Clear(); _emptyDelistings.Clear(); _emptyOptionChains.Clear(); _emptyFuturesChains.Clear(); _emptySymbolChangedEvents.Clear(); _emptyTradeBars.Time = _emptyQuoteBars.Time = _emptyTicks.Time = _emptySplits.Time = _emptyDividends.Time = _emptyDelistings.Time = _emptyOptionChains.Time = _emptyFuturesChains.Time = _emptySymbolChangedEvents.Time = algorithmTime; }
public void Clear() => Ticks.Clear();