private void AddRemoval(ref List <IMarketSeries> list, IMarketSeries series) { if (list == null) { list = new List <Trading.IMarketSeries>(); } list.Add(series); }
private HistoricalPlaybackState GetHistoricalPlaybackState(IMarketSeries series) { var state = new Trading.HistoricalPlaybackState(); // Find a matching historical source, or find a more granular one that can be used. // FUTURE: Get factors of a timeframe instead of the simple MoreGranular iteration logic. e.g. from h12 search for h6 h4 h3 h2 h1 m30 m15 m12 m10 m6 m5 m4 m2 m1 t* // FUTURE: After simulation complete, save downsampled backtest data for (TimeFrame sourceTimeFrame = series.TimeFrame; state.HistoricalSeries == null && sourceTimeFrame != null; sourceTimeFrame = sourceTimeFrame.MoreGranular()) { state.HistoricalSeries = Data.HistoricalDataSources.GetMarketSeries(series.SymbolCode, sourceTimeFrame, this.StartDate, this.EndDate); } return(state); }
private async void Series_BarHasObserversChanged(IMarketSeries series, bool hasSubscribers) { #if NET462 var period = (ProtoOATrendbarPeriod)Enum.Parse(typeof(ProtoOATrendbarPeriod), series.TimeFrame.ToString().ToUpper()); if (hasSubscribers) { await Subscribe(series.SymbolCode, series.TimeFrame.Name); //RequestSubscribeForSymbol(series.SymbolCode, period); } else { Unsubscribe(series.SymbolCode, series.TimeFrame.Name); //RequestUnsubscribeForSymbol(series.SymbolCode, period); } #else #endif }
public void OnBar(IMarketSeries series, TimedBar bar) { OnBar(series.SymbolCode, series.TimeFrame, bar); }