コード例 #1
0
ファイル: OrderBookTop.cs プロジェクト: nakhhuan/Binance
        /// <summary>
        /// Construct order book top.
        /// </summary>
        /// <param name="orderBook">The order book.</param>
        internal OrderBookTop(OrderBook orderBook)
        {
            Throw.IfNull(orderBook, nameof(orderBook));

            Symbol = orderBook.Symbol;

            Bid = orderBook.Bids.First();
            Ask = orderBook.Asks.First();
        }
コード例 #2
0
        /// <summary>
        /// Construct order book top.
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        /// <param name="bidPrice">The best bid price.</param>
        /// <param name="bidQuantity">The best bid quantity.</param>
        /// <param name="askPrice">The best ask price.</param>
        /// <param name="askQuantity">The best ask quantity.</param>
        public OrderBookTop(string symbol, decimal bidPrice, decimal bidQuantity, decimal askPrice, decimal askQuantity)
        {
            Throw.IfNullOrWhiteSpace(symbol, nameof(symbol));

            if (bidPrice > askPrice)
            {
                throw new ArgumentException($"{nameof(OrderBookTop)} ask price must be greater than the bid price.", nameof(askPrice));
            }

            Symbol = symbol;

            Bid = new OrderBookPriceLevel(bidPrice, bidQuantity);
            Ask = new OrderBookPriceLevel(askPrice, askQuantity);
        }
コード例 #3
0
ファイル: OrderBookTop.cs プロジェクト: nakhhuan/Binance
        /// <summary>
        /// Construct order book top.
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        /// <param name="bid">The bid price and quantity.</param>
        /// <param name="ask">The ask price and quantity.</param>
        public OrderBookTop(string symbol, OrderBookPriceLevel bid, OrderBookPriceLevel ask)
        {
            Throw.IfNullOrWhiteSpace(symbol, nameof(symbol));
            Throw.IfNull(bid, nameof(bid));
            Throw.IfNull(ask, nameof(ask));

            if (bid.Price > ask.Price)
            {
                throw new ArgumentException($"{nameof(OrderBookTop)} ask price must be greater than the bid price.", nameof(ask.Price));
            }

            Symbol = symbol.FormatSymbol();

            Bid = bid;
            Ask = ask;
        }