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

For leaderboard/ranking data, see Track A Leaderboard API (GET /api/v1/tracka/ranking/self) and Track B Ranking — Self Query (GET /api/v1/trackb/ranking/self).

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 + level tier (portfolio key)
GET/api/v1/broker/feeRateBroker fee-rate tiers (Main Portfolio Key + READ)

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

For algo orders (TP/SL, TWAP, VWAP — conditional trigger orders), see Algo Orders.

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)

For full rate limits and endpoint details, see the official API documentation: https://apidocliquidity.readme.io/reference/place-order

REST Response Format

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

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


WebSocket

Connection Hosts

ServiceURL
Trading REST APIhttps://api.ltp-contest.com
News Feed REST APIhttps://api.ltp-contest.com
Market Data WebSocketwss://mds.ltp-contest.com/marketdata/v2/public
User Data WebSocketwss://wss.ltp-contest.com/v1/private
News Feed WebSocketwss://feeds.ltp-contest.com/feeds/v2/public

The competition hosts resolve to the official production API.

Market Data WebSocket

Market Data overview →

  • URL: wss://mds.ltp-contest.com/marketdata/v2/public
  • Supported exchanges: BINANCE / OKX
  • Compression: GZIP is enabled by default. Append ?binary=false to the URL to receive plain-text JSON frames. In Python, decompress GZIP frames with zlib.decompress(data, zlib.MAX_WBITS | 16).

Authentication (optional)

Unauthenticated connections are subject to lower rate limits. To authenticate, send a login message after connecting:

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

Field naming differs by message type: login uses action / args (object); subscribe / unsubscribe use event / arg (array). Timestamp: the Market Data WS accepts both 10-digit (seconds) and 13-digit (milliseconds) timestamps. The private (User Data) WS only accepts seconds.

Signature:

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

Success response:

{ "event": "login", "code": "200000", "msg": "success" }

Rate Limits

UnauthenticatedAuthenticated
Max connections per IP540
Max trading pairs per connection550
  • Subscribe rate: max 50 subscribe/unsubscribe requests per IP per second; exceeding returns error 11260.
  • Limits are counted by trading pair, not by channel — subscribing BBO + TICKER + TRADE for the same symbol counts as 1 pair.

Heartbeat

The server disconnects after 60 seconds of inactivity. Send {"ping": <timestamp_ms>} every ~20 seconds; the server replies {"pong": <timestamp_ms>}.

Symbol Format

{EXCHANGE}_{TYPE}_{BASE}_{QUOTE}EXCHANGE: BINANCE / OKX; TYPE: SPOT / PERP. Example: BINANCE_PERP_BTC_USDT.

Subscribe / Unsubscribe

Channel names are case-sensitive and must be uppercase.

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

Available Channels

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

Error Codes

CodeMeaning
200000Success
11100Invalid symbol (e.g. SPOT on a perpetual-only channel)
11101Invalid channel
11102Invalid parameter
11103Invalid request
11106Invalid access key
11107Invalid sign / signature
11108Invalid timestamp
11109Permission denied
11112Not subscribed
11200Too many connections per IP
11210Unauthenticated symbol limit (5) exceeded
11220Authenticated symbol limit (50) exceeded
11230Connection not authenticated
11240Subscribe rate limit exceeded
11250Symbol not currently supported
11260Request rate limit exceeded

User Data WebSocket

User Data Streams overview →

  • URL: wss://wss.ltp-contest.com/v1/private
  • Supported exchanges: BINANCE / OKX
  • Authentication required. After login the server auto-pushes orders, trades, assets, positions, and margin-call updates; the same connection can place, replace, and cancel orders.

Login

{
  "action": "login",
  "args": { "apiKey": "YOUR_ACCESS_KEY", "timestamp": "1778140847", "sign": "..." }
}
  • Timestamp: only 10-digit seconds are accepted; a 13-digit millisecond timestamp returns 601016.
  • Success: {"event":"login","code":0,"msg":""}
  • Failure: {"event":"login","code":601009,"msg":"Login failed"}
  • args.onlyTrade (optional, bool): when true, the connection is restricted to order operations only and no data streams are pushed.

Signature:

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

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"
  }
}

Rate Limits

ActionLimit
Login1 req/s per API key
Place Order1200 req / 60s
Replace Order300 req / 60s
Cancel Order1200 req / 60s
Cancel Orders (Batch)1200 req / 60s

Heartbeat

The server disconnects after 30 seconds of inactivity. Send the raw string ping every ~10 seconds; the server replies pong.

Available Pages

For full rate limits and endpoint details, see the official API documentation: https://apidocliquidity.readme.io/reference/place-order

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


Symbol Format

{EXCHANGE}_{TYPE}_{BASE}_{QUOTE}
ExchangeTypeExamples
BINANCEPERP / SPOTBINANCE_PERP_BTC_USDT, BINANCE_SPOT_BTC_USDT
OKXPERP / SPOTOKX_PERP_BTC_USDT, OKX_SPOT_BTC_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