diff --git a/exchanges/okx/okx.go b/exchanges/okx/okx.go index de45e4863d5..e4d0b1c5e46 100644 --- a/exchanges/okx/okx.go +++ b/exchanges/okx/okx.go @@ -242,103 +242,103 @@ const ( ) var ( - errNo24HrTradeVolumeFound = errors.New("no trade record found in the 24 trade volume ") - errOracleInformationNotFound = errors.New("oracle information not found") - errExchangeInfoNotFound = errors.New("exchange information not found") - errIndexComponentNotFound = errors.New("unable to fetch index components") - errMissingRequiredArgInstType = errors.New("invalid required argument instrument type") - errLimitValueExceedsMaxOf100 = errors.New("limit value exceeds the maximum value 100") - errMissingInstrumentID = errors.New("missing instrument id") - errFundingRateHistoryNotFound = errors.New("funding rate history not found") - errMissingRequiredUnderlying = errors.New("error missing required parameter underlying") - errMissingRequiredParamInstID = errors.New("missing required parameter instrument id") - errLiquidationOrderResponseNotFound = errors.New("liquidation order not found") - errEitherInstIDOrCcyIsRequired = errors.New("either parameter instId or ccy is required") - errIncorrectRequiredParameterTradeMode = errors.New("unacceptable required argument, trade mode") - errInterestRateAndLoanQuotaNotFound = errors.New("interest rate and loan quota not found") - errUnderlyingsForSpecifiedInstTypeNofFound = errors.New("underlyings for the specified instrument id is not found") - errInsuranceFundInformationNotFound = errors.New("insurance fund information not found") - errMissingExpiryTimeParameter = errors.New("missing expiry date parameter") - errInvalidTradeModeValue = errors.New("invalid trade mode value") - errInvalidOrderType = errors.New("invalid order type") - errInvalidAmount = errors.New("unacceptable quantity to buy or sell") - errMissingClientOrderIDOrOrderID = errors.New("client supplier order id or order id is missing") - errInvalidNewSizeOrPriceInformation = errors.New("invalid the new size or price information") - errMissingNewSize = errors.New("missing the order size information") - errMissingMarginMode = errors.New("missing required param margin mode \"mgnMode\"") - errInvalidTriggerPrice = errors.New("invalid trigger price value") - errInvalidPriceLimit = errors.New("invalid price limit value") - errMissingIntervalValue = errors.New("missing interval value") - errMissingTakeProfitTriggerPrice = errors.New("missing take profit trigger price") - errMissingTakeProfitOrderPrice = errors.New("missing take profit order price") - errMissingSizeLimit = errors.New("missing required parameter \"szLimit\"") - errMissingEitherAlgoIDOrState = errors.New("either algo id or order state is required") - errUnacceptableAmount = errors.New("amount must be greater than 0") - errInvalidCurrencyValue = errors.New("invalid currency value") - errInvalidDepositAmount = errors.New("invalid deposit amount") - errMissingResponseBody = errors.New("error missing response body") - errMissingValidWithdrawalID = errors.New("missing valid withdrawal id") - errNoValidResponseFromServer = errors.New("no valid response from server") - errInstrumentTypeRequired = errors.New("instrument type required") - errInvalidInstrumentType = errors.New("invalid instrument type") - errMissingValidGreeksType = errors.New("missing valid greeks type") - errMissingIsolatedMarginTradingSetting = errors.New("missing isolated margin trading setting, isolated margin trading settings automatic:Auto transfers autonomy:Manual transfers") - errInvalidOrderSide = errors.New("invalid order side") - errInvalidCounterParties = errors.New("missing counter parties") - errInvalidLegs = errors.New("no legs are provided") - errMissingRFQIDANDClientSuppliedRFQID = errors.New("missing rfq id or client supplied rfq id") - errMissingRfqIDOrQuoteID = errors.New("either RFQ ID or Quote ID is missing") - errMissingRfqID = errors.New("error missing rfq id") - errMissingLegs = errors.New("missing legs") - errMissingSizeOfQuote = errors.New("missing size of quote leg") - errMossingLegsQuotePrice = errors.New("error missing quote price") - errMissingQuoteIDOrClientSuppliedQuoteID = errors.New("missing quote id or client supplied quote id") - errMissingEitherQuoteIDAOrClientSuppliedQuoteIDs = errors.New("missing either quote ids or client supplied quote ids") - errMissingRequiredParameterSubaccountName = errors.New("missing required parameter subaccount name") - errInvalidTransferAmount = errors.New("unacceptable transfer amount") - errInvalidSubaccount = errors.New("invalid account type") - errMissingDestinationSubaccountName = errors.New("missing destination subaccount name") - errMissingInitialSubaccountName = errors.New("missing initial subaccount name") - errMissingAlgoOrderType = errors.New("missing algo order type \"grid\": Spot grid, \"contract_grid\": Contract grid") - errInvalidMaximumPrice = errors.New("invalid maximum price") - errInvalidMinimumPrice = errors.New("invalid minimum price") - errInvalidGridQuantity = errors.New("invalid grid quantity (grid number)") - errMissingSize = errors.New("missing required argument, size") - errMissingRequiredArgumentDirection = errors.New("missing required argument, direction") - errRequiredParameterMissingLeverage = errors.New("missing required parameter, leverage") - errMissingAlgoOrderID = errors.New("missing algo orders id") - errMissingValidStopType = errors.New("invalid grid order stop type, only values are \"1\" and \"2\" ") - errMissingSubOrderType = errors.New("missing sub order type") - errMissingQuantity = errors.New("invalid quantity to buy or sell") - errDepositAddressNotFound = errors.New("deposit address with the specified currency code and chain not found") - errMissingAtLeast1CurrencyPair = errors.New("at least one currency is required to fetch order history") - errNoCandlestickDataFound = errors.New("no candlesticks data found") - errInvalidWebsocketEvent = errors.New("invalid websocket event") - errMissingValidChannelInformation = errors.New("missing channel information") - errNilArgument = errors.New("nil argument is not acceptable") - errNoOrderParameterPassed = errors.New("no order parameter was passed") - errMaxRFQOrdersToCancel = errors.New("no more than 100 RFQ cancel order parameter is allowed") - errMalformedData = errors.New("malformed data") - errInvalidUnderlying = errors.New("invalid underlying") - errMissingRequiredParameter = errors.New("missing required parameter") - errMissingMakerInstrumentSettings = errors.New("missing maker instrument settings") - errInvalidSubAccountName = errors.New("invalid sub-account name") - errInvalidAPIKey = errors.New("invalid api key") - errInvalidAlgoID = errors.New("invalid algo id") - errInvalidMarginTypeAdjust = errors.New("invalid margin type adjust, only 'add' and 'reduce' are allowed") - errInvalidAlgoOrderType = errors.New("invalid algo order type") - errEmptyArgument = errors.New("empty argument") - errInvalidIPAddress = errors.New("invalid ip address") - errInvalidAPIKeyPermission = errors.New("invalid API Key permission") - errInvalidResponseParam = errors.New("invalid response parameter, response must be non-nil pointer") - errEmptyPlaceOrderResponse = errors.New("empty place order response") - errTooManyArgument = errors.New("too many cancel request params") - errIncompleteCurrencyPair = errors.New("incomplete currency pair") - errInvalidDuration = errors.New("invalid grid contract duration, only '7D', '30D', and '180D' are allowed") - errInvalidProtocolType = errors.New("invalid protocol type, only 'staking' and 'defi' allowed") - errExceedLimit = errors.New("limit exceeded") - errOnlyThreeMonthsSupported = errors.New("only three months of trade data retrieval supported") - errNoInstrumentFound = errors.New("no instrument found") + errNo24HrTradeVolumeFound = errors.New("no trade record found in the 24 trade volume ") + errOracleInformationNotFound = errors.New("oracle information not found") + errExchangeInfoNotFound = errors.New("exchange information not found") + errIndexComponentNotFound = errors.New("unable to fetch index components") + errMissingRequiredArgInstType = errors.New("invalid required argument instrument type") + errLimitValueExceedsMaxOf100 = errors.New("limit value exceeds the maximum value 100") + errMissingInstrumentID = errors.New("missing instrument id") + errFundingRateHistoryNotFound = errors.New("funding rate history not found") + errMissingRequiredUnderlying = errors.New("error missing required parameter underlying") + errMissingRequiredParamInstID = errors.New("missing required parameter instrument id") + errLiquidationOrderResponseNotFound = errors.New("liquidation order not found") + errEitherInstIDOrCcyIsRequired = errors.New("either parameter instId or ccy is required") + errIncorrectRequiredParameterTradeMode = errors.New("unacceptable required argument, trade mode") + errInterestRateAndLoanQuotaNotFound = errors.New("interest rate and loan quota not found") + errUnderlyingsForSpecifiedInstTypeNofFound = errors.New("underlyings for the specified instrument id is not found") + errInsuranceFundInformationNotFound = errors.New("insurance fund information not found") + errMissingExpiryTimeParameter = errors.New("missing expiry date parameter") + errInvalidTradeModeValue = errors.New("invalid trade mode value") + errInvalidOrderType = errors.New("invalid order type") + errInvalidAmount = errors.New("unacceptable quantity to buy or sell") + errMissingClientOrderIDOrOrderID = errors.New("client supplier order id or order id is missing") + errInvalidNewSizeOrPriceInformation = errors.New("invalid the new size or price information") + errMissingNewSize = errors.New("missing the order size information") + errMissingMarginMode = errors.New("missing required param margin mode \"mgnMode\"") + errInvalidTriggerPrice = errors.New("invalid trigger price value") + errInvalidPriceLimit = errors.New("invalid price limit value") + errMissingIntervalValue = errors.New("missing interval value") + errMissingTakeProfitTriggerPrice = errors.New("missing take profit trigger price") + errMissingTakeProfitOrderPrice = errors.New("missing take profit order price") + errMissingSizeLimit = errors.New("missing required parameter \"szLimit\"") + errMissingEitherAlgoIDOrState = errors.New("either algo id or order state is required") + errUnacceptableAmount = errors.New("amount must be greater than 0") + errInvalidCurrencyValue = errors.New("invalid currency value") + errInvalidDepositAmount = errors.New("invalid deposit amount") + errMissingResponseBody = errors.New("error missing response body") + errMissingValidWithdrawalID = errors.New("missing valid withdrawal id") + errNoValidResponseFromServer = errors.New("no valid response from server") + errInstrumentTypeRequired = errors.New("instrument type required") + errInvalidInstrumentType = errors.New("invalid instrument type") + errMissingValidGreeksType = errors.New("missing valid greeks type") + errMissingIsolatedMarginTradingSetting = errors.New("missing isolated margin trading setting, isolated margin trading settings automatic:Auto transfers autonomy:Manual transfers") + errInvalidOrderSide = errors.New("invalid order side") + errInvalidCounterParties = errors.New("missing counter parties") + errInvalidLegs = errors.New("no legs are provided") + errMissingRFQIDANDClientRFQID = errors.New("missing rfq id or client supplied rfq id") + errMissingRfqIDOrQuoteID = errors.New("either RFQ ID or Quote ID is missing") + errMissingRfqID = errors.New("error missing rfq id") + errMissingLegs = errors.New("missing legs") + errMissingSizeOfQuote = errors.New("missing size of quote leg") + errMossingLegsQuotePrice = errors.New("error missing quote price") + errMissingQuoteIDOrClientQuoteID = errors.New("missing quote id or client supplied quote id") + errMissingEitherQuoteIDAOrClientQuoteIDs = errors.New("missing either quote ids or client supplied quote ids") + errMissingRequiredParameterSubaccountName = errors.New("missing required parameter subaccount name") + errInvalidTransferAmount = errors.New("unacceptable transfer amount") + errInvalidSubaccount = errors.New("invalid account type") + errMissingDestinationSubaccountName = errors.New("missing destination subaccount name") + errMissingInitialSubaccountName = errors.New("missing initial subaccount name") + errMissingAlgoOrderType = errors.New("missing algo order type \"grid\": Spot grid, \"contract_grid\": Contract grid") + errInvalidMaximumPrice = errors.New("invalid maximum price") + errInvalidMinimumPrice = errors.New("invalid minimum price") + errInvalidGridQuantity = errors.New("invalid grid quantity (grid number)") + errMissingSize = errors.New("missing required argument, size") + errMissingRequiredArgumentDirection = errors.New("missing required argument, direction") + errRequiredParameterMissingLeverage = errors.New("missing required parameter, leverage") + errMissingAlgoOrderID = errors.New("missing algo orders id") + errMissingValidStopType = errors.New("invalid grid order stop type, only values are \"1\" and \"2\" ") + errMissingSubOrderType = errors.New("missing sub order type") + errMissingQuantity = errors.New("invalid quantity to buy or sell") + errDepositAddressNotFound = errors.New("deposit address with the specified currency code and chain not found") + errMissingAtLeast1CurrencyPair = errors.New("at least one currency is required to fetch order history") + errNoCandlestickDataFound = errors.New("no candlesticks data found") + errInvalidWebsocketEvent = errors.New("invalid websocket event") + errMissingValidChannelInformation = errors.New("missing channel information") + errNilArgument = errors.New("nil argument is not acceptable") + errNoOrderParameterPassed = errors.New("no order parameter was passed") + errMaxRFQOrdersToCancel = errors.New("no more than 100 RFQ cancel order parameter is allowed") + errMalformedData = errors.New("malformed data") + errInvalidUnderlying = errors.New("invalid underlying") + errMissingRequiredParameter = errors.New("missing required parameter") + errMissingMakerInstrumentSettings = errors.New("missing maker instrument settings") + errInvalidSubAccountName = errors.New("invalid sub-account name") + errInvalidAPIKey = errors.New("invalid api key") + errInvalidAlgoID = errors.New("invalid algo id") + errInvalidMarginTypeAdjust = errors.New("invalid margin type adjust, only 'add' and 'reduce' are allowed") + errInvalidAlgoOrderType = errors.New("invalid algo order type") + errEmptyArgument = errors.New("empty argument") + errInvalidIPAddress = errors.New("invalid ip address") + errInvalidAPIKeyPermission = errors.New("invalid API Key permission") + errInvalidResponseParam = errors.New("invalid response parameter, response must be non-nil pointer") + errEmptyPlaceOrderResponse = errors.New("empty place order response") + errTooManyArgument = errors.New("too many cancel request params") + errIncompleteCurrencyPair = errors.New("incomplete currency pair") + errInvalidDuration = errors.New("invalid grid contract duration, only '7D', '30D', and '180D' are allowed") + errInvalidProtocolType = errors.New("invalid protocol type, only 'staking' and 'defi' allowed") + errExceedLimit = errors.New("limit exceeded") + errOnlyThreeMonthsSupported = errors.New("only three months of trade data retrieval supported") + errNoInstrumentFound = errors.New("no instrument found") ) /************************************ MarketData Endpoints *************************************************/ @@ -481,7 +481,7 @@ func (ok *Okx) CancelSingleOrder(ctx context.Context, arg CancelOrderRequestPara if arg.InstrumentID == "" { return nil, errMissingInstrumentID } - if arg.OrderID == "" && arg.ClientSupplierOrderID == "" { + if arg.OrderID == "" && arg.ClientOrderID == "" { return nil, fmt.Errorf("either order id or client supplier id is required") } var resp []OrderData @@ -506,7 +506,7 @@ func (ok *Okx) CancelMultipleOrders(ctx context.Context, args []CancelOrderReque if arg.InstrumentID == "" { return nil, errMissingInstrumentID } - if arg.OrderID == "" && arg.ClientSupplierOrderID == "" { + if arg.OrderID == "" && arg.ClientOrderID == "" { return nil, fmt.Errorf("either order id or client supplier id is required") } } @@ -533,7 +533,7 @@ func (ok *Okx) AmendOrder(ctx context.Context, arg *AmendOrderRequestParams) (*O if arg.InstrumentID == "" { return nil, errMissingInstrumentID } - if arg.ClientSuppliedOrderID == "" && arg.OrderID == "" { + if arg.ClientOrderID == "" && arg.OrderID == "" { return nil, errMissingClientOrderIDOrOrderID } if arg.NewQuantity < 0 && arg.NewPrice < 0 { @@ -556,7 +556,7 @@ func (ok *Okx) AmendMultipleOrders(ctx context.Context, args []AmendOrderRequest if args[x].InstrumentID == "" { return nil, errMissingInstrumentID } - if args[x].ClientSuppliedOrderID == "" && args[x].OrderID == "" { + if args[x].ClientOrderID == "" && args[x].OrderID == "" { return nil, errMissingClientOrderIDOrOrderID } if args[x].NewQuantity < 0 && args[x].NewPrice < 0 { @@ -599,12 +599,12 @@ func (ok *Okx) GetOrderDetail(ctx context.Context, arg *OrderDetailRequestParam) } params.Set("instId", arg.InstrumentID) switch { - case arg.OrderID == "" && arg.ClientSupplierOrderID == "": + case arg.OrderID == "" && arg.ClientOrderID == "": return nil, errMissingClientOrderIDOrOrderID - case arg.ClientSupplierOrderID == "": + case arg.ClientOrderID == "": params.Set("ordId", arg.OrderID) default: - params.Set("clOrdId", arg.ClientSupplierOrderID) + params.Set("clOrdId", arg.ClientOrderID) } var resp []OrderDetail err := ok.SendHTTPRequest(ctx, exchange.RestSpot, getOrderDetEPL, http.MethodGet, common.EncodeURLValues(tradeOrder, params), nil, &resp, true) @@ -1084,8 +1084,8 @@ func (ok *Okx) CreateRFQ(ctx context.Context, arg CreateRFQInput) (*RFQResponse, // CancelRFQ Cancel an existing active RFQ that you has previously created. func (ok *Okx) CancelRFQ(ctx context.Context, arg CancelRFQRequestParam) (*CancelRFQResponse, error) { - if arg.RfqID == "" && arg.ClientSuppliedRFQID == "" { - return nil, errMissingRFQIDANDClientSuppliedRFQID + if arg.RfqID == "" && arg.ClientRFQID == "" { + return nil, errMissingRFQIDANDClientRFQID } var resp []CancelRFQResponse err := ok.SendHTTPRequest(ctx, exchange.RestSpot, cancelRfqEPL, http.MethodPost, rfqCancelRfq, &arg, &resp, true) @@ -1100,9 +1100,9 @@ func (ok *Okx) CancelRFQ(ctx context.Context, arg CancelRFQRequestParam) (*Cance // CancelMultipleRFQs cancel multiple active RFQs in a single batch. Maximum 100 RFQ orders can be canceled at a time. func (ok *Okx) CancelMultipleRFQs(ctx context.Context, arg CancelRFQRequestsParam) ([]CancelRFQResponse, error) { - if len(arg.RfqID) == 0 && len(arg.ClientSuppliedRFQID) == 0 { - return nil, errMissingRFQIDANDClientSuppliedRFQID - } else if len(arg.RfqID)+len(arg.ClientSuppliedRFQID) > 100 { + if len(arg.RfqID) == 0 && len(arg.ClientRFQID) == 0 { + return nil, errMissingRFQIDANDClientRFQID + } else if len(arg.RfqID)+len(arg.ClientRFQID) > 100 { return nil, errMaxRFQOrdersToCancel } var resp []CancelRFQResponse @@ -1225,8 +1225,8 @@ func (ok *Okx) CreateQuote(ctx context.Context, arg CreateQuoteParams) (*QuoteRe // rfqCancelQuote = "rfq/cancel-quote" func (ok *Okx) CancelQuote(ctx context.Context, arg CancelQuoteRequestParams) (*CancelQuoteResponse, error) { var resp []CancelQuoteResponse - if arg.ClientSuppliedQuoteID == "" && arg.QuoteID == "" { - return nil, errMissingQuoteIDOrClientSuppliedQuoteID + if arg.ClientQuoteID == "" && arg.QuoteID == "" { + return nil, errMissingQuoteIDOrClientQuoteID } err := ok.SendHTTPRequest(ctx, exchange.RestSpot, cancelQuoteEPL, http.MethodPost, rfqCancelQuote, &arg, &resp, true) if err != nil { @@ -1240,8 +1240,8 @@ func (ok *Okx) CancelQuote(ctx context.Context, arg CancelQuoteRequestParams) (* // CancelMultipleQuote cancel multiple active Quotes in a single batch. Maximum 100 quote orders can be canceled at a time. func (ok *Okx) CancelMultipleQuote(ctx context.Context, arg CancelQuotesRequestParams) ([]CancelQuoteResponse, error) { - if len(arg.QuoteIDs) == 0 && len(arg.ClientSuppliedQuoteIDs) == 0 { - return nil, errMissingEitherQuoteIDAOrClientSuppliedQuoteIDs + if len(arg.QuoteIDs) == 0 && len(arg.ClientQuoteIDs) == 0 { + return nil, errMissingEitherQuoteIDAOrClientQuoteIDs } var resp []CancelQuoteResponse return resp, ok.SendHTTPRequest(ctx, exchange.RestSpot, cancelMultipleQuotesEPL, http.MethodPost, rfqCancelBatchQuotes, &arg, &resp, true) @@ -1269,8 +1269,8 @@ func (ok *Okx) GetRfqs(ctx context.Context, arg *RfqRequestParams) ([]RFQRespons if arg.RfqID != "" { params.Set("rfqId", arg.RfqID) } - if arg.ClientSuppliedRfqID != "" { - params.Set("clRfqId", arg.ClientSuppliedRfqID) + if arg.ClientRfqID != "" { + params.Set("clRfqId", arg.ClientRfqID) } if arg.State != "" { params.Set("state", strings.ToLower(arg.State)) @@ -1297,14 +1297,14 @@ func (ok *Okx) GetQuotes(ctx context.Context, arg *QuoteRequestParams) ([]QuoteR if arg.RfqID != "" { params.Set("rfqId", arg.RfqID) } - if arg.ClientSuppliedRfqID != "" { - params.Set("clRfqId", arg.ClientSuppliedRfqID) + if arg.ClientRfqID != "" { + params.Set("clRfqId", arg.ClientRfqID) } if arg.QuoteID != "" { params.Set("quoteId", arg.QuoteID) } - if arg.ClientSuppliedQuoteID != "" { - params.Set("clQuoteId", arg.ClientSuppliedQuoteID) + if arg.ClientQuoteID != "" { + params.Set("clQuoteId", arg.ClientQuoteID) } if arg.State != "" { params.Set("state", strings.ToLower(arg.State)) @@ -1331,14 +1331,14 @@ func (ok *Okx) GetRFQTrades(ctx context.Context, arg *RFQTradesRequestParams) ([ if arg.RfqID != "" { params.Set("rfqId", arg.RfqID) } - if arg.ClientSuppliedRfqID != "" { - params.Set("clRfqId", arg.ClientSuppliedRfqID) + if arg.ClientRfqID != "" { + params.Set("clRfqId", arg.ClientRfqID) } if arg.QuoteID != "" { params.Set("quoteId", arg.QuoteID) } - if arg.ClientSuppliedQuoteID != "" { - params.Set("clQuoteId", arg.ClientSuppliedQuoteID) + if arg.ClientQuoteID != "" { + params.Set("clQuoteId", arg.ClientQuoteID) } if arg.State != "" { params.Set("state", strings.ToLower(arg.State)) diff --git a/exchanges/okx/okx_test.go b/exchanges/okx/okx_test.go index ff2d1d57653..9490dc95029 100644 --- a/exchanges/okx/okx_test.go +++ b/exchanges/okx/okx_test.go @@ -797,11 +797,11 @@ func TestCancelRFQ(t *testing.T) { sharedtestvalues.SkipTestIfCredentialsUnset(t, ok, canManipulateRealOrders) _, err := ok.CancelRFQ(context.Background(), CancelRFQRequestParam{}) - if err != nil && !errors.Is(err, errMissingRFQIDANDClientSuppliedRFQID) { - t.Errorf("Okx CancelRFQ() expecting %v, but found %v", errMissingRFQIDANDClientSuppliedRFQID, err) + if err != nil && !errors.Is(err, errMissingRFQIDANDClientRFQID) { + t.Errorf("Okx CancelRFQ() expecting %v, but found %v", errMissingRFQIDANDClientRFQID, err) } _, err = ok.CancelRFQ(context.Background(), CancelRFQRequestParam{ - ClientSuppliedRFQID: "somersdjskfjsdkfjxvxv", + ClientRFQID: "somersdjskfjsdkfjxvxv", }) if err != nil { t.Error("Okx CancelRFQ() error", err) @@ -813,11 +813,11 @@ func TestMultipleCancelRFQ(t *testing.T) { sharedtestvalues.SkipTestIfCredentialsUnset(t, ok, canManipulateRealOrders) _, err := ok.CancelMultipleRFQs(context.Background(), CancelRFQRequestsParam{}) - if err != nil && !errors.Is(err, errMissingRFQIDANDClientSuppliedRFQID) { - t.Errorf("Okx CancelMultipleRFQs() expecting %v, but found %v", errMissingRFQIDANDClientSuppliedRFQID, err) + if err != nil && !errors.Is(err, errMissingRFQIDANDClientRFQID) { + t.Errorf("Okx CancelMultipleRFQs() expecting %v, but found %v", errMissingRFQIDANDClientRFQID, err) } _, err = ok.CancelMultipleRFQs(context.Background(), CancelRFQRequestsParam{ - ClientSuppliedRFQID: []string{"somersdjskfjsdkfjxvxv"}, + ClientRFQID: []string{"somersdjskfjsdkfjxvxv"}, }) if err != nil { t.Error("Okx CancelMultipleRFQs() error", err) @@ -913,7 +913,7 @@ func TestCancelQuote(t *testing.T) { t.Parallel() sharedtestvalues.SkipTestIfCredentialsUnset(t, ok, canManipulateRealOrders) - if _, err := ok.CancelQuote(context.Background(), CancelQuoteRequestParams{}); err != nil && !errors.Is(err, errMissingQuoteIDOrClientSuppliedQuoteID) { + if _, err := ok.CancelQuote(context.Background(), CancelQuoteRequestParams{}); err != nil && !errors.Is(err, errMissingQuoteIDOrClientQuoteID) { t.Error("Okx CancelQuote() error", err) } if _, err := ok.CancelQuote(context.Background(), CancelQuoteRequestParams{ @@ -922,7 +922,7 @@ func TestCancelQuote(t *testing.T) { t.Error("Okx CancelQuote() error", err) } if _, err := ok.CancelQuote(context.Background(), CancelQuoteRequestParams{ - ClientSuppliedQuoteID: "1234", + ClientQuoteID: "1234", }); err != nil { t.Error("Okx CancelQuote() error", err) } @@ -932,7 +932,7 @@ func TestCancelMultipleQuote(t *testing.T) { t.Parallel() sharedtestvalues.SkipTestIfCredentialsUnset(t, ok, canManipulateRealOrders) - if _, err := ok.CancelMultipleQuote(context.Background(), CancelQuotesRequestParams{}); err != nil && !errors.Is(errMissingEitherQuoteIDAOrClientSuppliedQuoteIDs, err) { + if _, err := ok.CancelMultipleQuote(context.Background(), CancelQuotesRequestParams{}); err != nil && !errors.Is(errMissingEitherQuoteIDAOrClientQuoteIDs, err) { t.Error("Okx CancelQuote() error", err) } if _, err := ok.CancelMultipleQuote(context.Background(), CancelQuotesRequestParams{ diff --git a/exchanges/okx/okx_types.go b/exchanges/okx/okx_types.go index 263abfa0ee8..c61c0f9bd4d 100644 --- a/exchanges/okx/okx_types.go +++ b/exchanges/okx/okx_types.go @@ -585,19 +585,19 @@ type CurrencyTakerFlow struct { // PlaceOrderRequestParam requesting parameter for placing an order. type PlaceOrderRequestParam struct { - AssetType asset.Item `json:"-"` - InstrumentID string `json:"instId"` - TradeMode string `json:"tdMode,omitempty"` // cash isolated - ClientSupplierOrderID string `json:"clOrdId,omitempty"` - Currency string `json:"ccy,omitempty"` // Only applicable to cross MARGIN orders in Single-currency margin. - OrderTag string `json:"tag,omitempty"` - Side string `json:"side,omitempty"` - PositionSide string `json:"posSide,omitempty"` - OrderType string `json:"ordType,omitempty"` - Amount float64 `json:"sz,string,omitempty"` - Price float64 `json:"px,string,omitempty"` - ReduceOnly bool `json:"reduceOnly,string,omitempty"` - QuantityType string `json:"tgtCcy,omitempty"` // values base_ccy and quote_ccy + AssetType asset.Item `json:"-"` + InstrumentID string `json:"instId"` + TradeMode string `json:"tdMode,omitempty"` // cash isolated + ClientOrderID string `json:"clOrdId,omitempty"` + Currency string `json:"ccy,omitempty"` // Only applicable to cross MARGIN orders in Single-currency margin. + OrderTag string `json:"tag,omitempty"` + Side string `json:"side,omitempty"` + PositionSide string `json:"posSide,omitempty"` + OrderType string `json:"ordType,omitempty"` + Amount float64 `json:"sz,string,omitempty"` + Price float64 `json:"px,string,omitempty"` + ReduceOnly bool `json:"reduceOnly,string,omitempty"` + QuantityType string `json:"tgtCcy,omitempty"` // values base_ccy and quote_ccy // Added in the websocket requests BanAmend bool `json:"banAmend,omitempty"` // Whether the SPOT Market Order size can be amended by the system. ExpiryTime okxUnixMilliTime `json:"expTime,omitempty"` @@ -605,30 +605,30 @@ type PlaceOrderRequestParam struct { // OrderData response message for place, cancel, and amend an order requests. type OrderData struct { - OrderID string `json:"ordId,omitempty"` - RequestID string `json:"reqId,omitempty"` - ClientSupplierOrderID string `json:"clOrdId,omitempty"` - Tag string `json:"tag,omitempty"` - SCode string `json:"sCode,omitempty"` - SMessage string `json:"sMsg,omitempty"` + OrderID string `json:"ordId,omitempty"` + RequestID string `json:"reqId,omitempty"` + ClientOrderID string `json:"clOrdId,omitempty"` + Tag string `json:"tag,omitempty"` + SCode string `json:"sCode,omitempty"` + SMessage string `json:"sMsg,omitempty"` } // CancelOrderRequestParam represents order parameters to cancel an order. type CancelOrderRequestParam struct { - InstrumentID string `json:"instId"` - OrderID string `json:"ordId"` - ClientSupplierOrderID string `json:"clOrdId,omitempty"` + InstrumentID string `json:"instId"` + OrderID string `json:"ordId"` + ClientOrderID string `json:"clOrdId,omitempty"` } // AmendOrderRequestParams represents amend order requesting parameters. type AmendOrderRequestParams struct { - InstrumentID string `json:"instId"` - CancelOnFail bool `json:"cxlOnFail,omitempty"` - OrderID string `json:"ordId,omitempty"` - ClientSuppliedOrderID string `json:"clOrdId,omitempty"` - ClientSuppliedRequestID string `json:"reqId,omitempty"` - NewQuantity float64 `json:"newSz,string,omitempty"` - NewPrice float64 `json:"newPx,string,omitempty"` + InstrumentID string `json:"instId"` + CancelOnFail bool `json:"cxlOnFail,omitempty"` + OrderID string `json:"ordId,omitempty"` + ClientOrderID string `json:"clOrdId,omitempty"` + ClientRequestID string `json:"reqId,omitempty"` + NewQuantity float64 `json:"newSz,string,omitempty"` + NewPrice float64 `json:"newPx,string,omitempty"` } // ClosePositionsRequestParams input parameters for close position endpoints @@ -638,7 +638,7 @@ type ClosePositionsRequestParams struct { MarginMode string `json:"mgnMode"` // cross or isolated Currency string `json:"ccy"` AutomaticallyCanceled bool `json:"autoCxl"` - ClientSuppliedID string `json:"clOrdId,omitempty"` + ClientID string `json:"clOrdId,omitempty"` Tag string `json:"tag,omitempty"` } @@ -650,9 +650,9 @@ type ClosePositionResponse struct { // OrderDetailRequestParam payload data to request order detail type OrderDetailRequestParam struct { - InstrumentID string `json:"instId"` - OrderID string `json:"ordId"` - ClientSupplierOrderID string `json:"clOrdId"` + InstrumentID string `json:"instId"` + OrderID string `json:"ordId"` + ClientOrderID string `json:"clOrdId"` } // OrderDetail returns a order detail information @@ -661,7 +661,7 @@ type OrderDetail struct { InstrumentID string `json:"instId"` Currency string `json:"ccy"` OrderID string `json:"ordId"` - ClientSupplierOrderID string `json:"clOrdId"` + ClientOrderID string `json:"clOrdId"` Tag string `json:"tag"` ProfitAndLoss string `json:"pnl"` OrderType string `json:"ordType"` @@ -722,7 +722,7 @@ type PendingOrderItem struct { CreationTime time.Time `json:"cTime"` Category string `json:"category"` Currency string `json:"ccy"` - ClientSupplierOrderID string `json:"clOrdId"` + ClientOrderID string `json:"clOrdId"` TransactionFee string `json:"fee"` FeeCurrency string `json:"feeCcy"` LastFilledPrice string `json:"fillPx"` @@ -771,21 +771,21 @@ type TransactionDetailRequestParams struct { // TransactionDetail holds ecently-filled transaction detail data. type TransactionDetail struct { - InstrumentType string `json:"instType"` - InstrumentID string `json:"instId"` - TradeID string `json:"tradeId"` - OrderID string `json:"ordId"` - ClientSuppliedOrderID string `json:"clOrdId"` - BillID string `json:"billId"` - Tag string `json:"tag"` - FillPrice float64 `json:"fillPx,string"` - FillSize float64 `json:"fillSz,string"` - Side string `json:"side"` - PositionSide string `json:"posSide"` - ExecType string `json:"execType"` - FeeCurrency string `json:"feeCcy"` - Fee string `json:"fee"` - Timestamp okxUnixMilliTime `json:"ts"` + InstrumentType string `json:"instType"` + InstrumentID string `json:"instId"` + TradeID string `json:"tradeId"` + OrderID string `json:"ordId"` + ClientOrderID string `json:"clOrdId"` + BillID string `json:"billId"` + Tag string `json:"tag"` + FillPrice float64 `json:"fillPx,string"` + FillSize float64 `json:"fillSz,string"` + Side string `json:"side"` + PositionSide string `json:"posSide"` + ExecType string `json:"execType"` + FeeCurrency string `json:"feeCcy"` + Fee string `json:"fee"` + Timestamp okxUnixMilliTime `json:"ts"` } // AlgoOrderParams holds algo order information. @@ -1020,7 +1020,7 @@ type WithdrawalInput struct { Currency string `json:"ccy"` ChainName string `json:"chain"` ToAddress string `json:"toAddr"` - ClientSuppliedID string `json:"clientId"` + ClientID string `json:"clientId"` } // WithdrawalResponse cryptocurrency withdrawal response @@ -1164,47 +1164,47 @@ type EstimateQuoteRequestInput struct { // EstimateQuoteResponse represents estimate quote response data. type EstimateQuoteResponse struct { - BaseCurrency string `json:"baseCcy"` - BaseSize string `json:"baseSz"` - ClientSupplierRequestID string `json:"clQReqId"` - ConvertPrice string `json:"cnvtPx"` - OrigRfqSize string `json:"origRfqSz"` - QuoteCurrency string `json:"quoteCcy"` - QuoteID string `json:"quoteId"` - QuoteSize string `json:"quoteSz"` - QuoteTime okxUnixMilliTime `json:"quoteTime"` - RFQSize string `json:"rfqSz"` - RFQSizeCurrency string `json:"rfqSzCcy"` - Side string `json:"side"` - TTLMs string `json:"ttlMs"` // Validity period of quotation in milliseconds + BaseCurrency string `json:"baseCcy"` + BaseSize string `json:"baseSz"` + ClientRequestID string `json:"clQReqId"` + ConvertPrice string `json:"cnvtPx"` + OrigRfqSize string `json:"origRfqSz"` + QuoteCurrency string `json:"quoteCcy"` + QuoteID string `json:"quoteId"` + QuoteSize string `json:"quoteSz"` + QuoteTime okxUnixMilliTime `json:"quoteTime"` + RFQSize string `json:"rfqSz"` + RFQSizeCurrency string `json:"rfqSzCcy"` + Side string `json:"side"` + TTLMs string `json:"ttlMs"` // Validity period of quotation in milliseconds } // ConvertTradeInput represents convert trade request input type ConvertTradeInput struct { - BaseCurrency string `json:"baseCcy"` - QuoteCurrency string `json:"quoteCcy"` - Side string `json:"side"` - Size float64 `json:"sz,string"` - SizeCurrency string `json:"szCcy"` - QuoteID string `json:"quoteId"` - ClientSupplierOrderID string `json:"clTReqId"` - Tag string `json:"tag"` + BaseCurrency string `json:"baseCcy"` + QuoteCurrency string `json:"quoteCcy"` + Side string `json:"side"` + Size float64 `json:"sz,string"` + SizeCurrency string `json:"szCcy"` + QuoteID string `json:"quoteId"` + ClientOrderID string `json:"clTReqId"` + Tag string `json:"tag"` } // ConvertTradeResponse represents convert trade response type ConvertTradeResponse struct { - BaseCurrency string `json:"baseCcy"` - ClientSupplierOrderID string `json:"clTReqId"` - FillBaseSize float64 `json:"fillBaseSz,string"` - FillPrice string `json:"fillPx"` - FillQuoteSize float64 `json:"fillQuoteSz,string"` - InstrumentID string `json:"instId"` - QuoteCurrency string `json:"quoteCcy"` - QuoteID string `json:"quoteId"` - Side string `json:"side"` - State string `json:"state"` - TradeID string `json:"tradeId"` - Timestamp okxUnixMilliTime `json:"ts"` + BaseCurrency string `json:"baseCcy"` + ClientOrderID string `json:"clTReqId"` + FillBaseSize float64 `json:"fillBaseSz,string"` + FillPrice string `json:"fillPx"` + FillQuoteSize float64 `json:"fillQuoteSz,string"` + InstrumentID string `json:"instId"` + QuoteCurrency string `json:"quoteCcy"` + QuoteID string `json:"quoteId"` + Side string `json:"side"` + State string `json:"state"` + TradeID string `json:"tradeId"` + Timestamp okxUnixMilliTime `json:"ts"` } // ConvertHistory holds convert trade history response @@ -1670,30 +1670,30 @@ type RFQOrderLeg struct { // CreateRFQInput RFQ create method input. type CreateRFQInput struct { - Anonymous bool `json:"anonymous"` - CounterParties []string `json:"counterparties"` - ClientSuppliedRFQID string `json:"clRfqId"` - Legs []RFQOrderLeg `json:"legs"` + Anonymous bool `json:"anonymous"` + CounterParties []string `json:"counterparties"` + ClientRFQID string `json:"clRfqId"` + Legs []RFQOrderLeg `json:"legs"` } // CancelRFQRequestParam represents cancel RFQ order request params type CancelRFQRequestParam struct { - RfqID string `json:"rfqId"` - ClientSuppliedRFQID string `json:"clRfqId"` + RfqID string `json:"rfqId"` + ClientRFQID string `json:"clRfqId"` } // CancelRFQRequestsParam represents cancel multiple RFQ orders request params type CancelRFQRequestsParam struct { - RfqID []string `json:"rfqIds"` - ClientSuppliedRFQID []string `json:"clRfqIds"` + RfqID []string `json:"rfqIds"` + ClientRFQID []string `json:"clRfqIds"` } // CancelRFQResponse represents cancel RFQ orders response type CancelRFQResponse struct { - RfqID string `json:"rfqId"` - ClientSuppliedRfqID string `json:"clRfqId"` - StatusCode string `json:"sCode"` - StatusMsg string `json:"sMsg"` + RfqID string `json:"rfqId"` + ClientRfqID string `json:"clRfqId"` + StatusCode string `json:"sCode"` + StatusMsg string `json:"sMsg"` } // TimestampResponse holds timestamp response only. @@ -1709,15 +1709,15 @@ type ExecuteQuoteParams struct { // ExecuteQuoteResponse represents execute quote response. type ExecuteQuoteResponse struct { - BlockTradedID string `json:"blockTdId"` - RfqID string `json:"rfqId"` - ClientSuppliedRfqID string `json:"clRfqId"` - QuoteID string `json:"quoteId"` - ClientSuppliedQuoteID string `json:"clQuoteId"` - TraderCode string `json:"tTraderCode"` - MakerTraderCode string `json:"mTraderCode"` - CreationTime okxUnixMilliTime `json:"cTime"` - Legs []OrderLeg `json:"legs"` + BlockTradedID string `json:"blockTdId"` + RfqID string `json:"rfqId"` + ClientRfqID string `json:"clRfqId"` + QuoteID string `json:"quoteId"` + ClientQuoteID string `json:"clQuoteId"` + TraderCode string `json:"tTraderCode"` + MakerTraderCode string `json:"mTraderCode"` + CreationTime okxUnixMilliTime `json:"cTime"` + Legs []OrderLeg `json:"legs"` } // OrderLeg represents legs information for both websocket and REST available Quote information. @@ -1736,10 +1736,10 @@ type OrderLeg struct { // CreateQuoteParams holds information related to create quote. type CreateQuoteParams struct { - RfqID string `json:"rfqId"` - ClientSuppliedQuoteID string `json:"clQuoteId"` - QuoteSide order.Side `json:"quoteSide"` - Legs []QuoteLeg `json:"legs"` + RfqID string `json:"rfqId"` + ClientQuoteID string `json:"clQuoteId"` + QuoteSide order.Side `json:"quoteSide"` + Legs []QuoteLeg `json:"legs"` } // QuoteLeg the legs of the Quote. @@ -1755,60 +1755,60 @@ type QuoteLeg struct { // QuoteResponse holds create quote response variables. type QuoteResponse struct { - CreationTime okxUnixMilliTime `json:"cTime"` - UpdateTime okxUnixMilliTime `json:"uTime"` - ValidUntil okxUnixMilliTime `json:"validUntil"` - QuoteID string `json:"quoteId"` - ClientSuppliedQuoteID string `json:"clQuoteId"` - RfqID string `json:"rfqId"` - QuoteSide string `json:"quoteSide"` - ClientSuppliedRfqID string `json:"clRfqId"` - TraderCode string `json:"traderCode"` - State string `json:"state"` - Legs []QuoteLeg `json:"legs"` + CreationTime okxUnixMilliTime `json:"cTime"` + UpdateTime okxUnixMilliTime `json:"uTime"` + ValidUntil okxUnixMilliTime `json:"validUntil"` + QuoteID string `json:"quoteId"` + ClientQuoteID string `json:"clQuoteId"` + RfqID string `json:"rfqId"` + QuoteSide string `json:"quoteSide"` + ClientRfqID string `json:"clRfqId"` + TraderCode string `json:"traderCode"` + State string `json:"state"` + Legs []QuoteLeg `json:"legs"` } // CancelQuoteRequestParams represents cancel quote request params type CancelQuoteRequestParams struct { - QuoteID string `json:"quoteId"` - ClientSuppliedQuoteID string `json:"clQuoteId"` + QuoteID string `json:"quoteId"` + ClientQuoteID string `json:"clQuoteId"` } // CancelQuotesRequestParams represents cancel multiple quotes request params type CancelQuotesRequestParams struct { - QuoteIDs []string `json:"quoteIds,omitempty"` - ClientSuppliedQuoteIDs []string `json:"clQuoteIds,omitempty"` + QuoteIDs []string `json:"quoteIds,omitempty"` + ClientQuoteIDs []string `json:"clQuoteIds,omitempty"` } // CancelQuoteResponse represents cancel quote response type CancelQuoteResponse struct { - QuoteID string `json:"quoteId"` - ClientSuppliedQuoteID string `json:"clQuoteId"` - SCode string `json:"sCode"` - SMsg string `json:"sMsg"` + QuoteID string `json:"quoteId"` + ClientQuoteID string `json:"clQuoteId"` + SCode string `json:"sCode"` + SMsg string `json:"sMsg"` } // RfqRequestParams represents get RFQ orders param type RfqRequestParams struct { - RfqID string - ClientSuppliedRfqID string - State string - BeginningID string - EndID string - Limit int64 + RfqID string + ClientRfqID string + State string + BeginningID string + EndID string + Limit int64 } // RFQResponse RFQ response detail. type RFQResponse struct { - CreateTime okxUnixMilliTime `json:"cTime"` - UpdateTime okxUnixMilliTime `json:"uTime"` - ValidUntil okxUnixMilliTime `json:"validUntil"` - TraderCode string `json:"traderCode"` - RFQID string `json:"rfqId"` - ClientSuppliedRFQID string `json:"clRfqId"` - State string `json:"state"` - Counterparties []string `json:"counterparties"` - Legs []struct { + CreateTime okxUnixMilliTime `json:"cTime"` + UpdateTime okxUnixMilliTime `json:"uTime"` + ValidUntil okxUnixMilliTime `json:"validUntil"` + TraderCode string `json:"traderCode"` + RFQID string `json:"rfqId"` + ClientRFQID string `json:"clRfqId"` + State string `json:"state"` + Counterparties []string `json:"counterparties"` + Legs []struct { InstrumentID string `json:"instId"` Size string `json:"sz"` Side string `json:"side"` @@ -1818,40 +1818,40 @@ type RFQResponse struct { // QuoteRequestParams request params. type QuoteRequestParams struct { - RfqID string - ClientSuppliedRfqID string - QuoteID string - ClientSuppliedQuoteID string - State string - BeginID string - EndID string - Limit int64 + RfqID string + ClientRfqID string + QuoteID string + ClientQuoteID string + State string + BeginID string + EndID string + Limit int64 } // RFQTradesRequestParams represents RFQ trades request param type RFQTradesRequestParams struct { - RfqID string - ClientSuppliedRfqID string - QuoteID string - BlockTradeID string - ClientSuppliedQuoteID string - State string - BeginID string - EndID string - Limit int64 + RfqID string + ClientRfqID string + QuoteID string + BlockTradeID string + ClientQuoteID string + State string + BeginID string + EndID string + Limit int64 } // RfqTradeResponse RFQ trade response type RfqTradeResponse struct { - RfqID string `json:"rfqId"` - ClientSuppliedRfqID string `json:"clRfqId"` - QuoteID string `json:"quoteId"` - ClientSuppliedQuoteID string `json:"clQuoteId"` - BlockTradeID string `json:"blockTdId"` - Legs []RFQTradeLeg `json:"legs"` - CreationTime time.Time `json:"cTime"` - TakerTraderCode string `json:"tTraderCode"` - MakerTraderCode string `json:"mTraderCode"` + RfqID string `json:"rfqId"` + ClientRfqID string `json:"clRfqId"` + QuoteID string `json:"quoteId"` + ClientQuoteID string `json:"clQuoteId"` + BlockTradeID string `json:"blockTdId"` + Legs []RFQTradeLeg `json:"legs"` + CreationTime time.Time `json:"cTime"` + TakerTraderCode string `json:"tTraderCode"` + MakerTraderCode string `json:"mTraderCode"` } // RFQTradeLeg RFQ trade response leg. @@ -2256,20 +2256,20 @@ type WSMarketDataResponse struct { // WSPlaceOrderData holds websocket order information. type WSPlaceOrderData struct { - ClientSuppliedOrderID string `json:"clOrdId,omitempty"` - Currency string `json:"ccy,omitempty"` - Tag string `json:"tag,omitempty"` - PositionSide string `json:"posSide,omitempty"` - ExpiryTime int64 `json:"expTime,string,omitempty"` - BanAmend bool `json:"banAmend,omitempty"` - Side string `json:"side"` - InstrumentID string `json:"instId"` - TradeMode string `json:"tdMode"` - OrderType string `json:"ordType"` - Size float64 `json:"sz"` - Price float64 `json:"px,string,omitempty"` - ReduceOnly bool `json:"reduceOnly,string,omitempty"` - TargetCurrency string `json:"tgtCurrency,omitempty"` + ClientOrderID string `json:"clOrdId,omitempty"` + Currency string `json:"ccy,omitempty"` + Tag string `json:"tag,omitempty"` + PositionSide string `json:"posSide,omitempty"` + ExpiryTime int64 `json:"expTime,string,omitempty"` + BanAmend bool `json:"banAmend,omitempty"` + Side string `json:"side"` + InstrumentID string `json:"instId"` + TradeMode string `json:"tdMode"` + OrderType string `json:"ordType"` + Size float64 `json:"sz"` + Price float64 `json:"px,string,omitempty"` + ReduceOnly bool `json:"reduceOnly,string,omitempty"` + TargetCurrency string `json:"tgtCurrency,omitempty"` } // WSPlaceOrder holds the websocket place order input data. @@ -2630,15 +2630,15 @@ type WsRFQ struct { // WsRfqData represents rfq order response data streamed through the websocket channel type WsRfqData struct { - CreationTime time.Time `json:"cTime"` - UpdateTime time.Time `json:"uTime"` - TraderCode string `json:"traderCode"` - RfqID string `json:"rfqId"` - ClientSuppliedRfqID string `json:"clRfqId"` - State string `json:"state"` - ValidUntil string `json:"validUntil"` - Counterparties []string `json:"counterparties"` - Legs []RFQOrderLeg `json:"legs"` + CreationTime time.Time `json:"cTime"` + UpdateTime time.Time `json:"uTime"` + TraderCode string `json:"traderCode"` + RfqID string `json:"rfqId"` + ClientRfqID string `json:"clRfqId"` + State string `json:"state"` + ValidUntil string `json:"validUntil"` + Counterparties []string `json:"counterparties"` + Legs []RFQOrderLeg `json:"legs"` } // WsQuote represents websocket push data for "quotes" subscription @@ -2649,16 +2649,16 @@ type WsQuote struct { // WsQuoteData represents a single quote order information type WsQuoteData struct { - ValidUntil okxUnixMilliTime `json:"validUntil"` - UpdatedTime okxUnixMilliTime `json:"uTime"` - CreationTime okxUnixMilliTime `json:"cTime"` - Legs []OrderLeg `json:"legs"` - QuoteID string `json:"quoteId"` - RfqID string `json:"rfqId"` - TraderCode string `json:"traderCode"` - QuoteSide string `json:"quoteSide"` - State string `json:"state"` - ClientSuppliedQuoteID string `json:"clQuoteId"` + ValidUntil okxUnixMilliTime `json:"validUntil"` + UpdatedTime okxUnixMilliTime `json:"uTime"` + CreationTime okxUnixMilliTime `json:"cTime"` + Legs []OrderLeg `json:"legs"` + QuoteID string `json:"quoteId"` + RfqID string `json:"rfqId"` + TraderCode string `json:"traderCode"` + QuoteSide string `json:"quoteSide"` + State string `json:"state"` + ClientQuoteID string `json:"clQuoteId"` } // WsStructureBlocTrade represents websocket push data for "struc-block-trades" subscription @@ -2669,15 +2669,15 @@ type WsStructureBlocTrade struct { // WsBlockTradeResponse represents a structure block order information type WsBlockTradeResponse struct { - CreationTime okxUnixMilliTime `json:"cTime"` - RfqID string `json:"rfqId"` - ClientSuppliedRfqID string `json:"clRfqId"` - QuoteID string `json:"quoteId"` - ClientSuppliedQuoteID string `json:"clQuoteId"` - BlockTradeID string `json:"blockTdId"` - TakerTraderCode string `json:"tTraderCode"` - MakerTraderCode string `json:"mTraderCode"` - Legs []OrderLeg `json:"legs"` + CreationTime okxUnixMilliTime `json:"cTime"` + RfqID string `json:"rfqId"` + ClientRfqID string `json:"clRfqId"` + QuoteID string `json:"quoteId"` + ClientQuoteID string `json:"clQuoteId"` + BlockTradeID string `json:"blockTdId"` + TakerTraderCode string `json:"tTraderCode"` + MakerTraderCode string `json:"mTraderCode"` + Legs []OrderLeg `json:"legs"` } // WsSpotGridAlgoOrder represents websocket push data for "struc-block-trades" subscription diff --git a/exchanges/okx/okx_websocket.go b/exchanges/okx/okx_websocket.go index 9cb6aac2857..32b5d5f9e82 100644 --- a/exchanges/okx/okx_websocket.go +++ b/exchanges/okx/okx_websocket.go @@ -1403,7 +1403,7 @@ func (ok *Okx) WsCancelOrder(arg CancelOrderRequestParam) (*OrderData, error) { if arg.InstrumentID == "" { return nil, errMissingInstrumentID } - if arg.OrderID == "" && arg.ClientSupplierOrderID == "" { + if arg.OrderID == "" && arg.ClientOrderID == "" { return nil, fmt.Errorf("either order id or client supplier id is required") } randomID, err := common.GenerateRandomString(4, common.NumberCharacters) @@ -1462,7 +1462,7 @@ func (ok *Okx) WsCancelMultipleOrder(args []CancelOrderRequestParam) ([]OrderDat if arg.InstrumentID == "" { return nil, errMissingInstrumentID } - if arg.OrderID == "" && arg.ClientSupplierOrderID == "" { + if arg.OrderID == "" && arg.ClientOrderID == "" { return nil, fmt.Errorf("either order id or client supplier id is required") } } @@ -1536,7 +1536,7 @@ func (ok *Okx) WsAmendOrder(arg *AmendOrderRequestParams) (*OrderData, error) { if arg.InstrumentID == "" { return nil, errMissingInstrumentID } - if arg.ClientSuppliedOrderID == "" && arg.OrderID == "" { + if arg.ClientOrderID == "" && arg.OrderID == "" { return nil, errMissingClientOrderIDOrOrderID } if arg.NewQuantity <= 0 && arg.NewPrice <= 0 { @@ -1597,7 +1597,7 @@ func (ok *Okx) WsAmendMultipleOrders(args []AmendOrderRequestParams) ([]OrderDat if args[x].InstrumentID == "" { return nil, errMissingInstrumentID } - if args[x].ClientSuppliedOrderID == "" && args[x].OrderID == "" { + if args[x].ClientOrderID == "" && args[x].OrderID == "" { return nil, errMissingClientOrderIDOrOrderID } if args[x].NewQuantity <= 0 && args[x].NewPrice <= 0 { diff --git a/exchanges/okx/okx_wrapper.go b/exchanges/okx/okx_wrapper.go index b1caeacb2fc..2a139d71ced 100644 --- a/exchanges/okx/okx_wrapper.go +++ b/exchanges/okx/okx_wrapper.go @@ -805,14 +805,14 @@ func (ok *Okx) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitR } var orderRequest = &PlaceOrderRequestParam{ - InstrumentID: instrumentID, - TradeMode: tradeMode, - Side: sideType, - OrderType: s.Type.Lower(), - Amount: amount, - ClientSupplierOrderID: s.ClientOrderID, - Price: s.Price, - QuantityType: targetCurrency, + InstrumentID: instrumentID, + TradeMode: tradeMode, + Side: sideType, + OrderType: s.Type.Lower(), + Amount: amount, + ClientOrderID: s.ClientOrderID, + Price: s.Price, + QuantityType: targetCurrency, } switch s.Type.Lower() { case OkxOrderLimit, OkxOrderPostOnly, OkxOrderFOK, OkxOrderIOC: @@ -868,10 +868,10 @@ func (ok *Okx) ModifyOrder(ctx context.Context, action *order.Modify) (*order.Mo return nil, err } amendRequest := AmendOrderRequestParams{ - InstrumentID: instrumentID, - NewQuantity: action.Amount, - OrderID: action.OrderID, - ClientSuppliedOrderID: action.ClientOrderID, + InstrumentID: instrumentID, + NewQuantity: action.Amount, + OrderID: action.OrderID, + ClientOrderID: action.ClientOrderID, } if ok.Websocket.CanUseAuthenticatedWebsocketForWrapper() { _, err = ok.WsAmendOrder(&amendRequest) @@ -901,9 +901,9 @@ func (ok *Okx) CancelOrder(ctx context.Context, ord *order.Cancel) error { } instrumentID := format.Format(ord.Pair) req := CancelOrderRequestParam{ - InstrumentID: instrumentID, - OrderID: ord.OrderID, - ClientSupplierOrderID: ord.ClientOrderID, + InstrumentID: instrumentID, + OrderID: ord.OrderID, + ClientOrderID: ord.ClientOrderID, } if ok.Websocket.CanUseAuthenticatedWebsocketForWrapper() { _, err = ok.WsCancelOrder(req) @@ -946,9 +946,9 @@ func (ok *Okx) CancelBatchOrders(ctx context.Context, o []order.Cancel) (*order. return nil, err } cancelOrderParams[x] = CancelOrderRequestParam{ - InstrumentID: instrumentID, - OrderID: ord.OrderID, - ClientSupplierOrderID: ord.ClientOrderID, + InstrumentID: instrumentID, + OrderID: ord.OrderID, + ClientOrderID: ord.ClientOrderID, } } var canceledOrders []OrderData @@ -1014,25 +1014,25 @@ ordersLoop: switch { case orderCancellation.OrderID != "" || orderCancellation.ClientOrderID != "": if myOrders[x].OrderID == orderCancellation.OrderID || - myOrders[x].ClientSupplierOrderID == orderCancellation.ClientOrderID { + myOrders[x].ClientOrderID == orderCancellation.ClientOrderID { cancelAllOrdersRequestParams[x] = CancelOrderRequestParam{ - OrderID: myOrders[x].OrderID, - ClientSupplierOrderID: myOrders[x].ClientSupplierOrderID, + OrderID: myOrders[x].OrderID, + ClientOrderID: myOrders[x].ClientOrderID, } break ordersLoop } case orderCancellation.Side == order.Buy || orderCancellation.Side == order.Sell: if myOrders[x].Side == order.Buy || myOrders[x].Side == order.Sell { cancelAllOrdersRequestParams[x] = CancelOrderRequestParam{ - OrderID: myOrders[x].OrderID, - ClientSupplierOrderID: myOrders[x].ClientSupplierOrderID, + OrderID: myOrders[x].OrderID, + ClientOrderID: myOrders[x].ClientOrderID, } continue } default: cancelAllOrdersRequestParams[x] = CancelOrderRequestParam{ - OrderID: myOrders[x].OrderID, - ClientSupplierOrderID: myOrders[x].ClientSupplierOrderID, + OrderID: myOrders[x].OrderID, + ClientOrderID: myOrders[x].ClientOrderID, } } } @@ -1105,7 +1105,7 @@ func (ok *Okx) GetOrderInfo(ctx context.Context, orderID string, pair currency.P Amount: orderDetail.Size.Float64(), Exchange: ok.Name, OrderID: orderDetail.OrderID, - ClientOrderID: orderDetail.ClientSupplierOrderID, + ClientOrderID: orderDetail.ClientOrderID, Side: orderDetail.Side, Type: orderType, Pair: pair, @@ -1270,7 +1270,7 @@ allOrders: FeeAsset: currency.NewCode(orderList[i].FeeCurrency), Exchange: ok.Name, OrderID: orderList[i].OrderID, - ClientOrderID: orderList[i].ClientSupplierOrderID, + ClientOrderID: orderList[i].ClientOrderID, Type: oType, Side: orderSide, Status: orderStatus, @@ -1371,7 +1371,7 @@ allOrders: FeeAsset: currency.NewCode(orderList[i].FeeCurrency), Exchange: ok.Name, OrderID: orderList[i].OrderID, - ClientOrderID: orderList[i].ClientSupplierOrderID, + ClientOrderID: orderList[i].ClientOrderID, Type: oType, Side: orderSide, Status: orderStatus,