コード例 #1
0
        private bool TryHandleUpdateMessages(string message)
        {
            if (MarketCandlestickUpdateMessage.TryParse(Serializer, message, out var marketCandlestick))
            {
                Streams.CandlestickUpdateSubject.OnNext(marketCandlestick);
                return(true);
            }

            if (MarketDepthUpdateMessage.TryParse(Serializer, message, out var marketDepth))
            {
                Streams.DepthUpdateSubject.OnNext(marketDepth);
                return(true);
            }

            if (MarketByPriceRefreshUpdateMessage.TryParse(Serializer, message, out var marketByPriceRefresh))
            {
                Streams.MarketByPriceRefreshUpdateSubject.OnNext(marketByPriceRefresh);
                return(true);
            }

            if (MarketBestBidOfferUpdateMessage.TryParse(Serializer, message, out var marketBestBidOffer))
            {
                Streams.BestBidOfferUpdateSubject.OnNext(marketBestBidOffer);
                return(true);
            }

            if (MarketTradeDetailUpdateMessage.TryParse(Serializer, message, out var marketTradeDetail))
            {
                Streams.TradeDetailUpdateSubject.OnNext(marketTradeDetail);
                return(true);
            }

            if (MarketDetailsUpdateMessage.TryParse(Serializer, message, out var marketDetails))
            {
                Streams.MarketDetailsUpdateSubject.OnNext(marketDetails);
                return(true);
            }

            return(false);
        }
コード例 #2
0
        private void Handle(MarketByPriceRefreshUpdateMessage msg)
        {
            if (msg.Tick?.Bids != null)
            {
                for (var i = 0; i < msg.Tick.Bids.Length; ++i)
                {
                    var bid = msg.Tick.Bids[i];

                    _logger.LogInformation($"Market by price update {msg.ParseSymbolFromTopic()} | [bid {i}: price={bid.Price} size={bid.Size}]");
                }
            }

            if (msg.Tick?.Asks != null)
            {
                for (var i = 0; i < msg.Tick.Asks.Length; ++i)
                {
                    var bid = msg.Tick.Asks[i];

                    _logger.LogInformation($"Market by price update {msg.ParseSymbolFromTopic()} | [ask {i}: price={bid.Price} size={bid.Size}]");
                }
            }
        }