Esempio n. 1
0
        /// <summary>
        /// Get the mid-market price between the best (top) ask and bid prices.
        /// </summary>
        /// <param name="top"></param>
        /// <returns></returns>
        public static decimal MidMarketPrice(this OrderBookTop top)
        {
            Throw.IfNull(top, nameof(top));

            return((top.Ask.Price + top.Bid.Price) / 2);
        }
Esempio n. 2
0
 /// <summary>
 /// Get whether a price is the best bid or ask price.
 /// </summary>
 /// <param name="orderBookTop">The order book top.</param>
 /// <param name="price">The price.</param>
 /// <returns></returns>
 public static bool IsBestPrice(this OrderBookTop orderBookTop, decimal price)
 {
     return(price == orderBookTop.Bid.Price || price == orderBookTop.Ask.Price);
 }
Esempio n. 3
0
        /// <summary>
        /// Get the price difference between the best (top) ask and bid prices.
        /// </summary>
        /// <param name="top"></param>
        /// <returns></returns>
        public static decimal Spread(this OrderBookTop top)
        {
            Throw.IfNull(top, nameof(top));

            return(top.Ask.Price - top.Bid.Price);
        }