binance: fix client order id checking

This commit is contained in:
c9s 2021-06-07 01:06:38 +08:00
parent 5fd0ab4cd3
commit f487b53d9e

View File

@ -522,13 +522,15 @@ func (e *Exchange) submitMarginOrder(ctx context.Context, order types.SubmitOrde
return nil, err
}
clientOrderID := newSpotClientOrderID(order.ClientOrderID)
req := e.Client.NewCreateMarginOrderService().
Symbol(order.Symbol).
Type(orderType).
Side(binance.SideType(order.Side)).
NewClientOrderID(clientOrderID)
Side(binance.SideType(order.Side))
clientOrderID := newSpotClientOrderID(order.ClientOrderID)
if len(clientOrderID) > 0 {
req.NewClientOrderID(clientOrderID)
}
// use response result format
req.NewOrderRespType(binance.NewOrderRespTypeRESULT)
@ -644,13 +646,16 @@ func (e *Exchange) submitSpotOrder(ctx context.Context, order types.SubmitOrder)
return nil, err
}
clientOrderID := newSpotClientOrderID(order.ClientOrderID)
req := e.Client.NewCreateOrderService().
Symbol(order.Symbol).
Side(binance.SideType(order.Side)).
NewClientOrderID(clientOrderID).
Type(orderType)
clientOrderID := newSpotClientOrderID(order.ClientOrderID)
if len(clientOrderID) > 0 {
req.NewClientOrderID(clientOrderID)
}
if len(order.QuantityString) > 0 {
req.Quantity(order.QuantityString)
} else if order.Market.Symbol != "" {