KUCOIN API
HomeChange LogAPI DOC V1
Language
  • 繁體中文(即將上綫)
  • Русский (скоро)
HomeChange LogAPI DOC V1
Language
  • 繁體中文(即將上綫)
  • Русский (скоро)
SDK
Telegram
Kucoin
  1. Websocket API
  2. Futures Trading
  3. Private Channels
  • Introduction
  • Authentication
  • Enums Definitions
  • Terms Definitions
  • SDK
  • Rate Limit
  • Change Log
  • User Service
    • Market Making Incentive Scheme
    • VIP Fast Track
    • Broker Program
  • REST
    • Account Info
      • Account & Funding
        • Get Account Summary Info
        • Get Apikey Info
        • Get Account Type - Spot
        • Get Account List - Spot
        • Get Account Detail - Spot
        • Get Account - Cross Margin
        • Get Account - Isolated Margin
        • Get Account - Futures
        • Get Account Ledgers - Spot/Margin
        • Get Account Ledgers - Trade_hf
        • Get Account Ledgers - Margin_hf
        • Get Account Ledgers - Futures
      • Sub Account
        • Add sub-account
        • Add sub-account Margin Permission
        • Add sub-account Futures Permission
        • Get sub-account List - Summary Info
        • Get sub-account Detail - Balance
        • Get sub-account List - Spot Balance (V2)
        • Get sub-account List - Futures Balance (V2)
      • Sub Account API
        • Add sub-account API
        • Modify sub-account API
        • Get sub-account API List
        • Delete sub-account API
      • Deposit
        • Add Deposit Address (V3)
        • Get Deposit Address (V3)
        • Get Deposit History
      • Withdrawals
        • Get Withdrawal Quotas
        • Withdraw (V3)
        • Cancel Withdrawal
        • Get Withdrawal History
        • Get Withdrawal History By ID
      • Transfer
        • Get Transfer Quotas
        • Flex Transfer
      • Trade Fee
        • Get Basic Fee - Spot/Margin
        • Get Actual Fee - Spot/Margin
        • Get Actual Fee - Futures
    • Spot Trading
      • Market Data
        • Get Announcements
        • Get Currency
        • Get All Currencies
        • Get Symbol
        • Get All Symbols
        • Get Ticker
        • Get All Tickers
        • Get Trade History
        • Get Klines
        • Get Part OrderBook
        • Get Full OrderBook
        • Get Call Auction Part OrderBook
        • Get Call Auction Info
        • Get Fiat Price
        • Get 24hr Stats
        • Get Market List
        • Get Client IP Address
        • Get Server Time
        • Get Service Status
      • Orders
        • Add Order
        • Add Order Sync
        • Add Order Test
        • Batch Add Orders
        • Batch Add Orders Sync
        • Cancel Order By OrderId
        • Cancel Order By OrderId Sync
        • Cancel Order By ClientOid
        • Cancel Order By ClientOid Sync
        • Cancel Partial Order
        • Cancel All Orders By Symbol
        • Cancel All Orders
        • Modify Order
        • Get Order By OrderId
        • Get Order By ClientOid
        • Get Symbols With Open Order
        • Get Open Orders
        • Get Open Orders By Page
        • Get Closed Orders
        • Get Trade History
        • Get DCP
        • Set DCP
        • Add Stop Order
        • Cancel Stop Order By ClientOid
        • Cancel Stop Order By OrderId
        • Batch Cancel Stop Orders
        • Get Stop Orders List
        • Get Stop Order By OrderId
        • Get Stop Order By ClientOid
        • Add OCO Order
        • Cancel OCO Order By OrderId
        • Cancel OCO Order By ClientOid
        • Batch Cancel OCO Order
        • Get OCO Order By OrderId
        • Get OCO Order By ClientOid
        • Get OCO Order Detail By OrderId
        • Get OCO Order List
    • Margin Trading
      • Market Data
        • Get Symbols - Cross Margin
        • Get ETF Info
        • Get Mark Price Detail
        • Get Margin Config
        • Get Mark Price List
        • Get Symbols - Isolated Margin
      • Orders
        • Add Order
        • Add Order Test
        • Cancel Order By OrderId
        • Cancel Order By ClientOid
        • Cancel All Orders By Symbol
        • Get Symbols With Open Order
        • Get Open Orders
        • Get Closed Orders
        • Get Trade History
        • Get Order By OrderId
        • Get Order By ClientOid
      • Debit
        • Borrow
        • Get Borrow History
        • Repay
        • Get Repay History
        • Get Interest History
        • Modify Leverage
      • Credit
        • Get Loan Market
        • Get Loan Market Interest Rate
        • Purchase
        • Modify Purchase
        • Get Purchase Orders
        • Redeem
        • Get Redeem Orders
      • Risk Limit
        • Get Margin Risk Limit
    • Futures Trading
      • Introduction
      • Market Data
        • Get Symbol
        • Get All Symbols
        • Get Ticker
        • Get All Tickers
        • Get Full OrderBook
        • Get Part OrderBook
        • Get Trade History
        • Get Klines
        • Get Mark Price
        • Get Spot Index Price
        • Get Interest Rate Index
        • Get Premium Index
        • Get 24hr stats
        • Get Server Time
        • Get Service Status
      • Orders
        • Add Order
        • Add Order Test
        • Batch Add Orders
        • Add Take Profit And Stop Loss Order
        • Cancel Order By OrderId
        • Cancel Order By ClientOid
        • Batch Cancel Orders
        • Cancel All Orders
        • Cancel All Stop orders
        • Get Order By OrderId
        • Get Order By ClientOid
        • Get Order List
        • Get Recent Closed Orders
        • Get Stop Order List
        • Get Open Order Value
        • Get Recent Trade History
        • Get Trade History
      • Positions
        • Get Margin Mode
        • Switch Margin Mode
        • Batch Switch Margin Mode
        • Get Max Open Size
        • Get Position Details
        • Get Position List
        • Get Positions History
        • Get Max Withdraw Margin
        • Get Cross Margin Leverage
        • Modify Cross Margin Leverage
        • Add Isolated Margin
        • Remove Isolated Margin
        • Get Cross Margin Risk Limit
        • Get Isolated Margin Risk Limit
        • Modify Isolated Margin Risk Limit
      • Funding Fees
        • Get Current Funding Rate
        • Get Public Funding History
        • Get Private Funding History
    • Copy Trading
      • Introduction
      • Add Order Test
      • Add Take Profit And Stop Loss Order
      • Cancel Order By OrderId
      • Cancel Order By ClientOid
      • Add Order
      • Get Max Open Size
      • Modify Isolated Margin Auto-Deposit Status
      • Modify Isolated Margin Risk Limit
      • Remove Isolated Margin
      • Add Isolated Margin
      • Get Max Withdraw Margin
    • Convert
      • Introduction
      • Get Convert Symbol
      • Get Convert Currencies
      • Add Convert Order
      • Get Convert Quote
      • Get Convert Order Detail
      • Get Convert Order History
      • Add Convert Limit Order
      • Get Convert Limit Quote
      • Get Convert Limit Order Detail
      • Get Convert Limit Orders
      • Cancel Convert Limit Order
    • Earn
      • Purchase
      • Get Redeem Preview
      • Redeem
      • Get Savings Products
      • Get Promotion Products
      • Get Staking Products
      • Get KCS Staking Products
      • Get ETH Staking Products
      • Get Account Holding
    • VIP Lending
      • Introduction
      • Get Discount Rate Configs
      • Get Loan Info
      • Get Accounts
    • Affiliate
      • Introduction
      • Get Account
    • Broker
      • Introduction
      • Instructions
      • Broker Application
      • API Broker
        • Introduction
        • Get Broker Rebate
      • Exchange Broker
        • Introduction
        • Submit KYC
        • Get KYC Status
        • Get KYC Status List
        • Get Broker Info
        • Add sub-account
        • Get sub-account
        • Add sub-account API
        • Get sub-account API
        • Modify sub-account API
        • Delete sub-account API
        • Transfer
        • Get Transfer History
        • Get Deposit List
        • Get Deposit Detail
        • Get Withdraw Detail
        • Get Broker Rebate
  • Websocket API
    • Base Info
      • Introduction
      • Get Public Token - Spot/Margin
      • Get Private Token - Spot/Margin
      • Get Public Token - Futures
      • Get Private Token - Futures
    • Spot Trading
      • Public Channels
        • Ticker
        • All Tickers
        • Orderbook - Level1
        • Orderbook - Level5
        • Orderbook - Level50
        • Orderbook - Increment
        • Call Auction Orderbook - Level50
        • Call Auction Data
        • Klines
        • Trade
        • Symbol Snapshot
        • Market Snapshot
      • Private Channels
        • Order V2
        • Order V1
        • Balance
        • Stop Order
    • Margin Trading
      • Public Channels
        • Index Price
        • Mark Price
      • Private Channels
        • Cross Margin Position
        • Isolated Margin Position
    • Futures Trading
      • Public Channels
        • Ticker V2
        • Ticker V1
        • Orderbook - Level5
        • Orderbook - Level50
        • Orderbook- Increment
        • Klines
        • Trade
        • Instrument
        • Funding Fee Settlement
        • Symbol Snapshot
      • Private Channels
        • Orders
        • Balance
        • Positions
        • Margin Mode
        • Cross Margin Leverage
        • Stop Orders
    • Add/Cancel Order
      • Add Order
      • Cancel Order
  • Error Code
    • HTTP
    • Spot
    • Margin
    • Futures
    • Earn
    • Broker
    • CopyTrading
  • Abandoned Endpoints
    • Introduction
    • Account & Funding
      • Get sub-account List - Summary Info (V1)
      • Get sub-account List - Spot Balance (V1)
      • Get Deposit Addresses (V2)
      • Get Deposit Addresses - V1
      • Sub-account Transfer
      • Get Deposit History - Old
      • Internal Transfer
      • Get Futures Account Transfer Out Ledger
      • Get Withdrawal History - Old
      • Futures Account Transfer Out
      • Futures Account Transfer In
      • Add Deposit Address - V1
      • Withdraw - V1
    • Spot Trading
      • Orders
        • Add Order - Old
        • Add Order Test - Old
        • Batch Add Orders - Old
        • Cancel Order By OrderId - Old
        • Cancel Order By ClientOid - Old
        • Batch Cancel Order - Old
        • Get Orders List - Old
        • Get Recent Orders List - Old
        • Get Order By OrderId - Old
        • Get Order By ClientOid - Old
        • Get Trade History - Old
        • Get Recent Trade History - Old
    • Margin Trading
      • Get Account Detail - Margin
      • Add Order - V1
      • Add Order Test - V1
      • Get Account List - Isolated Margin - V1
      • Get Account Detail - Isolated Margin - V1
    • Futures Trading
      • Modify Isolated Margin Auto-Deposit Status
      • Cancel All Orders - V1
  • Developing
    • Introduction
    • Margin Trading
      • Add Stop Order
      • Cancel Stop Order By OrderId
      • Cancel Stop Order By ClientOid
      • Batch Cancel Stop Orders
      • Get Stop Orders List
      • Get Stop Order By OrderId
      • Get Stop Order By ClientOid
      • Add OCO Order
      • Cancel OCO Order By OrderId
      • Cancel OCO Order By ClientOid
      • Batch Cancel OCO Order
      • Get OCO Order By OrderId
      • Get OCO Order By ClientOid
      • Get OCO Order Detail By OrderId
      • Get OCO Order List
    • Futures Trading
      • Get Cross Mode Margin Requirement
    • UTA
      • Market data
        • Get Announcements
        • Get Currency
        • Get Symbol
        • Get Ticker
        • Get Recent Trades
        • Get OrderBook
        • Get Klines
        • Get Futures Funding Rate
        • Get Funding Rate History
        • Get Cross Margin Config
        • Get Service Status
      • Account
        • Get Account
        • Get Sub Account
        • Get Actual Fee
        • Get Transfer Quotas
        • Get Account Ledger
      • TRADE
        • Set DCP
        • Get DCP
    • Flex Transfer
  1. Websocket API
  2. Futures Trading
  3. Private Channels

