Beispiel #1
0
        public MatchingEngine(ITradeListener tradeListener, ITimeProvider timeProvider, IFeeProvider feeProvider, Quantity stepSize, int quoteCurrencyDecimalPlaces = 0)
        {
            if (quoteCurrencyDecimalPlaces < 0)
            {
                throw new NotSupportedException($"Invalid value of {nameof(quoteCurrencyDecimalPlaces)}");
            }

            if (stepSize < 0)
            {
                throw new NotSupportedException($"Invalid value of {nameof(stepSize)}");
            }

            _book                       = new Book();
            _currentOrders              = new Dictionary <OrderId, Order>();
            _currentIcebergOrders       = new Dictionary <OrderId, Iceberg>();
            _orderAmount                = new Dictionary <OrderId, Quantity>();
            _goodTillDateOrders         = new SortedDictionary <int, HashSet <OrderId> >();
            _acceptedOrders             = new HashSet <OrderId>();
            _tradeListener              = tradeListener;
            _timeProvider               = timeProvider;
            _feeProvider                = feeProvider;
            _quoteCurrencyDecimalPlaces = quoteCurrencyDecimalPlaces;
            _power                      = (decimal)Math.Pow(10, _quoteCurrencyDecimalPlaces);
            _stepSize                   = stepSize;
        }
Beispiel #2
0
 public void Update(ITradeListener tradeListener,
                    IOrderListener orderListener, IDepthListener depthListener, IBBOListener bboListener)
 {
     this.TradeListener = tradeListener;
     this.OrderListener = orderListener;
     this.DepthListener = depthListener;
     this.BBOListener   = bboListener;
 }
Beispiel #3
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;
 }