mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
binance: set TimeInForce to GTC by default for limit orders
Binance does not allow submitting order without TimeInForce set for certain order types. Set TimeInforce to GTC (Good-Til-Cancel) by default.
This commit is contained in:
parent
9e8989ae15
commit
e7961be86a
|
@ -538,6 +538,11 @@ func (e *Exchange) submitMarginOrder(ctx context.Context, order types.SubmitOrde
|
||||||
if len(order.TimeInForce) > 0 {
|
if len(order.TimeInForce) > 0 {
|
||||||
// TODO: check the TimeInForce value
|
// TODO: check the TimeInForce value
|
||||||
req.TimeInForce(binance.TimeInForceType(order.TimeInForce))
|
req.TimeInForce(binance.TimeInForceType(order.TimeInForce))
|
||||||
|
} else {
|
||||||
|
switch order.Type {
|
||||||
|
case types.OrderTypeLimit, types.OrderTypeStopLimit:
|
||||||
|
req.TimeInForce(binance.TimeInForceTypeGTC)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := req.Do(ctx)
|
response, err := req.Do(ctx)
|
||||||
|
@ -614,6 +619,11 @@ func (e *Exchange) submitSpotOrder(ctx context.Context, order types.SubmitOrder)
|
||||||
if len(order.TimeInForce) > 0 {
|
if len(order.TimeInForce) > 0 {
|
||||||
// TODO: check the TimeInForce value
|
// TODO: check the TimeInForce value
|
||||||
req.TimeInForce(binance.TimeInForceType(order.TimeInForce))
|
req.TimeInForce(binance.TimeInForceType(order.TimeInForce))
|
||||||
|
} else {
|
||||||
|
switch order.Type {
|
||||||
|
case types.OrderTypeLimit, types.OrderTypeStopLimit:
|
||||||
|
req.TimeInForce(binance.TimeInForceTypeGTC)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := req.Do(ctx)
|
response, err := req.Do(ctx)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user