コード例 #1
0
        /// <summary>
        /// Create a new order book instance
        /// </summary>
        /// <param name="symbol">The symbol the order book is for</param>
        /// <param name="options">The options for the order book</param>
        public HuobiSymbolOrderBook(string symbol, HuobiOrderBookOptions?options = null) : base(symbol, options ?? new HuobiOrderBookOptions())
        {
            mergeStep = options?.MergeStep;
            _levels   = options?.Levels;

            if (_levels != 150 && mergeStep != null)
            {
                throw new ArgumentException("Mergestep only supported with 150 levels");
            }

            if (_levels == null && mergeStep == null)
            {
                throw new ArgumentException("Levels need to be set when MergeStep is not set");
            }

            socketClient = options?.SocketClient ?? new HuobiSocketClient();
            _socketOwner = options?.SocketClient == null;
        }
コード例 #2
0
 /// <summary>
 /// Create a new order book instance
 /// </summary>
 /// <param name="symbol">The symbol the order book is for</param>
 /// <param name="options">The options for the order book</param>
 public HuobiSymbolOrderBook(string symbol, HuobiOrderBookOptions?options = null) : base(symbol, options ?? new HuobiOrderBookOptions())
 {
     mergeStep    = options?.MergeStep ?? 0;
     socketClient = options?.SocketClient ?? new HuobiSocketClient();
 }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mergeStep">The way the entries are merged. 0 is no merge, 2 means to combine the entries on 2 decimal places</param>
 /// <param name="socketClient">The client to use for the socket connection. When using the same client for multiple order books the connection can be shared.</param>
 public HuobiOrderBookOptions(int?mergeStep = null, IHuobiSocketClient socketClient = null) : base("Huobi", false)
 {
     SocketClient = socketClient;
     MergeStep    = mergeStep;
 }