OKX has announced important updates to its fee rate system, which will directly impact API users. These changes are designed to streamline the fee structure and provide greater clarity for different contract types. A key part of this update involves modifications to the 'Get fee rates' interface, which is crucial for developers and automated trading systems.
This article breaks down the specific changes to the API endpoint, what they mean for your integration, and how to ensure a smooth transition. Understanding these updates is essential for maintaining accurate fee calculations and avoiding disruptions in your trading strategies.
Key Changes to the 'Get Fee Rates' Interface
Following a broader fee rate adjustment, OKX is making two significant changes to the 'Get fee rates' API endpoint. These modifications are scheduled to take effect and will influence how you retrieve and interpret fee data.
The primary goal is to align the interface with the new fee structure, where all currency pairs now fall under a single fee rate category. Furthermore, futures and perpetual contracts will now have distinct fee rates based on whether they are USDT-margined or crypto-margined.
Removal of the 'category' Field
The first major change is the removal of the 'category' field from the request parameters. It is important to note that this removal is backward-compatible. Your existing API calls will continue to function without any required code changes.
A request to the endpoint will return the same dataset whether you include the 'category' value or not. This is because the new system no longer requires category differentiation, as all currency pairs share the same fee category.
New Return Parameters: 'takerU' and 'makerU'
The second and more impactful change is the introduction of two new return parameters: takerU and makerU. These new fields are critical for accurately assessing fees.
- takerU: Represents the taker fee rate specifically for USDT-margined futures and perpetual contracts.
- makerU: Represents the maker fee rate specifically for USDT-margined futures and perpetual contracts.
With the addition of these parameters, the meaning of the original taker and maker fields has changed for futures and perpetual contracts. They now exclusively represent the fee rates for crypto-margined contracts.
This distinction is necessary to reflect the new fee structure where margin type (USDT vs. crypto) determines the rate.
Updated API Endpoint Specifications
The HTTP request path for the 'Get fee rates' endpoint remains unchanged, ensuring that existing integrations will not break. However, you must be aware of the adjustments to the parameters you send and receive.
Endpoint Name: Get fee rates
HTTP Request: GET /api/v5/account/trade-fee
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| instType | String | Yes | Instrument type. Valid values: SPOT, MARGIN, SWAP, FUTURES, OPTION. |
| instId | String | No | Instrument ID (e.g., BTC-USDT). Only applicable to SPOT and MARGIN. |
| uly | String | No | Underlying (e.g., BTC-USD). Only applicable to FUTURES, SWAP, and OPTION. |
| String | No | This field will be removed and can be omitted. |
Return Parameters
The response will include a richer set of data to accommodate the new fee tiers. Here is what you can expect to receive:
| Parameter | Type | Description |
|---|---|---|
| category | String | Fee schedule (category). |
| taker | String | Taker fee rate for crypto-margined futures and perpetual contracts. |
| maker | String | Maker fee rate for crypto-margined futures and perpetual contracts. |
| takerU | String | New: Taker fee rate for USDT-margined futures and perpetual contracts. |
| makerU | String | New: Maker fee rate for USDT-margined futures and perpetual contracts. |
| delivery | String | Delivery fee rate. |
| exercise | String | Fee rate for exercising an option. |
| level | String | Fee rate level for the account. |
| instType | String | Instrument type of the queried fee. |
| ts | String | Data return time, Unix timestamp format in milliseconds (e.g., 1597026383085). |
Impact and Recommendations for API Users
These changes are more than just technical adjustments; they have a direct effect on how your trading systems calculate costs. Incorrectly interpreting the taker/maker vs. takerU/makerU values could lead to significant miscalculations in trading strategy profitability, especially for futures and perpetual swap trading.
It is highly recommended that all developers and traders:
- Review their current integration code that calls the
GET /api/v5/account/trade-feeendpoint. - Update any logic that processes fee rates for futures (FUTURES) and perpetual swaps (SWAP) to correctly reference the new
takerUandmakerUparameters for USDT-margined contracts. - Ensure that the original
takerandmakerparameters are now only used for crypto-margined contracts. - Test the updated integration thoroughly in a simulated environment before deploying to live trading.
Staying on top of these API modifications is crucial for seamless operation. To ensure you are always working with the most current system specifications, review the latest API documentation.
Frequently Asked Questions
What is the main reason for this API change?
The changes align the 'Get fee rates' interface with OKX's updated fee rate system. The overhaul simplifies categories and introduces different rates for USDT-margined versus crypto-margined contracts, necessitating more detailed data responses.
Do I need to change my API code immediately?
Your existing calls will not break due to the removal of the 'category' field. However, to get accurate fee data for USDT-margined contracts, you must update your code to parse the new takerU and makerU response parameters. Failure to do so may result in using incorrect fee rates for your calculations.
How do I get the fee rate for a BTC-USDT perpetual swap now?
You would call the same endpoint (GET /api/v5/account/trade-fee) with instType set to SWAP. In the returned data, you must use the value from the takerU field (for taker orders) or makerU field (for maker orders) since it is a USDT-margined contract.
What happens if I keep using the old 'taker' field for a USDT-margined contract?
If you use the old taker or maker field for a USDT-margined contract, you will be retrieving the fee rate for crypto-margined contracts instead. This will likely lead to an incorrect calculation of your trading fees and potential strategy errors.
Are spot and margin trading fees affected by these changes?
No, the fee structure for spot and margin trading remains based on the original taker and maker fields. The new parameters and semantic changes specifically apply to futures and perpetual contracts (SWAP).
Where can I find more technical details about this update?
For the most in-depth and technical information, always refer to the official OKX API documentation. You can explore more strategies for integrating these updates effectively there.