REGISTRATION

Advanced REST & WebSocket

Advanced: Direct REST & WebSocket API

Advanced: Direct REST & WebSocket API

For custom code and low-level integrations that call RapidX directly, without the CLI or MCP layer.

Most participants should use the CLI or MCP — see 01-quickstart.md. This document is for cases where you need direct HTTP or WebSocket access: performance-critical bots, languages without Node.js, or custom tooling.

Official API docs: get-account-list


Authentication

Official docs →

Required Headers (REST)

HeaderValue
X-MBX-APIKEYYour Access Key
nonceCurrent Unix timestamp in seconds (string)
signatureHMAC-SHA256 signature (see below)
Content-Typeapplication/json

REST Signature Algorithm

1. Sort request parameters alphabetically by key:
   sorted_payload = "key1=val1&key2=val2&..."

2. Append "&" + timestamp:
   payload = sorted_payload + "&" + timestamp
   (no parameters: payload = "&" + timestamp)

3. HMAC-SHA256 with your Secret Key, hex-encoded:
   signature = HMAC-SHA256(secret_key, payload).hexdigest()

Python example:

import hmac, hashlib, time

def sign(params: dict, secret_key: str):
    timestamp = str(int(time.time()))
    sorted_payload = "&".join(f"{k}={v}" for k, v in sorted(params.items()))
    payload = (sorted_payload + "&" if sorted_payload else "&") + timestamp
    sig = hmac.new(secret_key.encode(), payload.encode(), hashlib.sha256).hexdigest()
    return sig, timestamp

WebSocket Authentication Signature

Different from REST — used for the private WebSocket login:

message = timestamp + "GET" + "/users/self/verify"
sign = HMAC-SHA256(secret_key, message).hexdigest()

REST API Endpoints

Base URL: https://api.ltp-contest.com

Account & Assets

MethodPathDescriptionDocs
GET/api/v1/trading/accountAccount overview per exchange
GET/api/v1/trading/portfolio/assetsPortfolio asset breakdown
GET/api/v1/trading/user/tradingStatsTrading statistics (begin, end params)
GET/api/v1/trading/userFeeRateMaker/Taker fee rates

Orders

MethodPathDescriptionDocs
POST/api/v1/trading/orderPlace order
PUT/api/v1/trading/orderAmend order
DELETE/api/v1/trading/orderCancel order
DELETE/api/v1/trading/cancelAllCancel all orders (sym or exchangeType)
GET/api/v1/trading/orderGet single order (orderId or clientOrderId)
GET/api/v1/trading/ordersList open orders
GET/api/v1/trading/history/ordersOrder history (sym optional)
GET/api/v1/trading/archive/history/ordersArchived order history
GET/api/v1/trading/executionsExecution records
GET/api/v1/trading/executions/pageablePageable executions
GET/api/v1/trading/statementTrading statement

Place order fields:

FieldRequiredDescription
symYese.g. BINANCE_PERP_BTC_USDT
sideYesBUY / SELL
positionSideYes (hedge mode)LONG / SHORT
orderTypeYesLIMIT / MARKET
orderQtyYesBase/contract quantity
limitPriceFor LIMITLimit price
timeInForceNoGTC (default) / IOC / FOK / GTX
clientOrderIdRecommendedMax 40 chars

Order states: NEWOPENPARTIALLY_FILLEDFILLED / CANCELLED / REJECTED

Positions

MethodPathDescriptionDocs
GET/api/v1/trading/positionOpen positions (sym, exchange optional)
GET/api/v1/trading/history/positionPosition history
DELETE/api/v1/trading/positionClose position (sym, positionSide)
DELETE/api/v1/trading/positionsClose all positions (exchangeType, closeAllPos:"true")
GET/api/v1/trading/perp/leverageGet leverage (sym or exchange optional)
POST/api/v1/trading/position/leverageSet leverage (sym, leverage)
GET/api/v1/adl/rankADL rank (sym optional)

Market Data (RapidX)

