Beispiel #1
0
 private async Task RaiseMarketUpdate(decimal last)
 {
     _ticker = new Ticker
     {
         Market     = _defaultMarket,
         Last       = last,
         BaseVolume = 1000,
         Ask        = 10,
         Bid        = last
     };
     _cryptoApiMock.Raise(c => c.MarketsUpdated += null, _cryptoTrader, new List <Ticker>
     {
         _ticker
     });
     await _cryptoTrader.ProcessMarketUpdates();
 }
Beispiel #2
0
        public async Task FilledBuyOrder_Should_ActivateTrade()
        {
            _updatedOrder = new CryptoOrder
            {
                Uuid      = "s2",
                OrderType = CryptoOrderType.LimitBuy
            };
            _traderGrainMock.Setup(t => t.GetActiveTrades()).ReturnsAsync(new List <Trade>
            {
                new Trade
                {
                    BuyOrder = new CryptoOrder {
                        Uuid = "s2"
                    }
                }
            });
            _updatedOrder.Market = "BTC-XLM";
            await _cryptoTrader.StartAsync("BTC-XLM");

            RaiseClosedOrder("s2");
            await _cryptoTrader.ProcessMarketUpdates();

            _cryptoTrader.Trades[0].BuyOrder.IsClosed.Should().BeTrue();
        }