Swap
Swap data stream.
Connect
- websocat
- wscat
websocat wss://api.datamaxiplus.com/ws/v1/dex/swap -H 'X-DTMX-APIKEY: $YOUR_API_KEY'
wscat -c wss://api.datamaxiplus.com/ws/v1/dex/swap -H 'X-DTMX-APIKEY: $YOUR_API_KEY'
Subscribe
-
method
specifies the type of request. -
params
list represents of symbols on exchanges that user wants to subscribe. The format of parameter ischain@exchange@pool
(e.g."kaia_mainnet@klayswap@0x12"
). You can request the list of supported chains with /api/v1/dex/chains exchanges with /api/v1/dex/exchanges endpoint, and pools with /api/v1/dex/pools -
The
id
uniquely identifies the subscription request. -
chain
is mandatory whileexchange
andpool
is optional param.
- schema
- example
{
"method": "SUBSCRIBE",
"params": [
string
],
"id": int32
}
Subscribe to all pools in kaia_mainnet
chain
{
"method": "SUBSCRIBE",
"params": [
"kaia_mainnet"
],
"id": 1
}
Subscribe to all pools within klayswap
exchange in kaia_mainnet
chain
{
"method": "SUBSCRIBE",
"params": [
"kaia_mainnet@klayswap"
],
"id": 1
}
Subscribe to 0xB9a1b7A04B6bbF4C319B46583c41f84eDc6c9932
pool from klayswap
exchange in kaia_mainnet
chain
// subscribe for certain pool
{
"method": "SUBSCRIBE",
"params": [
"kaia_mainnet@klayswap@0xB9a1b7A04B6bbF4C319B46583c41f84eDc6c9932"
],
"id": 1
}
Response
chain
represents chain of swap eventexchange
represents exchange of swap eventpool
represents pool address of swap eventtimestamp
represents timestamp of swap eventlogIndex
represents log index of swap eventblockNumber
represents block number of swap eventtxHash
represents tx hash of swap eventsymbol
represents symbol of swap eventmaker
represents maker address of swap eventtype
represents type of swap eventbaseQtySubUnit
represents the base quantity in sub unitquoteQtySubUnit
represents the quote quantity in sub unitbaseQtyBaseUnit
represents the base quantity in base unitquoteQtyBaseUnit
represents the quote quantity in base unitbasePrice
represents the quote price of swap event
- schema
- example
{
"chain": string,
"exchange": string,
"pool": string,
"timestamp": int,
"logIndex": int,
"blockNumber": int,
"txHash": string,
"symbol": string,
"maker": string,
"type": string,
"baseQtySubUnit": string,
"quoteQtySubUnit": string,
"baseQtyBaseUnit": float,
"quoteQtyBaseUnit": float,
"basePrice": float
}
{
"chain": "kaia_mainnet",
"exchange": "dragonswap",
"pool": "0x310ec7e68554492a6830f030afd72a112c4d261d",
"timestamp": 1730878157,
"logIndex": 14,
"blockNumber": 168867217,
"txHash": "0x023504f380d7b135c8dfff79766f053ca7f9d9bbef9d087d1e6e3567b67e144c",
"symbol": "BTCB-WETH",
"maker": "0xa324880f884036e3d21a09b90269e1ac57c7ec8a",
"type": "buy",
"baseQtySubUnit": "247093433486862",
"quoteQtySubUnit": "7030254462100631",
"baseQtyBaseUnit": 0.000247093433486862,
"quoteQtyBaseUnit": 0.007030254462100631,
"basePrice": 28.423766919247097
}