Positions

wss://ws-api-futures.kucoin.com

Topic: /contract/positionAll#

OR#

Topic:/contract/position:XBTUSDTM#

Description
You will receive this message when position changes.
These situations will cause position change
Position Changes Caused Operations. changeReason Descriptions:
1.
“marginChange”: margin change;
2.
“positionChange”: position change;
3.
“liquidation”: liquidation;
4.
“autoAppendMarginStatusChange”: auto-deposit-status change;
5.
“adl”: adl;
Funding Fee Settlement
Adjustment Isolated Margin Risk Limit Level. msg failure reasons:
1.
the value of the holding position exceeds the limit amount of the risk limit level;
2.
insufficient balance to increase the margin.
Push frequency: real-time

Subscribe Message#

//Get all symbols position change
{
  "id": 1545910660739,
  "type": "subscribe",
  "topic": "/contract/positionAll",
  "response": true,
  "privateChannel": "true"
}

//Get specific symbol position change
{
  "id": 1545910660739,
  "type": "subscribe",
  "topic": "/contract/position:XBTUSDTM",
  "response": true,
  "privateChannel": "true"
}
    

Response#

Data Schema
position
userId
string 
required
Deprecated, will delete later
topic
string 
required
subject
string 
required
type
string 
required
channelType
string 
required
data
object 
required
symbol
string 
required
Symbol of the contract. Please refer to Get Symbol endpoint: symbol
Examples:
XBTUSDTMXBTUSDMETHUSDTM
marginMode
enum<string> 
required
Margin Mode: CROSS, ISOLATED
Allowed values:
CROSSISOLATED
crossMode
boolean 
required
Whether it is cross margin.
delevPercentage
number 
required
ADL ranking percentile
openingTimestamp
integer <int64>
required
Open time
currentTimestamp
integer <int64>
required
Current timestamp
currentQty
integer 
required
Current position quantity
currentCost
number 
required
Current position value
currentComm
number 
required
Current commission
unrealisedCost
number 
required
Unrealized value
unrealisedPnl
number 
required
Unrealized profit and loss
unrealisedPnlPcnt
number 
required
Profit-loss ratio of the position
unrealisedRoePcnt
number 
required
Rate of return on investment
realisedCost
number 
required
Current realized position value
realisedGrossCost
number 
required
Accumulated realized gross profit value
realisedGrossPnl
number 
required
Accumulated realized gross profit value
realisedPnl
number 
required
Realized profit and loss
isOpen
boolean 
required
Opened position or not
markPrice
number 
required
Mark price
markValue
number 
required
Mark Value
posCost
number 
required
Position value
posInit
number 
required
Inital margin Cross = opening value/cross leverage; isolated = accumulation of initial margin for each transaction
posMargin
number 
required
Bankruptcy cost Cross = mark value * imr; Isolated = position margin (accumulation of initial margin, additional margin, generated funding fees, etc.)
avgEntryPrice
number 
required
Average entry price
liquidationPrice
number 
required
Liquidation price: For Cross Margin, you can refer to the liquidationPrice, and the liquidation is based on the risk rate.
bankruptPrice
number 
required
Bankruptcy price: For Cross Margin, you can refer to the bankruptPrice, and the liquidation is based on the risk rate.
settleCurrency
string 
required
Currency used to clear and settle the trades
positionSide
enum<string> 
required
Position Side
Allowed value:
BOTH
leverage
number 
required
Leverage
maintMarginReq
number 
optional
Maintenance margin requirement
posMaint
number 
optional
Maintenance margin
autoDeposit
boolean 
optional
Auto deposit margin or not Only applicable to Isolated Margin
riskLimit
integer 
optional
Risk limit Only applicable to Isolated Margin
realLeverage
number 
optional
Leverage of the order Only applicable to Isolated Margin
posCross
number 
optional
Added margin Only applicable to Isolated Margin
posComm
number 
optional
Bankruptcy cost Only applicable to Isolated Margin
posLoss
number 
optional
Funding fees paid out Only applicable to Isolated Margin
posFunding
number 
optional
The current remaining unsettled funding fee for the position Only applicable to Isolated Margin
maintMargin
number 
optional
Position margin Only applicable to Isolated Margin
fundingTime
integer <int64>
optional
Funding time
qty
integer 
optional
Position size
fundingRate
number 
optional
Funding rate
fundingFee
number 
optional
Funding fees
ts
integer <int64>
optional
Funding Fee Settlement Time (nanoseconds)
success
boolean 
optional
Adjustment isolated margin risk limit level successful or not
msg
string 
optional
Adjustment isolated margin risk limit level failure reason
Example
1. Position Changes Caused Operations

