public Strategy(Framework framework, string name) { this.framework = framework; this.Name = name; this.strategiesByInstrument = new IdArray <LinkedList <Strategy> >(1000); this.strategyByOrderId = new IdArray <Strategy>(1000); this.strategies = new LinkedList <Strategy>(); this.status = StrategyStatus.Stopped; this.instruments = new InstrumentList(); this.instrumentCountTable = new IdArray <int>(1000); if (framework != null) { this.portfolio = new Portfolio(framework, this.Name); framework.PortfolioManager.Add(this.portfolio); } this.bars = new BarSeries("", ""); this.equity = new TimeSeries(); this.bids = new TickSeries(""); this.asks = new TickSeries(""); this.stops = new List <Stop>(); this.stopsByInstrument = new IdArray <List <Stop> >(1000); }
public TickSeries GetHistoricalTrades(IHistoricalDataProvider provider, Instrument instrument, DateTime dateTime1, DateTime dateTime2) { HistoricalDataRequest request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, 4); provider.Send(request); this.handle = new ManualResetEventSlim(false); this.handle.Wait(); TickSeries tickSeries = new TickSeries(""); if (this.historicalData != null) { foreach (HistoricalData current in this.historicalData) { DataObject[] objects = current.Objects; for (int i = 0; i < objects.Length; i++) { DataObject dataObject = objects[i]; tickSeries.Add((Trade)dataObject); } } } this.historicalData = null; return(tickSeries); }