Kana Labs
  • Getting Started
    • Welcome to Kana Labs
  • CROSS CHAIN SWAPS
    • AMM DEX Aggregator
  • INTEGRATE KANA WIDGET
    • Kana Widget
      • Install Widget
      • Configure Widget
      • Configure Aptos Keyless
  • Web3 Aggregator SDK
    • Web3 Aggregator SDK
      • Installation
      • SameChain
      • Cross Chain Swap
      • Aggregator API's
  • SPOT TRADING PLATFORM
    • Kana Trade
      • API Docs
  • PERPETUAL FUTURES
    • Kana Perps
      • Getting Started
        • Mint Tokens on Testnet
        • Mainnet Tutorials
          • Getting Started
          • Connecting Wallet & Enabling “One Click Transaction”
          • Deposit & Withdraw Tokens
          • Placing a Market Trade Order
          • Placing a Limit Trade Order
          • Partially & Fully Closing a Live Trade Order
          • Adding Margin to an Open Position
          • Defining Take Profit & Stop Loss
      • Breaking Down Kana Perps
        • Assets Supported
        • Order Types
        • Orderbook
        • 1-Click Trading in Kana Perps
          • Delegation
        • Funding Rate
        • Leverage
        • Margin and Liquidation
        • Hedge Mode
          • Hedging a Short-Term 2-3% Price Decline
          • Dual Positioning for Flexible Profit-Taking
        • Trading Fees
      • Technical Architecture
      • API Docs
        • Installation Setup
        • Kana Perps Typescript REST API
        • Kana Perps Python Websocket API
        • Kana Perps Python REST API
        • Steps to place an order
        • Perps Contract Error Codes
        • Websocket Connection
        • Supported Markets
  • SPOT & PERP APIs
    • Trading APIs
      • Kana Trade API
      • Kana Perps API
        • Installation Setup
        • Example setup functions
        • Kana Perps Typescript REST API
        • Kana Perps Websocket API
        • Kana Perps Python Websocket API
        • Kana Perps Python REST API
        • Steps to place an order
  • PAYMASTER SERVICE
    • Kana Paymaster For Aptos and Supra
      • How it works?
      • How to Register?
      • Deposit Allowance
      • Manage Users
      • Paymaster SDK Tutorial (Typescript)
      • Paymaster API
      • Module & Function Whitelist
      • Subscription - Coming soon
      • FAQS
  • PERPETUAL OPTIONS
    • OPerps
  • Tokenomics & Governance
    • Kana Labs Tokenomics
  • REWARDS & REFERRAL PROGRAM
    • Rewards Program
      • Reward Program Season 1
      • Reward Program Season 2
      • How to Keep Track of Your Points?
      • Where to find the Missions Dashboard?
  • Referral Program
    • How to Generate Referral Link? (For the Referrer)
    • How to map your wallet to the invite IDs? (For the invited users)
Powered by GitBook
On this page
  • Websocket Overview
  • Supported Markets
  • Prerequisites
  • Endpoint URL :
  1. SPOT & PERP APIs
  2. Trading APIs
  3. Kana Perps API

Kana Perps Websocket API

Overview of supported trading markets and installation prerequisites for using the Websocket API.

PreviousKana Perps Typescript REST APINextKana Perps Python Websocket API

Last updated 5 months ago

Websocket Overview

Supported Markets

This Websocket API provides information for the following trading markets:

Asset

Market ID

Description

APT/USDC

301

Aptos-based trading market.

BTC/USDC

302

Bitcoin-based trading market.

ETH/USDC

303

Ethereum-based trading market.

Prerequisites

Install Required Packages

Before you begin, install the following dependencies:

npm install ws

This documentation explains how to connect and receive data from the WebSocket streams: You can connect order book stream using client initialization code in TypeScript.

Endpoint URL :

  • Order Book Stream :

Example Request: wss://perps-sdk-ws.kanalabs.io/wsOrderBook/marketId=301 Here is the steps to initialize the client code in typescript : Example code to fetch the Order Book Client Initialization Code:

import WebSocket from 'ws';

const marketId = 'your_market_id';

const ws = new WebSocket(`wss://perps-sdk-ws.kanalabs.io/wsOrderBook?marketId=${marketId}`);

ws.on('open', () => {
    console.log('[client] Connected to the server');
    ws.send('Request data from endpoint');
});

ws.on('message', (data) => {
    console.log(`Received a message from the server:, ${data}`);
});

ws.on('close', () => {
    console.log('[client] Disconnected from the server');
});
wss://perps-sdk-ws.kanalabs.io/wsOrderBook