본문으로 건너뛰기

Swap

Swap data stream.

Connect

websocat 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 is chain@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 while exchange and pool is optional param.

{
"method": "SUBSCRIBE",
"params": [
string
],
"id": int32
}

Response

Field (JSON key)Description
chainChain — Chain of swap event.
Example: kaia_mainnet
exchangeExchange — Exchange of swap event.
Example: dragonswap
poolPool — Pool address of swap event.
Example: 0x123
txHashTxHash — Transaction hash of swap event.
Example: 0xabc
baseBase — Base of swap event.
Example: SLN
quoteQuote — Quote of swap event.
Example: USDT
tokenIdTokenId — Token ID of swap event.
Example: sln
makerMaker — Maker address of swap event.
Example: 0xdef
typeType — Type of swap event (e.g., buy / sell).
Example: buy
baseQtySubUnitBaseQtySubUnit — Base quantity in sub unit (string-encoded).
Example: 0.01594542081681406
quoteQtySubUnitQuoteQtySubUnit — Quote quantity in sub unit (string-encoded).
Example: 0.073019
timestampTimestamp — Timestamp of swap event (UTC seconds/ms per your system).
Example: 1707927698
blockNumberBlockNumber — Block number of swap event.
Example: 147266718
baseQtyBaseUnitBaseQtyBaseUnit — Base quantity in base unit.
Example: 0.01594542081681406
quoteQtyBaseUnitQuoteQtyBaseUnit — Quote quantity in base unit.
Example: 0.073019
basePriceBasePrice — Quote price of swap event for the base token.
Example: 0.01594542081681406
logIndexLogIndex — Log index within the transaction.
Example: 21

{
"chain": string,
"exchange": string,
"pool": string,
"txHash": string,
"base": string,
"quote": string,
"tokenId": string,
"maker": string,
"type": string,
"baseQtySubUnit": string,
"quoteQtySubUnit": string,
"timestamp": int,
"blockNumber": int,
"baseQtyBaseUnit": float,
"quoteQtyBaseUnit": float,
"basePrice": float,
"logIndex": int
}