Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }