Skip to Content

Private Message Stream

Private message stream contains order and account changes. Send login message first, then subscribe to private stream

Subscribe URL

wss://stream.bittap.com/endpoint?format=JSON

Subscribe Parameters

Stream name: f_private

ParameterDescription

Data Update

NameTypeDescription

Subscribe Example

{ "id":"id", "method": "LOGIN", "params": [ "3se60fJU9oJ3nCRnDHFiiFK2G1sxm3EqKZDYV5aKrUKa4smXaGxwbUS0Hm3Vhudo", // apiKey "1762509526408", // timestamp cannot be later than server time by 5 minutes cannot be earlier than server time by 1 minute "0270e250ffce18e605f95737d69c14a6f38909a7d727ae3f13ca374b94ec9a60" // signature encrypted with api_secret using timestamp ] } { "method": "SUBSCRIBE", "params": [ "f_private" ] }

Subscribe Success Example

{ "code": 0, // 0 means success, non-0 means failure "msg":"", // failure reason, null when success "topic": ["", ""], // topics that failed to subscribe "id": 1 }

Data Update Example

Account Update Response Example Event type: ACCOUNT_UPDATE

{ "e": "f_private", // topic "c": "ACCOUNT_UPDATE", // event type "E": 1564745798939, // event time "a": { // account update event "B": [ // balance information { "a": "USDT", // asset name/coin "wb": "122624.12345678", // wallet total balance "aq": "122624.12345678", // account total equity = wallet total balance + cross margin unrealized PnL "bc": "50.12345678", // transferable = balance - locked - lockedCrossUnrealizedPnL "aw":"80.12345678", // available = transferable + cross margin unrealized PnL "tcp":"4321.12345678", // total cross margin unrealized PnL "tip":"5321.12345678", // total isolated margin unrealized PnL "cmm":"8000.12345678", // total cross margin maintenance margin "cmmr":"0.80000", // total cross margin maintenance margin rate "tf":"0.80000", // total trial fund amount "aseq":"1" // version number } ] } }

Regular Order Update Response Example Event type: ORDER_UPDATE

{ "e": "f_private", "c": "ORDER_UPDATE", "E": 1735286923983, // event push time "A": "10284.76142857142857144", // cancel amount "O": 1734856922479, // order time "P": 251396096, // position id "Q": "19284.76142857142857144", // order amount, quote currency quantity, e.g., USDT quantity "S": "SELL", // buy/sell direction, BUY,SELL "X": "CANCELED", // order status OPEN,FILLED,CANCELED "a": "0.1", // cancel quantity base currency quantity, e.g., BTC quantity "ap": "90000", // order average fill price "o": "MARKET", // order type, LIMIT, MARKET "f": "GTC", // time in force, GTC, IOC,FOK "i": "78429693349888", // order ID "l": 20, // leverage "m": "CROSSED", // margin mode, CROSSED-cross margin, ISOLATION-isolated margin "N": "USDT", // trading fee currency "n": "2.25", // trading fee "p": "91602.6168", // price "pm": "HEDGE", // position mode: HEDGE-hedge mode, ONE_WAY-one-way mode "pnl": "0", // realized PnL "po": false, // post only, true/false "q": "0.2000", // order quantity, base currency quantity "r": "NO_MAKER", // cancel reason "ro": false, // reduce only, true/false "s": "BTC-USDT-M", // symbol id "se": 2, // order version number, if latest version number is greater than current version, replace, if less than or equal, discard this push message "Z": "9000", // filled amount, quote currency amount, e.g., USDT amount "z": "0.1" , // filled quantity, base currency quantity, e.g., BTC quantity "rl": "765", // order remaining frozen "tt": "1", // take profit type "tp": "1", // take profit trigger price "tep": "1", // take profit execution price "st": "1", // stop loss type "sp": "1", // stop loss trigger price "sep": "1" // stop loss execution price }

Stop Order Update Response Example Event type: STOP_ORDER

{ "O": 1751096610257, // order time "P": "2418200649890055606", // position id "X": "CANCELED", // status "c": "STOP_ORDER", // type "cb": "0", // callback ratio "codi": "LTE", // trigger condition "e": "f_private", "ep": "0", // execution price "l": "20", // leverage "m": "ISOLATED", // margin mode "o": "64742480704180224", // order id "opt": "DEFAULT", // order plan type "ot": "PLAN_LIMIT", // order type regular take profit/stop loss, position take profit/stop loss PLAN_MARKET "pt": "MARK", // price type "q": "1", // order quantity "se": 2, // version number "si": "SELL", // direction "sy": "BTC-USDT-M", // trading pair "tp": "105000", // trigger price "f": "GTC", // time in force, GTC, IOC,FOK "po": false, // post only, true/false "tt": "1", // take profit type "tpp": "1", // take profit trigger price "tep": "1", // take profit execution price "st": "1", // stop loss type "sp": "1", // stop loss trigger price "sep": "1" // stop loss execution price }

Position Update Response Example Event type: POSTION_UPDATE

{ "e": "f_private", // topic "c": "POSTION_UPDATE", // event type "t": "1", // event cycle ID "E": 1564745798939, // event time "T": 1564745798938, // match time "a": { "P": { "id": "0", // position id "s": "BTCUSDT", // trading pair "qty": "100.00000", // position quantity "ep": "35000.00000", // entry price "aep": "34500.00000", // average position price "ev": "3450000.00000", // position value "bep": "34800.00000", // break-even price "up": "-50000.00000", // position unrealized PnL "mt": "ISOLATED", // margin mode ISOLATED/CROSSED "mg": "10000.00000", // position actual margin "im": "8000.00000", // initial margin "pmm": "5000.00000", // cross margin position maintenance margin "ps": "SELL", // position direction BUY/SELL "rp": "1000.00000", // realized PnL "pnl": "950.00000", // close position PnL "lp": "32000.00000", // liquidation price "lv": "3200000.00000", // liquidation value "bp": "31000.00000", // bankruptcy price "bv": "3100000.00000", // bankruptcy value "mp": "34800.00000", // mark price "mv": "3480000.00000", // position mark value "mm": "4000.00000", // maintenance margin "mr": "0.85", // margin ratio "pm": "ONE_WAY", // position mode ONE_WAY/HEDGE "m": "10", // leverage "adl": "5", // ADL ranking "pseq": "1", // version number "omm":"5002.00000", // other position maintenance margin "ocf":"500.12345", // other contract estimated close fee "pst":"COMPLETED", // position status OPEN/COMPLETED "upr":"0.5" // unrealized PnL rate "bf":"0.2", // bankruptcy fee "fr":"0.0001", // funding fee "ct":"1736995070115", // position creation time "mt":"1736995070115", // position update time "ff": 12 // frozen fee } } }

User Setting Update Response Example Event type: SETTING_UPDATE

{ "e": "f_private", "c": "SETTING_UPDATE", "E": 1735286371528, // event push time "l": 50, // leverage "m": "CROSSED", // margin mode "p": "HEDGE", // position mode "s": "ETH-USDT-M", // futures trading pair ID "t": 1735286371491 // latest modification time }

Unsubscribe Example

{ "id":"id", "method": "LOGIN", "params": [ "3se60fJU9oJ3nCRnDHFiiFK2G1sxm3EqKZDYV5aKrUKa4smXaGxwbUS0Hm3Vhudo", // apiKey "1762509526408", // timestamp cannot be later than server time by 5 minutes cannot be earlier than server time by 1 minute "0270e250ffce18e605f95737d69c14a6f38909a7d727ae3f13ca374b94ec9a60" // signature encrypted with api_secret using timestamp ] } { "method": "UNSUBSCRIBE", "params": [ "f_private" ] }

Error Codes

No information available

Code Example

Last updated on: