Skip to main content

Spot Wallet & Trading Overview

ZTDX Spot is a multi-token wallet plus an order-book (CLOB) trading venue running alongside (but isolated from) the perpetual exchange. Staging lists one market, SOLUSDT (base SOL, quote USDT, tick_size 0.01, lot_size 0.001, maker and taker fees 10 bps). USDT can move between perp margin and the spot wallet.

Sub-systems​

Sub-systemGatePurpose
Spot walletSPOT_ENABLED=truePer-(user, token) balance ledger, deposits / withdrawals to BSC, internal USDT transfer between perp margin and spot.
Spot tradingSPOT_TRADING_ENABLED=true (in addition to SPOT_ENABLED)In-memory CLOB engine + REST + WebSocket for /spot/orders*, /spot/trades*, /spot/depth, /spot/klines, /spot/ticker/24hr.

Staging has the spot engine mounted for SOLUSDT. GET /api/v1/spot/depth?symbol=SOLUSDT returns the live book. Any other symbol returns HTTP 404 {"error":"MARKET_NOT_FOUND"}. GET /api/v1/spot/health is not mounted and returns 404.

Where to start​

If you want to…Read
Understand auth, base URL, JSON conventionsGeneral Info
Know what enum values are valid in requests / responsesEnums
Look up a string error codeError Codes
Place an orderTrading REST → New Order
Stream live depth + tradesWebSocket → General
Understand deposits / withdrawals on BSCDeposit Flow / Withdraw Flow

Service Endpoints​

EnvironmentREST baseWebSocket
Testnethttps://api.ztdxtest.xyz/api/v1wss://api.ztdxtest.xyz/spot/ws
Mainnet(not deployed yet)(not deployed yet)

On-Chain Components​

ItemNetworkAddress / Value
BSC chain idBSC Testnet97
Spot vault (ZtdxSpotVault V2)BSC Testnet (97)0x375365F809243728E520C25D779d7bF9878DEa8D
Spot USDT (ERC-20)BSC Testnet (97)0xe665c19c47c85cc0236345d9a3d64060b6a9ac19 (18 decimals)
Native BNBBSC Testnet (97)0x0000000000000000000000000000000000000000
Perp collateral (mock USDT)Arbitrum Sepolia (421614)0xe125f700924e33b77f3343a9dd8aac7c24b4f68e (6 decimals)

Trading subsystem at a glance​

The engine is a single Tokio task owning an in-memory order book per market (MVP: only SOLUSDT). Each fill commits to PostgreSQL in its own transaction. On restart, GTC limit orders are rebuilt from spot_orders; in-flight IOC and market orders are canceled with their lock refunded.

  • Tick size / lot size / min notional are per-market (see GET /spot/markets).
  • Self-trade prevention is DECLINE_TAKER: if your incoming order would cross your own resting order, the new order is rejected with SELF_TRADE.
  • Fees are configured per-market (maker_fee_bps / taker_fee_bps). Staging SOLUSDT is 10 / 10.

Notes​

  • The BSC listener catches up at ~30 blocks/sec from a cold start. After catch-up, deposits are credited within ~40 seconds (20 confirmations × ~2 s/block on BSC).
  • The WebSocket feed covers depth diff / trades / klines / ticker / per-user order + balance updates. REST polling still works as a fallback.