示例#1
0
        void _api_OnTradeUpdate(object sender, BitMexTrade trade)
        {
            //update data cache
            if (!_cache.Instruments.ContainsKey(trade.symbol))
            {
                Logging.Log("Market trade, but instrument not yet downloaded", trade.symbol, trade.price);
            }
            else
            {
                Logging.Log("Updating last price {0} {1}", trade.symbol, trade.price);
                _cache.Instruments[trade.symbol].lastPrice = trade.price;
            }

            //no current subscription for this product
            if (!_topics.ContainsKey(trade.symbol))
            {
                return;
            }

            Dictionary <Tuple <DataPoint, int>, Topic> productTopics = _topics[trade.symbol].TopicItems;

            //update any last price/size subscriptions
            Tuple <DataPoint, int> key = Tuple.Create(DataPoint.Last, 0);

            if (productTopics.ContainsKey(key))
            {
                productTopics[key].UpdateValue(trade.price);
            }
        }
示例#2
0
        void _api_OnTradeUpdate(object sender, BitMexTrade trade)
        {
            //update data cache
            if(!_cache.Instruments.ContainsKey(trade.symbol))
            {
                Logging.Log("Market trade, but instrument not yet downloaded", trade.symbol, trade.price);
            }
            else
            {
                Logging.Log("Updating last price {0} {1}", trade.symbol, trade.price);
                _cache.Instruments[trade.symbol].lastPrice = trade.price;
            }

            //no current subscription for this product
            if (!_topics.ContainsKey(trade.symbol))
                return;

            Dictionary<Tuple<DataPoint, int>, Topic> productTopics = _topics[trade.symbol].TopicItems;

            //update any last price/size subscriptions
            Tuple<DataPoint, int> key = Tuple.Create(DataPoint.Last, 0);
            if (productTopics.ContainsKey(key))
                productTopics[key].UpdateValue(trade.price);

        }