MethodPathDescriptionDocs
GET/api/v1/trading/sym/infoSymbol rules (sym optional)
GET/api/v1/market/fundingRateFunding rate (sym required)
GET/api/v1/market/markPriceMark price (sym optional)
GET/api/v1/trading/positionBracketPosition tier/bracket
GET/api/v1/trading/loan/infoLoan info
GET/api/v1/trading/coin/discountCoin discount rate
GET/api/v1/trading/margin/leverageMargin leverage

Rate Limits

EndpointCompetition limit
POST /api/v1/trading/order (place order)1 req / 5 s
PUT /api/v1/trading/order (replace order)1 req / 5 s
DELETE /api/v1/trading/order (cancel order)1 req / 5 s
GET /api/v1/market/fundingRate3 req / 10 s
GET /api/v1/market/markPrice3 req / 10 s
GET /api/v1/trading/sym/info3 req / 10 s
DELETE /api/v1/trading/positions (close all positions)1 req / 10 s
All other REST endpointsproduction rate × 1/5 (see individual endpoint pages)

REST Response Format

{
  "code": 200000,
  "message": "Success",
  "data": { ... }
}

code: 200000 = success. Any other value is an error. Error codes →


WebSocket

Private WebSocket (Trading + Account Events)

User Data Streams overview →

URL: wss://wss.ltp-contest.com/v1/private

Login:

{
  "action": "login",
  "args": {
    "apiKey": "YOUR_ACCESS_KEY",
    "timestamp": "1778140847",
    "sign": "..."
  }
}

Response:

{ "event": "login", "code": 0, "msg": "" }

Order actions:

ActionDocs
place_order
replace_order
cancel_order
cancel_orders
{ "id": "p1", "action": "place_order",  "args": { ... } }
{ "id": "a1", "action": "replace_order","args": { "orderId": "...", "replacePrice": "64000" } }
{ "id": "c1", "action": "cancel_order", "args": { "orderId": "..." } }

Orders push channel — auto-subscribed after login. User data streams →

{
  "channel": "Orders",
  "data": {
    "orderId": "1234567890123456",
    "clientOrderId": "agent-001",
    "orderState": "FILLED",
    "executedQty": "0.001",
    "executedAvgPrice": "65000"
  }
}

Keepalive: send "ping" every 15 seconds; server replies "pong".

Market Data WebSocket

Market Data overview →

URL: wss://mds.ltp-contest.com/marketdata/v2/public

Append ?binary=false for plain-text JSON instead of GZIP frames.

Rate limits:

ModeMax connections / IPMax symbols / connection
Unauthenticated55
Authenticated4050

Limits are counted by trading pair — subscribing BBO + TICKER + TRADE for the same symbol counts as 1 pair.

Subscribe:

{
  "event": "subscribe",
  "arg": [
    { "channel": "BBO", "sym": "BINANCE_PERP_BTC_USDT" },
    { "channel": "TRADE", "sym": "BINANCE_PERP_BTC_USDT" }
  ]
}

Available channels:

ChannelFrequencyScopeDocs
BBOOn changeAll
TICKER2000 msAll
TRADEReal-timeAll
ORDER_BOOK250 msAll
KLINEReal-timeAll
MARK_PRICEReal-timePerpetual only
INDEX_PRICEReal-timePerpetual only
MARK_PRICE_KLINEReal-timePerpetual only
INDEX_KLINEReal-timePerpetual only
OPEN_INTERESTOn changePerpetual only

Keepalive: send { "ping": <timestamp_ms> } every 20 seconds; server replies { "pong": <timestamp_ms> }.

For all News Feed APIs (REST + WebSocket), see News Feed.


Symbol Format

{EXCHANGE}_{TYPE}_{BASE}_{QUOTE}
ExchangeTypeExamples
BINANCEPERPBINANCE_PERP_BTC_USDT, BINANCE_PERP_ETH_USDT

Channels marked "Perpetual only" reject SPOT symbols with error 11100.


Common Error Codes

Full error code reference →

REST

CodeMeaning
200000Success
2002Invalid API authorization
401018Order not found
401097Position quantity is 0
401117Order already completed

Market Data WebSocket

CodeMeaning
0Success
11100Invalid symbol
11210Unauthenticated symbol limit (5) exceeded
11220Authenticated symbol limit (50) exceeded
11250Symbol not currently supported
11260Request rate limit exceeded