Example #1
0
        public void MergeSingle(CoinTicker ticker)
        {
            Coin     = ticker.Coin;
            Exchange = ticker.Exchange;

            var theirTicker  = ticker.MarketTickers.First().Value;
            var marketTicker = MarketTickers.Get(theirTicker.Market);

            if (marketTicker != null)
            {
                marketTicker.Market       = theirTicker.Market;
                marketTicker.Ask          = theirTicker.Ask;
                marketTicker.Bid          = theirTicker.Bid;
                marketTicker.Last         = theirTicker.Last;
                marketTicker.High         = theirTicker.High;
                marketTicker.Low          = theirTicker.Low;
                marketTicker.PrevDayLast  = theirTicker.PrevDayLast;
                marketTicker.Volume       = theirTicker.Volume;
                marketTicker.TimeStamp    = theirTicker.TimeStamp;
                marketTicker.TickerSymbol = theirTicker.TickerSymbol;
            }
            else
            {
                MarketTickers.Add(theirTicker.Market, new CoinMarketTicker(
                                      Coin, Exchange, theirTicker.Market, theirTicker.TickerSymbol, theirTicker.Ask,
                                      theirTicker.Bid, theirTicker.Last, theirTicker.High, theirTicker.Low, theirTicker.PrevDayLast,
                                      theirTicker.Volume, theirTicker.TimeStamp));
            }
        }
Example #2
0
        public void Tick(CoinTicker ticker)
        {
            if (!Tickers.ContainsKey(ticker.Exchange))
            {
                Tickers.Add(ticker.Exchange, new CoinTicker(ticker.Coin, ticker.Exchange, ticker.MarketTickers));
            }

            var exchangeTicker = Tickers[ticker.Exchange];

            exchangeTicker.MergeSingle(ticker);
        }