public void Remove(Instrument instrument, BarType barType, long barSize, BarInput barInput = BarInput.Trade, ClockType type = ClockType.Local) { BarFactoryItem item; switch (barType) { case BarType.Time: item = new TimeBarFactoryItem(instrument, barSize, barInput, type, -1); break; case BarType.Tick: item = new TickBarFactoryItem(instrument, barSize, barInput, -1); break; case BarType.Volume: item = new VolumeBarFactoryItem(instrument, barSize, barInput, -1); break; case BarType.Range: item = new RangeBarFactoryItem(instrument, barSize, barInput, -1); break; case BarType.Session: throw new ArgumentException( "BarFactory::Remove Can not create SessionBarFactoryItem without session parameters"); default: throw new ArgumentException($"Unknown bar type - {barType}"); } Remove(item); }
public void Add(Instrument instrument, BarType barType, long barSize, BarInput barInput, ClockType type, TimeSpan session1, TimeSpan session2, int providerId = -1) { BarFactoryItem item; switch (barType) { case BarType.Time: item = new TimeBarFactoryItem(instrument, barSize, barInput, type, session1, session2, providerId); break; case BarType.Tick: item = new TickBarFactoryItem(instrument, barSize, barInput, session1, session2, providerId); break; case BarType.Volume: item = new VolumeBarFactoryItem(instrument, barSize, barInput, session1, session2, providerId); break; case BarType.Range: item = new RangeBarFactoryItem(instrument, barSize, barInput, session1, session2, providerId); break; case BarType.Session: item = new SessionBarFactoryItem(instrument, barInput, type, session1, session2, providerId); break; default: throw new ArgumentException($"Unknown bar type - {barType}"); } Add(item); }