mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 15:10:03 +00:00
huobi futures: fix client order id submit order (#876)
As per Huobi Futures documentation, client order id must be an integer field in the request. For most other exchanges this is a string field so to accomodate we keep the string representation and convert to a number right before the request goes on the wire.
This commit is contained in:
@@ -716,7 +716,14 @@ func (h *HUOBI) FOrder(ctx context.Context, contractCode currency.Pair, symbol,
|
||||
req["contract_code"] = codeValue
|
||||
}
|
||||
if clientOrderID != "" {
|
||||
req["client_order_id"] = clientOrderID
|
||||
// Client order id is an integer, convert it here
|
||||
// https://huobiapi.github.io/docs/dm/v1/en/#place-an-order
|
||||
id, err := strconv.Atoi(clientOrderID)
|
||||
if err != nil {
|
||||
return resp,
|
||||
fmt.Errorf("unable to convert client order id to integer, %s: %w", clientOrderID, err)
|
||||
}
|
||||
req["client_order_id"] = id
|
||||
}
|
||||
req["direction"] = direction
|
||||
if !common.StringDataCompareInsensitive(validOffsetTypes, offset) {
|
||||
|
||||
Reference in New Issue
Block a user