binance_cfutures: TimeOnForce is an optional order submission field (#867)

Do not add it to the request unless filled out as the API will deny the
request otherwise.
This commit is contained in:
Luis Rascão
2022-01-17 00:18:34 +00:00
committed by GitHub
parent 92047dac87
commit 58c0616a46
4 changed files with 13 additions and 5 deletions

View File

@@ -956,10 +956,15 @@ func (b *Binance) SubmitOrder(ctx context.Context, s *order.Submit) (order.Submi
return submitOrderResponse, fmt.Errorf("invalid side")
}
var oType string
var (
oType string
timeInForce RequestParamsTimeForceType
)
switch s.Type {
case order.Limit:
oType = cfuturesLimit
timeInForce = BinanceRequestParamsTimeGTC
case order.Market:
oType = cfuturesMarket
case order.Stop:
@@ -975,13 +980,14 @@ func (b *Binance) SubmitOrder(ctx context.Context, s *order.Submit) (order.Submi
default:
return submitOrderResponse, errors.New("invalid type, check api docs for updates")
}
o, err := b.FuturesNewOrder(
ctx,
&FuturesNewOrderRequest{
Symbol: s.Pair,
Side: reqSide,
OrderType: oType,
TimeInForce: "GTC",
TimeInForce: timeInForce,
NewClientOrderID: s.ClientOrderID,
Quantity: s.Amount,
Price: s.Price,