Beispiel #1
0
        public void Initialise(ITradeObserver tradeObserver, ISlackMessenger slackMessenger)
        {
            _slackMessenger = slackMessenger;

            // Get the first price update  (no need to dispose as First() completes automatically)
            tradeObserver.TradeStream
            .Where(t => t.Coin.Equals(Coin))
            .FirstAsync()
            .Subscribe(first =>
            {
                // Note the price
                LastPrice = new PricePoint {
                    Coin = first.Coin, Price = first.Msg.Price
                };

                // Subscribe to the relevant window
                _subscription = tradeObserver.TradeStream
                                .Where(t => t.Coin.Equals(Coin))
                                .Sample(Window)
                                .Subscribe(Compare);
            });
        }
Beispiel #2
0
 public TradeMonitor(ITradeObserver tradeObserver, ISlackMessenger slackMessenger)
 {
     _tradeObserver  = tradeObserver;
     _slackMessenger = slackMessenger;
     _subscriptions  = new Dictionary <string, CoinMonitor>();
 }