/// <summary>
 /// Raise snaphsot event
 /// </summary>
 /// <param name="exchangeEssentialsList"></param>
 public static void Raise(ExchangeEssentialsList exchangeEssentialsList)
 {
     if (ExchangeSnapshot != null)
     {
         ExchangeSnapshot(exchangeEssentialsList);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// parameterized constructor
        /// </summary>
        public Exchange(IList <CurrencyPair> currencyPairs, ExchangeEssentialsList exchangeEssentialsList)
        {
            //_currencyPairs.Add(CurrencyConstants.BtcLtc);
            //_currencyPairs.Add(CurrencyConstants.XbtLtc);
            //_currencyPairs.Add(CurrencyConstants.BtcLtcSeparated);
            //_currencyPairs.Add(CurrencyConstants.XbtLtcSeparated);
            ExtractCurrencyPairs(currencyPairs);
            _exchangeEssentialsList = exchangeEssentialsList;
            foreach (var exchangeEssential in _exchangeEssentialsList)
            {
                //TradeListener tradeListener = new TradeListener();
                //IOrderListener orderListener = new OrderListener();
                IOrderBookListener orderBookListener = new OrderBookListener();
                //IBBOListener bboListener = new BBOListener();
                //IDepthListener depthListener = new DepthListener();

                exchangeEssential.LimitOrderBook.OrderAccepted -= OnAccept;
                exchangeEssential.LimitOrderBook.OrderAccepted -= exchangeEssential.DepthOrderBook.OnOrderAccepted;

                exchangeEssential.LimitOrderBook.OrderAccepted += OnAccept;
                exchangeEssential.LimitOrderBook.OrderAccepted += exchangeEssential.DepthOrderBook.OnOrderAccepted;

                exchangeEssential.LimitOrderBook.OrderCancelled -= exchangeEssential.DepthOrderBook.OnOrderCancelled;
                exchangeEssential.LimitOrderBook.OrderCancelled += exchangeEssential.DepthOrderBook.OnOrderCancelled;

                exchangeEssential.LimitOrderBook.OrderBookChanged -= exchangeEssential.DepthOrderBook.OnOrderBookChanged;
                exchangeEssential.LimitOrderBook.OrderBookChanged -= orderBookListener.OnOrderBookChanged;

                exchangeEssential.LimitOrderBook.OrderBookChanged += exchangeEssential.DepthOrderBook.OnOrderBookChanged;
                exchangeEssential.LimitOrderBook.OrderBookChanged += orderBookListener.OnOrderBookChanged;

                exchangeEssential.LimitOrderBook.OrderChanged -= exchangeEssential.DepthOrderBook.OnOrderChanged;
                exchangeEssential.LimitOrderBook.OrderChanged -= exchangeEssential.OrderListener.OnOrderChanged;

                exchangeEssential.LimitOrderBook.OrderChanged += exchangeEssential.DepthOrderBook.OnOrderChanged;
                exchangeEssential.LimitOrderBook.OrderChanged += exchangeEssential.OrderListener.OnOrderChanged;

                exchangeEssential.LimitOrderBook.OrderFilled -= exchangeEssential.DepthOrderBook.OnOrderFilled;
                exchangeEssential.LimitOrderBook.OrderFilled += exchangeEssential.DepthOrderBook.OnOrderFilled;

                exchangeEssential.LimitOrderBook.TradeExecuted -= exchangeEssential.TradeListener.OnTrade;
                exchangeEssential.LimitOrderBook.TradeExecuted += exchangeEssential.TradeListener.OnTrade;

                exchangeEssential.DepthOrderBook.BboChanged   -= exchangeEssential.BBOListener.OnBBOChange;
                exchangeEssential.DepthOrderBook.DepthChanged -= exchangeEssential.DepthListener.OnDepthChanged;

                exchangeEssential.DepthOrderBook.BboChanged   += exchangeEssential.BBOListener.OnBBOChange;
                exchangeEssential.DepthOrderBook.DepthChanged += exchangeEssential.DepthListener.OnDepthChanged;
                //exchangeEssential.Update(tradeListener,orderListener,depthListener,bboListener);
            }
        }