コード例 #1
0
ファイル: ZubrWebsocket.cs プロジェクト: vazsimon/ZubRobot
        /// <summary>
        /// Ticker stream subscription handler
        /// </summary>
        /// <param name="jt"></param>
        private void ProcessTickerMessage(JToken jt)
        {
            var payload = jt["result"]["data"]["value"].Children();

            foreach (var instrument in payload)
            {
                var           item = instrument.First();
                TickersUpdate t    = new TickersUpdate
                {
                    InstrumentId = item.Value <int>("id"),
                    LastPrice    = GetDecimal(item["lastPrice"]),
                    HighPrice24h = GetDecimal(item["highPrice24h"]),
                    LowPrice24h  = GetDecimal(item["lowPrice24h"]),
                    markPrice    = GetDecimal(item["markPrice"]),

                    Volume24h      = item.Value <decimal>("volume24h"),
                    PriceChange24h = item.Value <decimal>("priceChange24h")
                };
                Tickers?.Invoke(this, t);
            }
        }