コード例 #1
0
        private async Task SendAndCheckNotifications(FindNewTradesResponse newTradesResponse)
        {
            if (newTradesResponse.NewTrades.Count() > 29)
            {
                await _bus.SendAsync(
                    new SendMessageCommand(
                        "There are more than 30 Poloniex trades to send. Not going to send them to avoid spamming you"));

                return;
            }

            foreach (var newTrade in newTradesResponse.NewTrades)
            {
                if (newTrade.Side == TradeSide.Sell && _config.SellNotifications)
                {
                    await _bus.SendAsync(new TradeNotificationCommand(newTrade));
                }

                if (newTrade.Side == TradeSide.Buy && _config.BuyNotifications)
                {
                    await _bus.SendAsync(new TradeNotificationCommand(newTrade));
                }
            }
        }