/// <summary>
        /// Default Constructor
        /// </summary>
        public Exchange(IList <CurrencyPair> currencyPairs)
        {
            /*_currencyPairs.Add(CurrencyConstants.BtcLtc);
             * _currencyPairs.Add(CurrencyConstants.XbtLtc);
             * _currencyPairs.Add(CurrencyConstants.BtcLtcSeparated);
             * _currencyPairs.Add(CurrencyConstants.XbtLtcSeparated);
             * _currencyPairs.Add(CurrencyConstants.BtcDoge);
             * _currencyPairs.Add(CurrencyConstants.XbtDoge);
             * _currencyPairs.Add(CurrencyConstants.BtcDogeSeparated);
             * _currencyPairs.Add(CurrencyConstants.XbtDogeSeparated);*/
            ExtractCurrencyPairs(currencyPairs);
            foreach (var currencyPair in _currencyPairs)
            {
                LimitOrderBook orderBook      = new LimitOrderBook(currencyPair);
                DepthOrderBook depthOrderBook = new DepthOrderBook(currencyPair, 5);

                TradeListener      tradeListener     = new TradeListener();
                IOrderListener     orderListener     = new OrderListener();
                IOrderBookListener orderBookListener = new OrderBookListener();
                IBBOListener       bboListener       = new BBOListener();
                IDepthListener     depthListener     = new DepthListener();

                orderBook.OrderAccepted -= OnAccept;
                orderBook.OrderAccepted -= depthOrderBook.OnOrderAccepted;

                orderBook.OrderAccepted += OnAccept;
                orderBook.OrderAccepted += depthOrderBook.OnOrderAccepted;

                orderBook.OrderCancelled -= depthOrderBook.OnOrderCancelled;
                orderBook.OrderCancelled += depthOrderBook.OnOrderCancelled;

                orderBook.OrderBookChanged -= depthOrderBook.OnOrderBookChanged;
                orderBook.OrderBookChanged -= orderBookListener.OnOrderBookChanged;

                orderBook.OrderBookChanged += depthOrderBook.OnOrderBookChanged;
                orderBook.OrderBookChanged += orderBookListener.OnOrderBookChanged;

                orderBook.OrderChanged -= depthOrderBook.OnOrderChanged;
                orderBook.OrderChanged -= orderListener.OnOrderChanged;

                orderBook.OrderChanged += depthOrderBook.OnOrderChanged;
                orderBook.OrderChanged += orderListener.OnOrderChanged;

                orderBook.OrderFilled -= depthOrderBook.OnOrderFilled;
                orderBook.OrderFilled += depthOrderBook.OnOrderFilled;

                orderBook.TradeExecuted -= tradeListener.OnTrade;
                orderBook.TradeExecuted += tradeListener.OnTrade;

                depthOrderBook.BboChanged   -= bboListener.OnBBOChange;
                depthOrderBook.DepthChanged -= depthListener.OnDepthChanged;

                depthOrderBook.BboChanged   += bboListener.OnBBOChange;
                depthOrderBook.DepthChanged += depthListener.OnDepthChanged;

                _exchangeEssentialsList.AddEssentials(new ExchangeEssentials(orderBook, depthOrderBook, tradeListener,
                                                                             orderListener, depthListener, bboListener));
            }
        }
Example #2
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="limitOrderBook"></param>
 /// <param name="depthOrderBook"></param>
 /// <param name="tradeListener"></param>
 /// <param name="orderListener"></param>
 /// <param name="depthListener"></param>
 /// <param name="bboListener"></param>
 public ExchangeEssentials(LimitOrderBook limitOrderBook, DepthOrderBook depthOrderBook, ITradeListener tradeListener,
                           IOrderListener orderListener, IDepthListener depthListener, IBBOListener bboListener)
 {
     this.LimitOrderBook = limitOrderBook;
     this.DepthOrderBook = depthOrderBook;
     this.TradeListener  = tradeListener;
     this.OrderListener  = orderListener;
     this.DepthListener  = depthListener;
     this.BBOListener    = bboListener;
 }