//Isolated Margin
{
    "topic": "/contract/position:XBTUSDTM",
    "type": "message",
    "data": {
        "symbol": "XBTUSDTM",
        "maintMarginReq": 0.005,
        "riskLimit": 500000,
        "realLeverage": 4.9685590767,
        "crossMode": false,
        "delevPercentage": 0.10,
        "openingTimestamp": 1731916913097,
        "autoDeposit": true,
        "currentTimestamp": 1731924561514,
        "currentQty": 1,
        "currentCost": 91.5306,
        "currentComm": 0.09179284,
        "unrealisedCost": 91.6945,
        "realisedCost": -0.07210716,
        "isOpen": true,
        "markPrice": 91839.79,
        "markValue": 91.83979,
        "posCost": 91.6945,
        "posCross": 0,
        "posInit": 18.3389,
        "posComm": 0.06602004,
        "posLoss": 0,
        "posMargin": 18.40492004,
        "posFunding": 0,
        "posMaint": 0.5634627025,
        "maintMargin": 18.55021004,
        "avgEntryPrice": 91694.5,
        "liquidationPrice": 73853.0426625,
        "bankruptPrice": 73355.6,
        "settleCurrency": "USDT",
        "changeReason": "positionChange",
        "riskLimitLevel": 2,
        "realisedGrossCost": -0.1639,
        "realisedGrossPnl": 0.1639,
        "realisedPnl": 0.07210716,
        "unrealisedPnl": 0.14529,
        "unrealisedPnlPcnt": 0.0016,
        "unrealisedRoePcnt": 0.0079,
        "leverage": 4.9685590767,
        "marginMode": "ISOLATED",
        "positionSide": "BOTH"
    },
    "subject": "position.change",
    "userId": "633559791e1cbc0001f319bc",
    "channelType": "private"
}
      
