コード例 #1
0
        public void SetAllocationHappyFlow()
        {
            var alloc    = new AllocationManager(LoggerFactory, _fetcher, null);
            var currency = new Currency("ETH");

            alloc.SetInitialConfiguration(new Portfolio(new Dictionary <Currency, Balance>()
            {
                { currency, new Balance(currency, 2, 0) },
            }));

            Assert.Equal(2, alloc.GetAvailableFunds(currency).Free);
            Assert.Equal(0, alloc.GetAvailableFunds(currency).Locked);
        }
コード例 #2
0
        public void ValidateAllocationsSetRequired()
        {
            var allocationManager = new AllocationManager(LoggerFactory, _fetcher, null);

            Currency c = new Currency("ETH");

            Assert.Throws <ArgumentNullException>(() => allocationManager.GetAvailableFunds(c));

            Assert.Throws <ArgumentNullException>(() => allocationManager.GetAllFunds());

            Assert.Throws <ArgumentNullException>(() => allocationManager.QueueTrade(
                                                      new TradeProposal(TradingPair.Parse("EOSETH"), new Balance(c, 10, 10)),
                                                      () => new OrderUpdate(
                                                          orderId: 0,
                                                          tradeId: 0,
                                                          orderStatus: OrderUpdate.OrderStatus.New,
                                                          orderType: OrderUpdate.OrderTypes.Limit,
                                                          createdTimestamp: 0,
                                                          setPrice: 0,
                                                          side: OrderSide.Buy,
                                                          pair: TradingPair.Parse("EOSETH"),
                                                          setQuantity: 0)));
        }