public void should_delete_many_buy_orders() { // arrange var @params = new OrderBulkPOSTRequestParams { Orders = new[] { OrderPOSTRequestParams.CreateSimpleHidenLimit("XBTUSD", 3, _xbtAvgPrice - LimitPriceSubtractor, OrderSide.Buy), OrderPOSTRequestParams.CreateSimpleHidenLimit("XBTUSD", 3, _xbtAvgPrice - LimitPriceSubtractor, OrderSide.Buy) } }; var resultInsert = Sut.Execute(BitmexApiUrls.Order.PostOrderBulk, @params).Result.Result; // act var @paramsToDelete = new OrderDELETERequestParams { OrderID = string.Join(",", resultInsert.Select(a => a.OrderId)) }; var result = Sut.Execute(BitmexApiUrls.Order.DeleteOrder, @paramsToDelete).Result.Result; // assert result.Should().NotBeNull(); result.All(a => a.OrdStatus == "Canceled").Should().BeTrue(); result.All(a => !string.IsNullOrWhiteSpace(a.OrderId)).Should().BeTrue(); }
public void should_delete_sell_limit_order() { // arrange var @params = OrderPOSTRequestParams.CreateMarketStopOrder("XBTUSD", 3, _xbtAvgPrice - LimitPriceSubtractor, OrderSide.Sell); var result = Sut.Execute(BitmexApiUrls.Order.PostOrder, @params).Result.Result; result.Should().NotBeNull(); result.OrdType.Should().Be("Stop"); result.OrdStatus.Should().Be("New"); result.OrderId.Should().NotBeNull(); var @paramsPut = new OrderDELETERequestParams() { OrderID = result.OrderId, Text = "testing api" }; // act var resultDelete = Sut.Execute(BitmexApiUrls.Order.DeleteOrder, paramsPut).Result.Result.FirstOrDefault(a => a.OrderId == result.OrderId); // assert resultDelete.Should().NotBeNull(); resultDelete.OrdType.Should().Be("Stop"); resultDelete.OrdStatus.Should().Be("Canceled"); resultDelete.OrderId.Should().NotBeNull(); }
public void should_throw_bitmex_exception_with_deserialized_data_when_delete() { // arrange var @paramsDelete = new OrderDELETERequestParams() { // this order doesn't exist OrderID = Guid.NewGuid().ToString("N"), Text = "testing api" }; // act Action action = () => { var resultPut = Sut.Execute(BitmexApiUrls.Order.DeleteOrder, @paramsDelete).Result; }; // assert action.Should().Throw <BitmexApiException>().Which.Error?.Error.Should().NotBeNull(); }
// Market Order private void btn3_Click(object sender, EventArgs e) { //Log.Debug("Testing Button clicked 123"); //var bitmexApiServiceA = BitmexApiService.CreateDefaultApi(new BitmexAuthorization //{ // BitmexEnvironment = BitmexEnvironment.Test, // Key = "vUVW4tbj-wZG5UQgRkqHL4_z", // Secret = "8HaCUEbx0qgJfQSo4EiX6RUGzDsjiY-uOsEsCBstIpYu-J7Q" //}); var bitmexApiServiceA = BitmexApiService_Test_POS_Outcome.CreateDefaultApi("111"); var OrderParamsA = OrderPOSTRequestParams.CreateSimpleLimit("XBTUSD", "1234HoedjeVanPapier-1234", 150, (decimal)10150.0, OrderSide.Buy); bitmexApiServiceA.Execute(BitmexApiUrls.Order.PostOrder, OrderParamsA).ContinueWith(HandleOrderResponse, TaskContinuationOptions.AttachedToParent); var OrderParams = new OrderDELETERequestParams() { ClOrdID = "bladieblakakkahahhaha" }; var result = bitmexApiServiceA.Execute(BitmexApiUrls.Order.DeleteOrder, OrderParams); MessageBox.Show(result.Result.Result[0].ToString()); }
private async void CancleOrder() { var deleteOrderParams = OrderDELETERequestParams.CancleOrderByID(SelectedOrder); var bitmexApiService = BitmexApiService.CreateDefaultApi(_bitmexAuthorization); await bitmexApiService.Execute(BitmexApiUrls.Order.DeleteOrder, deleteOrderParams); }