//Cross Margin
{
    "topic": "/contract/position:XBTUSDTM",
    "type": "message",
    "data": {
        "symbol": "XBTUSDTM",
        "crossMode": true,
        "delevPercentage": 0.06,
        "openingTimestamp": 1717639498983,
        "currentTimestamp": 1717724686618,
        "currentQty": -2,
        "currentCost": -136.002,
        "currentComm": 0.06739824,
        "unrealisedCost": -136.002,
        "realisedCost": 0.06739824,
        "isOpen": true,
        "markPrice": 70778.04,
        "markValue": -141.55608,
        "posCost": -136.002,
        "posInit": 5.4509819612,
        "posMargin": 5.6735903779,
        "avgEntryPrice": 68001,
        "liquidationPrice": 80700.49720065,
        "bankruptPrice": 81152.42267235,
        "settleCurrency": "USDT",
        "changeReason": "positionChange",
        "realisedGrossCost": 0,
        "realisedGrossPnl": 0,
        "realisedPnl": -0.09580416,
        "unrealisedPnl": -5.55408,
        "unrealisedPnlPcnt": -0.0408,
        "unrealisedRoePcnt": -1.0189,
        "leverage": 24.95, 
        "marginMode": "CROSS", // CROSS,ISOLATED
        "positionSide": "BOTH"
    },
    "subject": "position.change",
    "userId": "665ec530aa70390001d22576",
    "channelType": "private"
}
      
