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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }