public SmartOrderRoutingEngine(IProvideMarkets provideMarkets, ICanRouteOrders canRouteOrders, ICanReceiveMarketData canReceiveMarketData) { this.provideMarkets = provideMarkets; this.canRouteOrders = canRouteOrders; this.canReceiveMarketData = canReceiveMarketData; var availableMarkets = provideMarkets.GetAvailableMarkets(); this.markets = availableMarkets.ToDictionary(market => market, market => market); this.marketSnapshotProvider = new MarketSnapshotProvider(availableMarkets, canReceiveMarketData); }
public MarketSnapshotProvider(IEnumerable<IMarket> marketsToWatch, ICanReceiveMarketData canReceiveMarketData) { canReceiveMarketData.InstrumentMarketDataUpdated += this.InstrumentMarketDataUpdated; foreach (var market in marketsToWatch) { // TODO : Get rid of the hack (casting to concrete class) this._lastMarketUpdates[market] = new MarketInfo((Market)market); canReceiveMarketData.Subscribe(market); } }
public MarketSnapshotProvider(IEnumerable <string> marketNames, ICanReceiveMarketData canReceiveMarketData) { canReceiveMarketData.InstrumentMarketDataUpdated += this.InstrumentMarketDataUpdated; canReceiveMarketData.OrderFailedOnAMarket += this.canReceiveMarketData_OrderFailedOnAMarket; foreach (var marketName in marketNames) { // TODO : Get rid of the hack (casting to concrete class) canReceiveMarketData.Subscribe(marketName); } }
/// <summary> /// Initializes a new instance of the <see cref="SmartOrderRoutingEngine"/> class. /// </summary> /// <param name="marketsProvider">The markets provider.</param> /// <param name="routeOrders">The order routing.</param> /// <param name="marketDataProvider">The market data provider.</param> public SmartOrderRoutingEngine(IProvideMarkets marketsProvider, ICanRouteOrders routeOrders, ICanReceiveMarketData marketDataProvider) { this.routeOrders = routeOrders; var availableMarkets = marketsProvider.GetAvailableMarketNames(); this.marketSnapshotProvider = new MarketSnapshotProvider(availableMarkets, marketDataProvider); }