النمط
Trade API

Pricing#

OKX DEX will request relevant data using the parameters below and requires the following token and pricing information to obtain complete quote data:

  • Market makers must provide independent (non-cumulative) pricing
  • Pricing consists of from/to token amounts and prices
  • Includes: trading pair info, each price level, and depth

Example:

A taker wants to swap 1.26 WETH to USDT. The market maker would buy 0.2635658632112683 WETH at the price of 4257.065884207436. The remaining 0.9964341368 WETH would need to be fulfilled by other PMMs or AMMs.

Another taker wants to swap 2000 USDT to WETH. The market maker would buy 1277.8023761262712 USDT at the price of 0.00023477808901049835 and buy 722.1976238737 USDT at a price of 0.00023474489972208067.

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain.
e.g., 1: Ethereum.
See more here.
levelDataObject[]YesLevels[] are used to distinguish depth, where the first value is the quantity and the second value is the takerTokenRate, representing the taker/maker token exchange rate.
Note: We do not require a minimum liquidity.
>takerTokenAddressStringYesThe contract address of the token being sold by the taker and purchased by the maker (e.g., 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
>makerTokenAddressStringYesThe contract address of the token being sold by the maker and purchased by the taker (e.g., 0xa892e1fef8b31acc44ce78e7db0a2dc610f92d00)
>levelsString[]YesLevels are a list of how much quantity is available at what price, quotes must be non-cumulative, level-by-level

Request Example#

shell
curl --location --request GET 'https://your-api-endpoint.com/OKXDEX/rfq/pricing?chainIndex=501' \

--header 'X-API-KEY: 37c541a1-****-****-****-10fe7a038418' \

Response Example#

200
{
    "code": "0",
    "msg": "",
    "data": {
        "chainIndex": "1",
        "levelData": [
            {
                "takerTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
                "makerTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT
                "levels": [
                    [
                        "0.2635658632112683", // Maker is willing to buy 0.2635658632112683 ETH
                        "4257.065884207436" // takerTokenRate 1 WETH = 4257.065884207436 USDT 
                    ]
                ]
            },
            {
                "takerTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT
                "makerTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
                "levels": [
                    [
                        "1277.8023761262712",  // Maker is willing to buy 1277.8023761262712 USDT
                        "0.00023477808901049835"//takerTokenRate 1 USDT = 0.00023477808901049835 WETH
                    ],
                    [
                        "961.3366422965815",
                        "0.00023474489972208067"
                    ]
                ]
            }
        ]
    }
}