Пример #1
0
        /// <summary>
        /// Orderbook subscription handler
        /// </summary>
        /// <param name="jt"></param>
        private void ProcessOrderbookMessage(JToken jt)
        {
            var payload = jt["result"]["data"]["value"].Children();

            foreach (var instrument in payload)
            {
                var item = instrument.First();

                OrderbookUpdate t = new OrderbookUpdate
                {
                    InstrumentId = item.Value <int>("instrumentId"),
                    IsSnapshot   = item.Value <bool>("isSnapshot"),
                    Asks         = TransformOrderBookRaw(item["asks"]),
                    Bids         = TransformOrderBookRaw(item["bids"]),
                };

                Orderbook?.Invoke(this, t);
            }
        }