Пример #1
0
        public virtual void NewOrder_MarketSell_ShouldSuccess()
        {
            // Arrange
            OkexTokenAPI exchange = new OkexTokenAPI(new OkexTokenAPIStub());

            exchange.SetKeys("some_dummy_key", "some_dummy_secret", "some_dummy_passphrase");

            // Act (one single action only)
            string orderID = exchange.NewOrder("BTC-USDT", OrderType.Market, 100, OrderSide.Sell, null);

            // Assert
            Assert.IsNotNull(orderID);
        }
Пример #2
0
        public virtual void GetOrder_ShouldSuccess()
        {
            // Arrange
            OkexTokenAPI exchange = new OkexTokenAPI(new OkexTokenAPIStub());

            exchange.SetKeys("some_dummy_key", "some_dummy_secret", "some_dummy_passphrase");

            // Act (one single action only)
            Order order = exchange.GetOrder("BTC-USDT", "some_order_id");

            // Assert
            Assert.IsNotNull(order);
        }
Пример #3
0
        public virtual void GetOpenOrders_ShouldSuccess()
        {
            // Arrange
            OkexTokenAPI exchange = new OkexTokenAPI(new OkexTokenAPIStub());

            exchange.SetKeys("some_dummy_key", "some_dummy_secret", "some_dummy_passphrase");

            // Act (one single action only)
            IList <Order> openOrders = exchange.GetOpenOrders("BTC-USDT");

            // Assert
            Assert.IsNotNull(openOrders);
        }
Пример #4
0
        public virtual void GetWallet_ShouldSuccess()
        {
            // Arrange
            OkexTokenAPI exchange = new OkexTokenAPI(new OkexTokenAPIStub());

            exchange.SetKeys("some_dummy_key", "some_dummy_secret", "some_dummy_passphrase");

            // Act (one single action only)
            Wallet wallet = exchange.GetWallet();

            // Assert
            Assert.IsNotNull(wallet);
        }
Пример #5
0
        public virtual void CancelOrder_BadOrderId_ShouldThrowException()
        {
            bool exceptionThrown = false;

            // Arrange
            OkexTokenAPI exchange = new OkexTokenAPI(new OkexTokenAPIStub());

            exchange.SetKeys("some_dummy_key", "some_dummy_secret", "some_dummy_passphrase");

            // Act (one single action only)
            try { exchange.CancelOrder("BTC-USDT", null); } catch (Exception) { exceptionThrown = true; }

            // Assert
            Assert.IsTrue(exceptionThrown);
        }
Пример #6
0
        public virtual void NewOrder_NoPriceForLimitOrders_ShouldThrowException()
        {
            bool exceptionThrown = false;

            // Arrange
            OkexTokenAPI exchange = new OkexTokenAPI(new OkexTokenAPIStub());

            exchange.SetKeys("some_dummy_key", "some_dummy_secret", "some_dummy_passphrase");

            // Act (one single action only)
            try { exchange.NewOrder("BTC-USDT", OrderType.Limit, 100, OrderSide.Buy, null); } catch (Exception) { exceptionThrown = true; }

            // Assert
            Assert.IsTrue(exceptionThrown);
        }
Пример #7
0
        public virtual void GetOrderBook_BadSymbol_ShouldThrowException()
        {
            bool exceptionThrown = false;

            // Arrange
            OkexTokenAPI exchange = new OkexTokenAPI(new OkexTokenAPIStub());

            exchange.SetKeys("some_dummy_key", "some_dummy_secret", "some_dummy_passphrase");

            // Act (one single action only)
            try { exchange.GetOrderBook(null); } catch (Exception) { exceptionThrown = true; }

            // Assert
            Assert.IsTrue(exceptionThrown);
        }