Exemplo n.º 1
0
        public OrderBookEventArgs(BitstampOrderBook order, OrderState state) : this()
        {
            OrderBook      = new OrderBook();
            OrderId        = order.id;
            IsOrderDeleted = state == OrderState.Deleted;
            MicroTimestamp = order.microtimestamp;

            if (order.datetime > 0)
            {
                Timestamp = StartTime.AddSeconds(order.datetime);
            }

            if (order.BidOrder)
            {
                OrderBook.Bids = new Order[1] {
                    new Order {
                        Price = order.price, Amount = order.amount
                    }
                };
                IsBidOrder = true;
            }
            else
            {
                OrderBook.Asks = new Order[1] {
                    new Order {
                        Price = order.price, Amount = order.amount
                    }
                }
            };
        }
Exemplo n.º 2
0
        private void ConnectionStateChanged(object sender, ConnectionState state)
        {
            Log.WriteInfo("[Bitstamp] " + state.ToString().ToLower(), (int)ExchangeName.Bitstamp);

            if (state == ConnectionState.Disconnected)
            {
                var obj = new BitstampOrderBook();
                if (_btcOrderBookHandler != null)
                {
                    _btcOrderBookHandler(this, new OrderBookEventArgs(obj, OrderState.Created));
                }
                if (_bchOrderBookHandler != null)
                {
                    _bchOrderBookHandler(this, new OrderBookEventArgs(obj, OrderState.Created));
                }
                if (_ltcOrderBookHandler != null)
                {
                    _ltcOrderBookHandler(this, new OrderBookEventArgs(obj, OrderState.Created));
                }
                if (_ethOrderBookHandler != null)
                {
                    _ethOrderBookHandler(this, new OrderBookEventArgs(obj, OrderState.Created));
                }
            }
        }