Пример #1
0
        public virtual void GetTicker_ShouldSuccess()
        {
            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

            // Act (one single action only)
            Ticker ticker = exchange.GetTicker("XBTUSD");

            // Assert
            Assert.IsNotNull(ticker);
        }
Пример #2
0
        public virtual void GetCandlesticks_ShouldSuccess()
        {
            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

            // Act (one single action only)
            IList <Candle> candles = exchange.GetCandlesticks("XBTUSD", CandleType.OneHour, DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now);

            // Assert
            Assert.IsNotNull(candles);
        }
Пример #3
0
        public virtual void NewOrder_CloseMarketSell_ShouldSuccess()
        {
            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

            // Act (one single action only)
            string orderID = exchange.NewOrder("XBTUSD", OrderType.CloseMarket, 100, OrderSide.Sell, null, null);

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

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

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

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

            // Act (one single action only)
            try { exchange.GetCandlesticks(null, CandleType.OneHour, DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now); } catch (Exception) { exceptionThrown = true; }

            // Assert
            Assert.IsTrue(exceptionThrown);
        }
Пример #6
0
        public virtual void GetOrderBook_ShouldSuccess()
        {
            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

            // Act (one single action only)
            IList <RawOrder> orderBook = exchange.GetOrderBook("XBTUSD");

            // Assert
            Assert.IsNotNull(orderBook);
        }
Пример #7
0
        public virtual void GetOrder_ShouldSuccess()
        {
            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

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

            // Assert
            Assert.IsNotNull(order);
        }
Пример #8
0
        public virtual void GetTicker_BadSymbol_ShouldThrowException()
        {
            bool exceptionThrown = false;

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

            // Act (one single action only)
            try { exchange.NewOrder("XBTUSD", OrderType.CloseLimit, 100, null, 10000, null); } catch (Exception) { exceptionThrown = true; }

            // Assert
            Assert.IsTrue(exceptionThrown);
        }
Пример #10
0
        public virtual void GetMargin_ShouldSuccess()
        {
            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

            // Act (one single action only)
            Margin margin = exchange.GetMargin();

            // Assert
            Assert.IsNotNull(margin);
        }
Пример #11
0
        public virtual void GetPosition_ShouldSuccess()
        {
            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

            // Act (one single action only)
            Position position = exchange.GetPosition("XBTUSD");

            // Assert
            Assert.IsNotNull(position);
        }
Пример #12
0
        public virtual void SetLeverage_NotAuthenticated_ShouldThrowException()
        {
            bool exceptionThrown = false;

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

            // Act (one single action only)
            try { exchange.SetLeverage("XBTUSD", MarginType.Fixed, 10); } catch (Exception) { exceptionThrown = true; }

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

            // Act (one single action only)
            try { exchange.CancelAllOrders("XBTUSD"); } catch (Exception) { exceptionThrown = true; }

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

            // Act (one single action only)
            try { exchange.AmendOrder("some_order_id", 200); } catch (Exception) { exceptionThrown = true; }

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

            // Act (one single action only)
            try { exchange.SetLeverage(null, MarginType.Fixed, 10); } catch (Exception) { exceptionThrown = true; }

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

            // Act (one single action only)
            try { exchange.SetLeverage("XBTUSD", MarginType.Fixed, 10); } catch { exceptionThrown = true; }

            // Assert
            Assert.IsFalse(exceptionThrown);
        }
Пример #19
0
        public virtual void CancelAllOrders_BadSymbol_ShouldThrowException()
        {
            bool exceptionThrown = false;

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

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

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

            // Act (one single action only)
            try { exchange.CancelAllOrders("XBTUSD"); } catch { exceptionThrown = true; }

            // Assert
            Assert.IsFalse(exceptionThrown);
        }
Пример #21
0
        public virtual void AmendOrder_BadOrderId_ShouldThrowException()
        {
            bool exceptionThrown = false;

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

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

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

            // Arrange
            BitmexAPI exchange = new BitmexAPI(new BitmexAPIStub());

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

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

            // Assert
            Assert.IsTrue(exceptionThrown);
        }