Market API

Get Trades#

Retrieve the recent transactions of a token.

Request URL#

GET https://web3.okx.com/api/v5/dex/market/trades

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain.
e.g., 1: Ethereum.
See more here.
tokenContractAddressStringYesToken contract address (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50)
afterStringNoPagination of data to return records earlier than the requested id.
limitStringNoNumber of results per request. The maximum is 500 and default is 100.

Response Parameters#

ParameterTypeDescription
idStringUnique trade id
chainIndexStringUnique identifier for the chain. (e.g., 1 for Ethereum. See ChainIndex)
tokenContractAddressStringToken contract address
txHashUrlStringOn-chain txhash of the transactions
userAddressStringAuthorizer of the transaction
dexNameStringName of the dex where the trade occured
poolLogoUrlStringPool logo url
typeStringtrade Type. buy sell
changedTokenInfoStringexchanged info
> amountStringtoken exchanged amount in this trade
> tokenSymbolStringToken symbol
> tokenContractAddressStringToken contract address
priceStringLatest token price
volumeStringUSD value of this trade
timeStringTimestamp of the price, Unix timestamp format in milliseconds
isFilteredStringIf the trade is filtered for price and k-line calculation.
0: not filtered 1: filtered"

Request Example#

shell
curl --location --request GET 'https://web3.okx.com/api/v5/dex/market/trades?chainIndex=501&tokenContractAddress=HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'

Response Example#

200
{
  "code":"0",
  "data":[
    {
    "id":"1739439633000!@#120!@#14731892839",
    "chainIndex": "501",
    "tokenContractAddress": "HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC",
    "txHashUrl": "https://solscan.io/tx/zgDzoiVG4XuDgQcoEg9vhpRyfyk5thNUQuTeTCeF289Qec5iraeCrUzPLyiE2UCviox2ebbTcsagGvzYF7M5uqs",
    "userAddress": "2kCm1RHGJjeCKL4SA3ZJCLyXqUD7nEJ7GMtVaP7c6jQ8",
    "dexName": "Orca Whirlpools",
    "poolLogoUrl": "https://static.okx.com/cdn/wallet/logo/dex_orcaswap.png",
    "type": "sell",
    "changedTokenInfo": [
    {
    "amount":"100.396595878", 
    "tokenSymbol":"ai16z",
    "tokenContractAddress": "HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC"
    },
    {
    "amount":"2.482831", 
    "tokenSymbol":"SOL",
    "tokenContractAddress": "So11111111111111111111111111111111111111112"
    }
    ]
    "price": "26.458143090226812",
    "volume": "519.788163",
    "time": "1739439633000",
    "isFiltered": "0"
    }
    ],
  "msg":"",
}