internal BarSlice GetSlice(long barSize) { BarSlice barSlice = null; this.table.TryGetValue(barSize, out barSlice); return(barSlice); }
internal void AddBar(Instrument instrument, Bar bar) { BarSlice barSlice = null; if (!this.table.TryGetValue(bar.Size, out barSlice)) { barSlice = new BarSlice(this.InstrumentsCount); this.table.Add(bar.Size, barSlice); } barSlice.AddBar(instrument, bar); }
public void SetNewBarSlice(long barSize) { try { BarSlice slice = this.barSliceManager.GetSlice(barSize); if (slice != null) { foreach (KeyValuePair <FreeQuant.Instruments.Instrument, FreeQuant.Data.Bar> keyValuePair in slice.Table) { this.OnNewBar(keyValuePair.Key, keyValuePair.Value); } slice.Reset(); } foreach (Strategy strategy in this.strategies.Values) { strategy.OnBarSlice(barSize); } } catch (Exception ex) { this.EmitError(ex); } }