Skip to content

Commit 0062139

Browse files
authored
fix post only order placement in Binance (#767)
1 parent 5b55dd0 commit 0062139

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ protected override async Task<Dictionary<string, decimal>> OnGetAmountsAvailable
547547
return balances;
548548
}
549549

550-
protected override async Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrderRequest order)
550+
protected override async Task<ExchangeOrderResult?> OnPlaceOrderAsync(ExchangeOrderRequest order)
551551
{
552552
if (order.Price == null && order.OrderType != OrderType.Market) throw new ArgumentNullException(nameof(order.Price));
553553

@@ -575,8 +575,9 @@ protected override async Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrd
575575
if (order.OrderType != OrderType.Market)
576576
{
577577
decimal outputPrice = await ClampOrderPrice(order.MarketSymbol, order.Price.Value);
578-
payload["timeInForce"] = "GTC";
579578
payload["price"] = outputPrice;
579+
if (order.IsPostOnly != true)
580+
payload["timeInForce"] = "GTC";
580581
}
581582
order.ExtraParameters.CopyTo(payload);
582583

src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected virtual Task<Dictionary<string, decimal>> OnGetFeesAsync() =>
192192
throw new NotImplementedException();
193193
protected virtual Task<Dictionary<string, decimal>> OnGetAmountsAvailableToTradeAsync() =>
194194
throw new NotImplementedException();
195-
protected virtual Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrderRequest order) =>
195+
protected virtual Task<ExchangeOrderResult?> OnPlaceOrderAsync(ExchangeOrderRequest order) =>
196196
throw new NotImplementedException();
197197
protected virtual Task<ExchangeOrderResult[]> OnPlaceOrdersAsync(params ExchangeOrderRequest[] order) =>
198198
throw new NotImplementedException();

0 commit comments

Comments
 (0)