From f93bb3b9a921a4bdbb456002d31ad5cb0d6795c5 Mon Sep 17 00:00:00 2001 From: Victor Lee Date: Sat, 16 Apr 2022 16:20:44 -0700 Subject: [PATCH] fix post only order placement in Binance - only specify TIF in needed - fix nullability warning --- .../API/Exchanges/BinanceGroup/BinanceGroupCommon.cs | 5 +++-- src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs b/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs index e8f1762c..90612190 100644 --- a/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs +++ b/src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs @@ -547,7 +547,7 @@ protected override async Task> OnGetAmountsAvailable return balances; } - protected override async Task OnPlaceOrderAsync(ExchangeOrderRequest order) + protected override async Task OnPlaceOrderAsync(ExchangeOrderRequest order) { if (order.Price == null && order.OrderType != OrderType.Market) throw new ArgumentNullException(nameof(order.Price)); @@ -575,8 +575,9 @@ protected override async Task OnPlaceOrderAsync(ExchangeOrd if (order.OrderType != OrderType.Market) { decimal outputPrice = await ClampOrderPrice(order.MarketSymbol, order.Price.Value); - payload["timeInForce"] = "GTC"; payload["price"] = outputPrice; + if (order.IsPostOnly != true) + payload["timeInForce"] = "GTC"; } order.ExtraParameters.CopyTo(payload); diff --git a/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs b/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs index b01a70cf..55473c4b 100644 --- a/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs +++ b/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs @@ -192,7 +192,7 @@ protected virtual Task> OnGetFeesAsync() => throw new NotImplementedException(); protected virtual Task> OnGetAmountsAvailableToTradeAsync() => throw new NotImplementedException(); - protected virtual Task OnPlaceOrderAsync(ExchangeOrderRequest order) => + protected virtual Task OnPlaceOrderAsync(ExchangeOrderRequest order) => throw new NotImplementedException(); protected virtual Task OnPlaceOrdersAsync(params ExchangeOrderRequest[] order) => throw new NotImplementedException();