2. Funding Fee Settlement
{
  "userId": "xbc453tg732eba53a88ggyt8c", // Deprecated, will detele later
  "topic": "/contract/position:XBTUSDM",
  "subject": "position.settlement",
  "data": {
    "fundingTime": 1551770400000, //Funding time
    "qty": 100, //Position size
    "markPrice": 3610.85, //Settlement price
    "fundingRate": -0.002966, //Funding rate
    "fundingFee": -296, //Funding fees
    "ts": 1547697294838004923, //Current time (nanosecond)
    "settleCurrency": "XBT" //Currency used to clear and settle the trades
  }
}
      
3. Adjustment Isolated margin Risk Limit Level
{
  "userId": "xbc453tg732eba53a88ggyt8c",
  "topic": "/contract/position:ADAUSDTM",
  "subject": "position.adjustRiskLimit",
  "data": {
    "success": true, // Successful or not
    "riskLimitLevel": 1, // Current risk limit level
    "msg": "" // Failure reason
  }
}

Request

Query Params
token
string 
required
The token required to establish a websocket connection
Example:
2neAiuYvAU737TOajb2U3uT8AEZqSWYe0fBD4LoHuXJDSC7gIzJiH4kNTWhCPISWo6nDpAe7aUaaHJ4fG8oRjFgMfUI2sM4IySWHrBceFocY8pKy2REU1HwZIngtMdMrjqPnP-biofFWbNaP1cl0X1pZc2SQ-33hDH1LgNP-yg8ht7P5VWcj8iVVF8KnrZyV.ju8o70DBgQIHLwPJo2vIXA==
connectId
string 
optional
Connection Id, a unique value taken from the client side. Both the id of the welcome message and the id of the error message are connectId.
Example:
121345
Modified at 2025-07-09 03:29:57
Previous
Balance
Next
Margin Mode