Websocket Connection

Important Note:

For all the Websocket endpoints below, pass your profile address.

To track your transactions on-chain (e.g., via Aptos Explorer or Aptos Scan), you must use your profile address, as all on-chain trades are executed using this profile address.

To obtain your profile address, use the /getProfileAddress endpoint and provide your wallet address as the userAddress parameter.

How to Fetch the Profile Address:

Example endpoint: https://perps-tradeapi.kanalabs.io/getProfileAddress?userAddress=0xd01e3a233632a41463bd6d289e99e69e1b50815c7afff710e1c992659a8722f3 Example code: https://docs.kanalabs.io/perpetual-futures/kana-perps/api-docs/kana-perps-typescript-rest-api#id-20.-get-profile-address

How to subscribe websocketURL:

Testnet WebSocket URL

wss://perpetuals-indexer-ws-develop.kanalabs.io/ws/

Mainnet WebSocket URL

wss://perpetuals-indexer-ws.kana.trade/ws/

Connect websocket with URL

  • order_history

{
  "topic": "order_history",
  "address": "{{user_address}}"
}
  • deposit_withdraw_history

{
  "topic": "deposit_withdraw_history",
  "address": "{{user_address}}"
}
  • trade_history

{
  "topic": "trade_history",
  "address": "{{user_address}}"
}
  • positions

{
  "topic": "positions",
  "address": "{{user_address}}"
}
  • open_orders

{
  "topic": "open_orders",
  "address": "{{user_address}}"
}
  • orderbook

{
  "topic": "orderbook",
  "market_id": "{{market_id}}"
}
  • recent_trades

{
  "topic": "recent_trades",
  "market_id": "{{market_id}}"
}
  • live_funding_rate

{
    "topic": "live_funding_rate"
}
  • live_order_history (It will update only latest single data)

{
  "topic": "live_order_history",
  "address": "{{user_address}}"
}
  • live_trade_history (It will update only latest single data_

{
  "topic": "live_trade_history",
  "address": "{{user_address}}"
}

send message like and subscribe to websocket

  • live_order_history (It will update only latest single data)

{
  "topic": "live_order_history",
  "address": "{{user_address}}"
}
  • live_trade_history (It will update only latest single data)

{
  "topic": "live_trade_history",
  "address": "{{user_address}}"
}

send message like and subscribe to websocket

Last updated