# Anboto API Reference > REST and WebSocket API reference for the Anboto algorithmic trading platform. Anboto is an institutional crypto execution platform: REST + WebSocket API for algo order execution (TWAP, VWAP, POV, Implementation Shortfall, Iceberg, Limit, Market) routed across 14+ CEXs and perp-DEXs (Binance, OKX, Bybit, Coinbase Prime, Hyperliquid, ...). Authentication uses API keys with HMAC-SHA256 or RSA-SHA256 request signing. Testnet (all fills simulated): https://api.testnet.anboto.xyz; production: https://api.pro.anboto.xyz. # Documentation # Anboto Trading API Execute orders across 14+ CEXs and perp-DEXs with Anboto's algorithmic strategies (TWAP, VWAP, POV, IS, Iceberg) through one REST + WebSocket API. ## Start here - [Get started](https://api-docs.anboto.xyz/resources/get-started/index.md) — keys, environments, signing, first order - [API Reference](https://api-docs.anboto.xyz/reference/index.md) — every REST endpoint, with code samples - [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md) — real-time order, trade, position and balance streams - [Request examples](https://api-docs.anboto.xyz/resources/examples/index.md) — downloadable JSON payloads per strategy - [Rate limits](https://api-docs.anboto.xyz/resources/rate-limits/index.md) ## Machine-readable - [OpenAPI spec](https://api-docs.anboto.xyz/spec/anboto-trading-api-2.0.yml) · [AsyncAPI spec](https://api-docs.anboto.xyz/spec/asynapi.yml) - [llms.txt](/llms.txt) · [llms-full.txt](/llms-full.txt) — every page also has a Markdown twin (append `.md`) Client examples: [github.com/anbotolabs/examples](https://github.com/anbotolabs/examples) # For AI agents Anboto ships first-party tooling that connects AI agents (Claude, Cursor, Codex, or any MCP-compatible client) to the Trading API — including the execution algos (TWAP, VWAP, POV, IS, ICEBERG) that make Anboto an execution desk rather than an order button. Everything lives in the open-source [anboto-agent-kit](https://github.com/anbotolabs/anboto-agent-kit) (MIT): - `@anboto/mcp` — MCP server (stdio) with 22 tools: order creation and monitoring, portfolio, market data, preflight validation and guardrails - `@anboto/core` — typed TypeScript client (HMAC/RSA signing included) - `anboto-trading` — a Claude Skill teaching agents algo selection, execution monitoring and TCA ## Quickstart (Claude Code) ``` claude mcp add anboto \ -e ANBOTO_API_KEY=your-key \ -e ANBOTO_API_SECRET=your-base64-secret \ -- npx -y @anboto/mcp --testnet ``` Claude Desktop / Cursor (JSON config): ``` { "mcpServers": { "anboto": { "command": "npx", "args": ["-y", "@anboto/mcp", "--testnet"], "env": { "ANBOTO_API_KEY": "your-key", "ANBOTO_API_SECRET": "your-base64-secret" } } } } ``` Then ask the agent: *"On testnet, buy 0.001 BTC on Binance via TWAP over 5 minutes, monitor to completion, and give me an execution report."* ## Guardrails API keys stay on your machine (env vars only — never in the model context). Optional flags, all fail-closed: | Flag | Effect | | --------------------------------- | -------------------------------------------- | | `--testnet` | Simulated environment (recommended to start) | | `--read-only` | Trading tools are not registered at all | | `--max-order-notional=50000` | Reject orders above an estimated notional | | `--allowed-exchanges=BINANCE,OKX` | Exchange allowlist | | `--allowed-symbols=BTC/USDT` | Symbol allowlist | ## Machine-readable docs - [llms.txt](/llms.txt) index · full docs as one file: [llms-full.txt](/llms-full.txt) - OpenAPI (REST): [anboto-trading-api-2.0.yml](https://api-docs.anboto.xyz/spec/anboto-trading-api-2.0.yml) - AsyncAPI (WebSocket): [asynapi.yml](https://api-docs.anboto.xyz/spec/asynapi.yml) - Every page on this site has a Markdown twin — append `.md` to its URL # Error reference ## REST Failed requests return an HTTP error status; order-level failures also carry an `error_code` (`ApiErrorCode`) in the response body (`OrderSummary.error_code`, order status messages). ### HTTP statuses | Status | Meaning | | ------ | ------------------------------------------------------------------------------------------- | | `401` | Unauthorized — missing/invalid API key, bad signature, or timestamp outside `X-RECV-WINDOW` | | `429` | Rate limit exceeded — back off and retry | ### `error_code` values **Authentication / request** | Code | Description | | ---------------------- | ---------------------------------------- | | `AUTHENTICATION_ERROR` | Key not recognized or not permitted | | `INVALID_SIGNATURE` | `X-SIGN` does not match the payload | | `INVALID_API_KEY` | Unknown API key | | `INVALID_TIMESTAMP` | `X-TIMESTAMP` outside the receive window | | `INVALID_REQUEST` | Malformed request | | `INVALID_PARAM` | A parameter failed validation | | `BATCH_OVERSIZE` | Too many orders in one batch call | **Order validation** | Code | Description | | ------------------------ | --------------------------------------------------------- | | `INVALID_ORDER` | Order rejected at validation | | `INVALID_QUANTITY` | Quantity missing, non-positive, or below exchange minimum | | `QUANTITY_EXCEED` | Quantity above the allowed maximum | | `INVALID_SYMBOL` | Symbol unknown on the target exchange | | `INVALID_EXCHANGE` | Exchange not supported or not connected for the account | | `INVALID_TRADE_STRATEGY` | Unknown `strategy` value | | `INVALID_LIMIT_PRICE` | Limit price fails validation | | `INVALID_WOULD_PRICE` | Would price fails validation | | `INVALID_TRIGGER_PRICE` | Trigger price fails validation | | `INVALID_END_TIME` | End time in the past or before start time | | `INVALID_TRADE_TIME` | Execution window fails validation | | `INVALID_FEE` | Fee parameter fails validation | **Execution / exchange** | Code | Description | | ------------------------------------- | -------------------------------------------------------- | | `INSUFFICIENT_FUNDS` | Not enough balance on the venue | | `EXCHANGE_ERROR` | Exchange rejected the request (unmapped venue error) | | `EXCHANGE_NOT_AVAILABLE` | Venue unreachable or in maintenance | | `NETWORK_ERROR` | Transient connectivity failure | | `SLIPPAGE_EXCEEDED` | Fill would exceed the slippage tolerance | | `EXPIRY_REACHED` | Order expired before completing | | `PARENT_ORDER_WAS_TERMINATED` | Child rejected because the parent was cancelled/finished | | `MAX_FEE_PER_GAS_IS_TOO_LOW` | DEX: gas fee cap too low | | `MAX_PRIORITY_FEE_PER_GAS_IS_TOO_LOW` | DEX: priority fee too low | **Platform** | Code | Description | | --------------------- | ------------------------------------------------ | | `RATE_LIMIT_EXCEEDED` | Account request budget exhausted | | `DDOS_PROTECTION` | Venue anti-abuse triggered — reduce request rate | | `EMS_INSTANCES_DOWN` | Execution engine temporarily unavailable | | `SYSTEM_ERROR` | Internal error | | `SYSTEM_BUSY` | Platform under load — retry | | `OTHER` | Unclassified | ## WebSocket Every subscribe/unsubscribe gets a `{code, message}` response: | Code | Meaning | | ------ | ----------------------------------------------------------------------------------------------------- | | `0` | OK — ack; `message` echoes your request | | `5` | `RATE_LIMIT_EXCEEDED` — see [Rate limits](https://api-docs.anboto.xyz/resources/rate-limits/index.md) | | `8054` | `exchange` missing or invalid | | `7002` | Invalid request — unparseable message or missing `method` | | `7001` | Internal error — the subscription stream terminated; re-subscribe | Close codes: `1001` idle timeout (no client message for 5 min), `1008` policy violation (rate limits, invalid listenKey). # Request examples Ready-to-send JSON payloads for the most common calls. Values are illustrative — adjust symbol, size and times. Field reference: the endpoint pages linked under each example. Full client examples (signing included): [github.com/anbotolabs/examples](https://github.com/anbotolabs/examples). All create-order payloads go to [Create order](https://api-docs.anboto.xyz/reference/create-order/index.md) unless stated otherwise. ## TWAP Spread 0.5 BTC over one hour, hybrid style, randomized slices. `duration_seconds` is required for TWAP and VWAP. [Download](https://api-docs.anboto.xyz/examples/create-order-twap.json) ``` { "client_order_id": "ORD-2026-0001", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "0.5", "strategy": "TWAP", "limit_price": "62000", "start_time": "2026-09-01T10:00:00Z", "end_time": "2026-09-01T11:00:00Z", "params": { "duration_seconds": "3600", "trading_style": "HYBRID", "randomize_amount": true } } ``` ## VWAP Four-hour passive VWAP. [Download](https://api-docs.anboto.xyz/examples/create-order-vwap.json) ``` { "client_order_id": "ORD-2026-0002", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "0.5", "strategy": "VWAP", "limit_price": "62000", "start_time": "2026-09-01T10:00:00Z", "end_time": "2026-09-01T14:00:00Z", "params": { "duration_seconds": "14400", "trading_style": "PASSIVE" } } ``` ## Limit (post-only) Rest a limit order; `post_only` rejects any child that would cross. [Download](https://api-docs.anboto.xyz/examples/create-order-limit.json) ``` { "client_order_id": "ORD-2026-0003", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "0.5", "strategy": "LIMIT", "limit_price": "60500", "params": { "post_only": true } } ``` ## Market (reduce-only, perpetual) Close 0.25 BTC of a perp position at market. [Download](https://api-docs.anboto.xyz/examples/create-order-market.json) ``` { "client_order_id": "ORD-2026-0004", "exchange": "BINANCE", "symbol": "BTC/USDT:USDT", "asset_category": "FUTURE", "side": "SELL", "quantity": "0.25", "strategy": "MARKET", "params": { "reduce_only": true } } ``` ## Iceberg Show 0.25 BTC clips of a 5 BTC order. [Download](https://api-docs.anboto.xyz/examples/create-order-iceberg.json) ``` { "client_order_id": "ORD-2026-0005", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "5", "strategy": "ICEBERG", "limit_price": "61000", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.25", "params": { "trading_style": "PASSIVE", "randomize_amount": true } } ``` ## Implementation shortfall Urgency drives the schedule (`LOW` / `MEDIUM` / `HIGH`). [Download](https://api-docs.anboto.xyz/examples/create-order-is.json) ``` { "client_order_id": "ORD-2026-0006", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "0.5", "strategy": "IS", "limit_price": "62500", "params": { "urgency": "HIGH" } } ``` ## Scale (ladder) Ten resting orders laddered from 61 000 down to 59 000. [Download](https://api-docs.anboto.xyz/examples/create-order-scale.json) ``` { "client_order_id": "ORD-2026-0007", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "2", "strategy": "SCALE", "clip_size_type": "ORDER_COUNT", "clip_size_val": "10", "params": { "start_ladder_price": "61000", "end_ladder_price": "59000", "ladder_direction": "downwards", "ladder_profile": "linear", "size_skew": 1 } } ``` ## Triggered order TWAP that starts only once the price trades above 63 000. [Download](https://api-docs.anboto.xyz/examples/create-order-trigger.json) ``` { "client_order_id": "ORD-2026-0008", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "0.5", "strategy": "TWAP", "limit_price": "64000", "params": { "duration_seconds": "1800", "trigger": { "trigger_price": "63000", "trigger_condition": "ABOVE" } } } ``` ## Multi-leg pair Buy BTC / sell ETH, 10 000 USD each leg, BTC leading — [Create multi legs order](https://api-docs.anboto.xyz/reference/create-multi-legs-order/index.md). [Download](https://api-docs.anboto.xyz/examples/create-multi-legs-pair.json) ``` { "client_order_id": "PAIR-2026-0001", "algo": "PAIR", "legs": [ { "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "target_value": "10000", "ccy": "USD", "limit_price": "62000", "strategy": "TWAP", "params": { "duration_seconds": "1800", "trading_style": "HYBRID", "is_leading": true } }, { "exchange": "BINANCE", "symbol": "ETH/USDT", "asset_category": "SPOT", "side": "SELL", "target_value": "10000", "ccy": "USD", "limit_price": "2400", "strategy": "TWAP", "params": { "duration_seconds": "1800", "trading_style": "HYBRID", "is_leading": false } } ], "start_time": "2026-09-01T10:00:00Z", "end_time": "2026-09-01T10:30:00Z" } ``` ## Batch of orders Three TWAPs in one call — [Create many orders](https://api-docs.anboto.xyz/reference/create-many-orders/index.md). [Download](https://api-docs.anboto.xyz/examples/create-many-orders.json) ``` { "orders": [ { "client_order_id": "BASKET-1-BTC", "exchange": "BINANCE", "symbol": "BTC/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "0.5", "strategy": "TWAP", "params": { "duration_seconds": "3600" } }, { "client_order_id": "BASKET-1-ETH", "exchange": "BINANCE", "symbol": "ETH/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "8", "strategy": "TWAP", "params": { "duration_seconds": "3600" } }, { "client_order_id": "BASKET-1-SOL", "exchange": "BINANCE", "symbol": "SOL/USDT", "asset_category": "SPOT", "side": "BUY", "quantity": "150", "strategy": "TWAP", "params": { "duration_seconds": "3600" } } ] } ``` ## Cancel many By Anboto id or by your client id — [Cancel many](https://api-docs.anboto.xyz/reference/cancel-many/index.md). [Download](https://api-docs.anboto.xyz/examples/cancel-many.json) ``` { "orders": [ { "order_id": 123456 }, { "client_order_id": "BASKET-1-ETH" } ] } ``` # Get started Anboto's Trading API executes orders across 14+ CEXs and perp-DEXs with algorithmic strategies (TWAP, VWAP, POV, IS, Iceberg). This guide takes you from zero to a first order. ## 1. Generate an API key Create keys in the [trading app](https://pro.anboto.xyz/settings/api). Two types: | Type | Signing | Notes | | ---------------- | ----------- | --------------------------------------------------------- | | System-generated | HMAC-SHA256 | Anboto gives you key + secret | | Self-generated | RSA-SHA256 | You keep the private key; Anboto only gets the public key | ## 2. Pick an environment | Environment | REST base | WebSocket | | ----------- | ------------------------------------------------------------------ | ---------------------------------------- | | Production | `https://api.pro.anboto.xyz` | `wss://api.pro.anboto.xyz/api/v2/ws` | | Testnet | `https://api.testnet.anboto.xyz` — simulated fills, no real trades | `wss://api.testnet.anboto.xyz/api/v2/ws` | ## 3. Sign requests Every authenticated call carries `X-API-KEY`, `X-TIMESTAMP` (ms), `X-SIGN`, optional `X-RECV-WINDOW` (default 5000 ms). String to sign: `timestamp + api_key + recv_window + (queryString | jsonBody)` — see [Authentication](https://api-docs.anboto.xyz/reference/index.md) for per-language code. ## 4. Place a first order Send a small TWAP on testnet: [Create order](https://api-docs.anboto.xyz/reference/create-order/index.md) — ready payloads in [Request examples](https://api-docs.anboto.xyz/resources/examples/index.md). Watch it fill in real time over the [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). Client examples: [github.com/anbotolabs/examples](https://github.com/anbotolabs/examples) # Rate limits ## REST Authenticated REST endpoints return `429 Too Many Requests` when your account exceeds its request budget — back off and retry. Signature timestamps outside `X-RECV-WINDOW` (default 5000 ms) are rejected with `401`. ## WebSocket Per connection and per account (defaults; environment-configurable): | Limit | Default | On breach | | ----------------------------------------- | ------------- | --------------------------------------------------------------------------------------- | | Concurrent connections per account | 5 | handshake closed (1008) with a code-5 error frame | | Messages per second per connection | 10 (burst 20) | code-5 error frame per dropped message; sustained flooding closes the connection (1008) | | Subscriptions per connection (all topics) | 50 | code-5 error frame | | Market data subscriptions per connection | 20 | error frame ("limit reached") | Error code `5` = `RATE_LIMIT_EXCEEDED`. # WebSocket Real-time streams: order status, child orders, trades, positions, position risk, balances, market data. **Read-only** — orders are placed and cancelled through the REST API. ## Authentication (listenKey) 1. Call `GET /api/v2/trading/listenKey` (signed like any REST call). Response body = listenKey, a JWT valid **1 hour**. 1. Connect to `wss:///api/v2/ws?listenKey=` — or send `Authorization: Bearer ` as a handshake header (keeps the token out of proxy logs). Invalid/expired listenKey → handshake rejected with HTTP 401. Checked only at handshake; established connections are not dropped on expiry, but every reconnect needs a fresh key. ## Keep-alive Server sends `{"topic":"ping"}` every minute — reply `{"topic":"pong"}`. No client message for 5 minutes → close 1001. Re-subscribe on every reconnect (subscriptions are per-connection). ## Subscribing ``` {"topic": "order", "exchange": "binance", "method": "subscribe"} ``` | Parameter | Description | | ---------- | ----------------------------------------------------------------------------------------------------------- | | `topic` | `order`, `child_order`, `trade`, `position`, `position_risk`, `balance`, `ticker`, `ohlcv`, `open_interest` | | `exchange` | required; any trading exchange, case-insensitive | | `method` | `subscribe` / `unsubscribe` | One subscription per `(topic, exchange)` pair per connection. ## Errors | Code | Meaning | | ------ | --------------------------------------------------------- | | `0` | OK — ack; `message` echoes your request | | `5` | rate limit exceeded | | `8054` | `exchange` missing or invalid | | `7002` | invalid request — unparseable message or missing `method` | | `7001` | internal error — stream terminated; re-subscribe | # Change notices Numbered notices for changes that can affect API integrations. Breaking changes get a notice **before** rollout; subscribe by watching this page (every page also has a Markdown twin — append `.md` to its URL). | Notice | Date | Type | Summary | | ------ | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | CH-002 | 2026-05 | Breaking | `api.trade.anboto.xyz` retired. Production REST and WebSocket hosts are `api.pro.anboto.xyz` / `wss://api.pro.anboto.xyz/api/v2/ws`. | | CH-001 | 2026-08-31 | Info | API documentation moved to this site (api-docs.anboto.xyz). The former GitHub Pages site remains available during the transition; specs and content are identical. No API behavior change. | ## CH-002 — `api.trade.anboto.xyz` retired **Type:** breaking · **Date:** May 2026 The legacy production host `api.trade.anboto.xyz` no longer resolves. Point REST calls at `https://api.pro.anboto.xyz` and WebSocket connections at `wss://api.pro.anboto.xyz/api/v2/ws`. Paths, authentication and signing are unchanged — the host is the only difference. Testnet (`api.testnet.anboto.xyz`) is unaffected. ## CH-001 — Documentation site migration **Type:** informational · **Date:** 2026-08-31 API docs now live at `api-docs.anboto.xyz`, generated directly from the OpenAPI/AsyncAPI specs. The GitHub Pages site (`anbotolabs.github.io/anboto-api-docs`) stays online until cutover completes, then redirects here. Spec URLs on this site: [OpenAPI](https://api-docs.anboto.xyz/spec/anboto-trading-api-2.0.yml) · [AsyncAPI](https://api-docs.anboto.xyz/spec/asynapi.yml). No endpoint, auth, or schema change. # API Reference — Anboto Trading API v2.0 [Download OpenAPI spec](https://api-docs.anboto.xyz/spec/anboto-trading-api-2.0.yml) · [AsyncAPI (WebSocket) spec](https://api-docs.anboto.xyz/spec/asynapi.yml) ## Authentication Endpoints marked **ApiKeyAuth** need four headers on every request: | Header | | | | --------------- | -------- | -------------------------------------- | | `X-API-KEY` | required | your API key | | `X-TIMESTAMP` | required | milliseconds since epoch | | `X-SIGN` | required | signature, standard Base64 | | `X-RECV-WINDOW` | | request validity in ms, default `5000` | **Signing.** Build `timestamp + api_key + recv_window + (queryString | jsonBody)` — query string in alphabetical key order, exactly as sent. Base64-decode the secret (standard Base64 if it contains `+`, `/` or ends with `=`, otherwise URL-safe). Sign with HMAC-SHA256 (system-generated keys) or RSA-SHA256 (self-generated keys). `X-SIGN` is the standard Base64 of the signature, not hex. Keys: [pro.anboto.xyz/settings/api](https://pro.anboto.xyz/settings/api). Every sample on this site calls `signed_headers(body)` / `signed_headers_query(params)` — the helper for each language, HMAC variant: ``` BASE=https://api.pro.anboto.xyz # signed_headers "" -> prints curl -H flags signed_headers() { local ts=$(($(date +%s) * 1000)) local key_hex=$(printf '%s' "$API_SECRET" | base64 -d | xxd -p -c 256) local sign=$(printf '%s' "${ts}${API_KEY}5000$1" \ | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$key_hex" -binary | base64) printf -- '-H "X-API-KEY: %s" -H "X-TIMESTAMP: %s" -H "X-RECV-WINDOW: 5000" -H "X-SIGN: %s"' \ "$API_KEY" "$ts" "$sign" } # GET: curl "$BASE/api/v2/trading/balance?exchange=BINANCE" $(signed_headers "exchange=BINANCE") # POST: curl -X POST "$BASE/api/v2/trading/order/create" $(signed_headers "$body") \ # -H "Content-Type: application/json" -d "$body" ``` ``` import base64, hashlib, hmac, json, time import requests BASE = "https://api.pro.anboto.xyz" RECV_WINDOW = "5000" def _secret_bytes(secret: str) -> bytes: if any(c in secret for c in "+/") or secret.endswith("="): return base64.b64decode(secret) return base64.urlsafe_b64decode(secret + "=" * (-len(secret) % 4)) def _headers(payload: str) -> dict: ts = str(int(time.time() * 1000)) digest = hmac.new(_secret_bytes(API_SECRET), (ts + API_KEY + RECV_WINDOW + payload).encode(), hashlib.sha256).digest() return {"X-API-KEY": API_KEY, "X-TIMESTAMP": ts, "X-RECV-WINDOW": RECV_WINDOW, "X-SIGN": base64.b64encode(digest).decode()} def signed_headers(body: dict) -> dict: # POST: sign the JSON body you send return {**_headers(json.dumps(body)), "Content-Type": "application/json"} def signed_headers_query(params: dict) -> dict: # GET: sign the sorted query string return _headers("&".join(f"{k}={v}" for k, v in sorted(params.items()))) ``` ``` use base64::{engine::general_purpose::STANDARD, Engine}; use hmac::{Hmac, Mac}; use reqwest::header::HeaderMap; use sha2::Sha256; const BASE: &str = "https://api.pro.anboto.xyz"; fn headers(payload: &str) -> HeaderMap { let ts = chrono::Utc::now().timestamp_millis().to_string(); let key = STANDARD.decode(std::env::var("API_SECRET").unwrap()).unwrap(); let mut mac = Hmac::::new_from_slice(&key).unwrap(); mac.update(format!("{ts}{}5000{payload}", std::env::var("API_KEY").unwrap()).as_bytes()); let sign = STANDARD.encode(mac.finalize().into_bytes()); let mut h = HeaderMap::new(); h.insert("X-API-KEY", std::env::var("API_KEY").unwrap().parse().unwrap()); h.insert("X-TIMESTAMP", ts.parse().unwrap()); h.insert("X-RECV-WINDOW", "5000".parse().unwrap()); h.insert("X-SIGN", sign.parse().unwrap()); h } fn signed_headers(payload: &serde_json::Value) -> HeaderMap { headers(&payload.to_string()) } fn signed_headers_query(params: &std::collections::BTreeMap<&str, &str>) -> HeaderMap { headers(¶ms.iter().map(|(k, v)| format!("{k}={v}")).collect::>().join("&")) } ``` ``` const BASE = "https://api.pro.anboto.xyz" func headers(payload string) map[string]string { ts := strconv.FormatInt(time.Now().UnixMilli(), 10) key, _ := base64.StdEncoding.DecodeString(os.Getenv("API_SECRET")) mac := hmac.New(sha256.New, key) mac.Write([]byte(ts + os.Getenv("API_KEY") + "5000" + payload)) return map[string]string{ "X-API-KEY": os.Getenv("API_KEY"), "X-TIMESTAMP": ts, "X-RECV-WINDOW": "5000", "X-SIGN": base64.StdEncoding.EncodeToString(mac.Sum(nil)), } } func signedHeaders(body string) map[string]string { return headers(body) } func signedHeadersQuery(q url.Values) map[string]string { keys := make([]string, 0, len(q)) for k := range q { keys = append(keys, k) } sort.Strings(keys) parts := make([]string, 0, len(keys)) for _, k := range keys { parts = append(parts, k+"="+q.Get(k)) } return headers(strings.Join(parts, "&")) } ``` ``` static final String BASE = "https://api.pro.anboto.xyz"; static HttpRequest.Builder signed(String path, String payload) throws Exception { String ts = Long.toString(System.currentTimeMillis()); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(Base64.getDecoder().decode(apiSecret), "HmacSHA256")); String sign = Base64.getEncoder().encodeToString( mac.doFinal((ts + apiKey + "5000" + payload).getBytes(StandardCharsets.UTF_8))); return HttpRequest.newBuilder(URI.create(BASE + path)) .header("X-API-KEY", apiKey).header("X-TIMESTAMP", ts) .header("X-RECV-WINDOW", "5000").header("X-SIGN", sign); } static HttpRequest signedPost(String path, String jsonBody) throws Exception { return signed(path, jsonBody).header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(jsonBody)).build(); } static HttpRequest signedGet(String pathWithQuery) throws Exception { // query keys sorted String query = pathWithQuery.contains("?") ? pathWithQuery.substring(pathWithQuery.indexOf('?') + 1) : ""; return signed(pathWithQuery, query).GET().build(); } ``` ``` import { createHmac } from "node:crypto"; const BASE = "https://api.pro.anboto.xyz"; function headers(payload: string): Record { const ts = Date.now().toString(); const sign = createHmac("sha256", Buffer.from(process.env.API_SECRET!, "base64")) .update(ts + process.env.API_KEY + "5000" + payload).digest("base64"); return { "X-API-KEY": process.env.API_KEY!, "X-TIMESTAMP": ts, "X-RECV-WINDOW": "5000", "X-SIGN": sign }; } export const signedHeaders = (body: unknown) => ({ ...headers(JSON.stringify(body)), "Content-Type": "application/json" }); export const signedHeadersQuery = (params: Record) => headers(Object.keys(params).sort().map((k) => `${k}=${params[k]}`).join("&")); ``` ``` const val BASE = "https://api.pro.anboto.xyz" fun signed(path: String, payload: String): HttpRequest.Builder { val ts = System.currentTimeMillis().toString() val mac = Mac.getInstance("HmacSHA256").apply { init(SecretKeySpec(Base64.getDecoder().decode(apiSecret), "HmacSHA256")) } val sign = Base64.getEncoder().encodeToString(mac.doFinal((ts + apiKey + "5000" + payload).toByteArray())) return HttpRequest.newBuilder(URI.create(BASE + path)) .header("X-API-KEY", apiKey).header("X-TIMESTAMP", ts) .header("X-RECV-WINDOW", "5000").header("X-SIGN", sign) } fun signedPost(path: String, jsonBody: String): HttpRequest = signed(path, jsonBody).header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(jsonBody)).build() fun signedGet(pathWithQuery: String): HttpRequest = // query keys sorted signed(pathWithQuery, pathWithQuery.substringAfter('?', "")).GET().build() ``` ``` const std::string BASE = "https://api.pro.anboto.xyz"; cpr::Header headers(const std::string& payload) { std::string ts = std::to_string(std::chrono::duration_cast( std::chrono::system_clock::now().time_since_epoch()).count()); std::string key = base64_decode(std::getenv("API_SECRET")); std::string msg = ts + std::getenv("API_KEY") + "5000" + payload; unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int len = 0; HMAC(EVP_sha256(), key.data(), key.size(), reinterpret_cast(msg.data()), msg.size(), digest, &len); return cpr::Header{{"X-API-KEY", std::getenv("API_KEY")}, {"X-TIMESTAMP", ts}, {"X-RECV-WINDOW", "5000"}, {"X-SIGN", base64_encode(digest, len)}}; } cpr::Header signedHeaders(const std::string& body) { return headers(body); } cpr::Header signedHeadersQuery(const std::map& params) { // std::map = sorted std::string qs; for (auto& [k, v] : params) qs += (qs.empty() ? "" : "&") + k + "=" + v; return headers(qs); } ``` ``` import { createHmac } from "node:crypto"; const BASE = "https://api.pro.anboto.xyz"; function headers(payload) { const ts = Date.now().toString(); const sign = createHmac("sha256", Buffer.from(process.env.API_SECRET, "base64")) .update(ts + process.env.API_KEY + "5000" + payload).digest("base64"); return { "X-API-KEY": process.env.API_KEY, "X-TIMESTAMP": ts, "X-RECV-WINDOW": "5000", "X-SIGN": sign }; } export const signedHeaders = (body) => ({ ...headers(JSON.stringify(body)), "Content-Type": "application/json" }); export const signedHeadersQuery = (params) => headers(Object.keys(params).sort().map((k) => `${k}=${params[k]}`).join("&")); ``` Ready-made payloads: [Request examples](https://api-docs.anboto.xyz/resources/examples/index.md). Full clients: [github.com/anbotolabs/examples](https://github.com/anbotolabs/examples). ## Trading | | Endpoint | | | ---- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | GET | `/api/v2/trading/balance` | [Get balance](https://api-docs.anboto.xyz/reference/get-balance/index.md) | | GET | `/api/v2/trading/listenKey` | [Listen key](https://api-docs.anboto.xyz/reference/listen-key/index.md) | | GET | `/api/v2/trading/order/byId` | [Get orders](https://api-docs.anboto.xyz/reference/get-orders/index.md) | | POST | `/api/v2/trading/order/cancel` | [Cancel order](https://api-docs.anboto.xyz/reference/cancel-order/index.md) | | GET | `/api/v2/trading/order/cancelAll` | [Cancel all open orders](https://api-docs.anboto.xyz/reference/cancel-all-open-orders/index.md) | | POST | `/api/v2/trading/order/cancelMany` | [Cancel many](https://api-docs.anboto.xyz/reference/cancel-many/index.md) | | POST | `/api/v2/trading/order/create` | [Create order](https://api-docs.anboto.xyz/reference/create-order/index.md) | | POST | `/api/v2/trading/order/createMany` | [Create many orders](https://api-docs.anboto.xyz/reference/create-many-orders/index.md) | | POST | `/api/v2/trading/order/create_multiLegs` | [Create multi legs order](https://api-docs.anboto.xyz/reference/create-multi-legs-order/index.md) | | POST | `/api/v2/trading/order/createMany/multilegs` | [Create many multi legs orders](https://api-docs.anboto.xyz/reference/create-many-multi-legs-orders/index.md) | | GET | `/api/v2/trading/order/find` | [Find orders](https://api-docs.anboto.xyz/reference/find-orders/index.md) | | GET | `/api/v2/trading/order/open` | [Get open orders](https://api-docs.anboto.xyz/reference/get-open-orders/index.md) | | GET | `/api/v2/trading/position` | [Get position](https://api-docs.anboto.xyz/reference/get-position/index.md) | | GET | `/api/v2/trading/userTrades` | [Get user trades](https://api-docs.anboto.xyz/reference/get-user-trades/index.md) | ## Market data | | Endpoint | | | --- | --------------------------------- | ------------------------------------------------------------------------------------------- | | GET | `/api/v2/data/exchanges` | [Exchanges](https://api-docs.anboto.xyz/reference/exchanges/index.md) | | GET | `/api/v2/data/fundingRateHistory` | [Funding rate history](https://api-docs.anboto.xyz/reference/funding-rate-history/index.md) | | GET | `/api/v2/data/instruments` | [Instruments](https://api-docs.anboto.xyz/reference/instruments/index.md) | | GET | `/api/v2/data/lastFundingRates` | [Last funding rates](https://api-docs.anboto.xyz/reference/last-funding-rates/index.md) | ## Status | | Endpoint | | | --- | -------------- | --------------------------------------------------------------- | | GET | `/status/ping` | [Status](https://api-docs.anboto.xyz/reference/status/index.md) | ## WebSocket streams [WebSocket overview](https://api-docs.anboto.xyz/reference/ws-index/index.md) — endpoints, listenKey auth, keep-alive, subscribe format. | | Topic | | | --- | ------------------------ | -------------------------------------------------------------------------------------- | | WS | `position` | [position](https://api-docs.anboto.xyz/reference/ws-position/index.md) | | WS | `balance` | [balance](https://api-docs.anboto.xyz/reference/ws-balance/index.md) | | WS | `order` | [order](https://api-docs.anboto.xyz/reference/ws-order/index.md) | | WS | `trade` | [trade](https://api-docs.anboto.xyz/reference/ws-trade/index.md) | | WS | `child_order` | [child_order](https://api-docs.anboto.xyz/reference/ws-child-order/index.md) | | WS | `position_risk` | [position_risk](https://api-docs.anboto.xyz/reference/ws-position-risk/index.md) | | WS | `ticker` | [ticker](https://api-docs.anboto.xyz/reference/ws-ticker/index.md) | | WS | `ohlcv` | [ohlcv](https://api-docs.anboto.xyz/reference/ws-ohlcv/index.md) | | WS | `open_interest` | [open_interest](https://api-docs.anboto.xyz/reference/ws-open-interest/index.md) | | WS | `Keep-alive (ping/pong)` | [Keep-alive (ping/pong)](https://api-docs.anboto.xyz/reference/ws-keep-alive/index.md) | ## Schemas All request/response objects: [Schemas](https://api-docs.anboto.xyz/reference/schemas/index.md) # Cancel all open orders GET `https://api.pro.anboto.xyz/api/v2/trading/order/cancelAll` All orders that are not in a terminal state will be cancelled **ApiKeyAuth** required. ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | ----------------------------------------------- | | 200 | The list of open orders that will be cancelled. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderDetailsList](https://api-docs.anboto.xyz/reference/schemas/#orderdetailslist) `orders` array\[[OrderDetails](https://api-docs.anboto.xyz/reference/schemas/#orderdetails)\] required The list of order details for separate orders. `orders[].order_id` integer The Anboto generated order id Example: `123456` `orders[].client_order_id` string The client provided order id Example: `xxx-yyy-zzz` `orders[].symbol` string The order symbol in Anboto's symbology `orders[].status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orders[].asset_class` [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) The Asset category of the order. — `SPOT`, `FUTURE` Example: `SPOT` `orders[].exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) `orders[].strategy` [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` Example: `VWAP` `orders[].start_time` number The time when the order start trading from epoch time in ms `orders[].end_time` number The time when the order is finished from epoch time in ms `orders[].filled_quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].leaves_quantity` number required The absolute amount of the order quantity remaining to be filled Example: `0` `orders[].side` [enum](https://api-docs.anboto.xyz/reference/schemas/#side) The side of the book to trade. — `BUY`, `SELL` `orders[].last_quantity` number required The last qty received in a fill from the exchange Example: `0` `orders[].last_price` number required The last price executed on the exchange Example: `0` `orders[].average_price` number required The average execution price of the order Example: `0` `orders[].trades` array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] The list of trades associated with this order when include_trades=true `orders[].trades[].trade_id` integer The trade id from exchange Example: `123456` `orders[].trades[].symbol` string required The order symbol using Anboto symbology `orders[].trades[].exchangeOrderId` string The order id from exchange `orders[].trades[].clientOrderId` string The client order id `orders[].trades[].quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].trades[].price` number required The traded price Example: `0` `orders[].trades[].direction` string The direction of the trade `orders[].trades[].makerOrTaker` string The trade is from Maker or Taker `orders[].trades[].execTime` integer The time where the trade executed `orders[].trades[].fee` number The fee charged on the trade `orders[].trades[].feeCurrency` string The asset type the fee was charged in `orders[].fees_infos` object Aggregated fees per currency when include_fees=true ``` curl -X GET "$BASE/api/v2/trading/order/cancelAll" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` r = requests.get(f"{BASE}/api/v2/trading/order/cancelAll", headers=signed_headers_query({})) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/order/cancelAll")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/order/cancelAll", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/order/cancelAll"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/cancelAll`, { method: "GET", headers: signedHeadersQuery(params), }); const data: OrderDetailsList = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/order/cancelAll") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/order/cancelAll"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/cancelAll`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzz", "symbol": "string", "status": "PENDING_NEW", "asset_class": "SPOT", "exchange": "BINANCE", "strategy": "TWAP", "start_time": 0.0, "end_time": 0.0, "filled_quantity": 0, "leaves_quantity": 0, "side": "BUY", "last_quantity": 0, "last_price": 0, "average_price": 0, "trades": [ {} ], "fees_infos": {} } ] } ``` # Cancel many POST `https://api.pro.anboto.xyz/api/v2/trading/order/cancelMany` This will initiate the order cancellations and set the status of all orders to pending cancel. For the finalized state call /order?orderId=xxx **ApiKeyAuth** required. ### Body params `orders` array\[[CancelUpstreamOrderRequest](https://api-docs.anboto.xyz/reference/schemas/#cancelupstreamorderrequest)\] required The list of parent cancellation requests ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | ----------------------------------------------- | | 200 | Cancellation request processed and in progress. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderSummary](https://api-docs.anboto.xyz/reference/schemas/#ordersummary) `order_id` integer The Anboto assigned order identifier `client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `created_at` date-time required The time in UTC when the order was created Example: `2024-01-22T22:05:00Z` `message` string Any additional information, usually if the order was rejected `error_code` [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) Example: `INVALID_ORDER` ``` body='{ "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" } ] }' curl -X POST "$BASE/api/v2/trading/order/cancelMany" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" \ -H "Content-Type: application/json" -d "$body" ``` ``` payload = { "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" } ] } r = requests.post(f"{BASE}/api/v2/trading/order/cancelMany", data=json.dumps(payload) headers=signed_headers(payload)) print(r.json()) ``` ``` let payload = serde_json::json!({ "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" } ] }); let resp = client .post(format!("{BASE}/api/v2/trading/order/cancelMany")) .headers(signed_headers(&payload)) .json(&payload) .send()?; println!("{}", resp.text()?); ``` ``` payload := map[string]any{ "orders": []any{ map[string]any{ "order_id": 123456, "client_order_id": "xxx-yyy-zzzz", }, }, } body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", BASE+"/api/v2/trading/order/cancelMany", bytes.NewReader(body)) for k, v := range signedHeaders(string(body)) { req.Header.Set(k, v) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` String jsonBody = mapper.writeValueAsString(payload); HttpResponse resp = client.send( signedPost("/api/v2/trading/order/cancelMany", jsonBody), HttpResponse.BodyHandlers.ofString()); ``` ``` const payload: CancelManyUpstreamOrdersRequest = { "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" } ] }; const res = await fetch(`${BASE}/api/v2/trading/order/cancelMany`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); const data: OrderSummary = await res.json(); ``` ``` val jsonBody = mapper.writeValueAsString(payload) val request = signedPost("/api/v2/trading/order/cancelMany", jsonBody) val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` std::string body = R"({ "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" } ] })"; cpr::Response r = cpr::Post( cpr::Url{BASE + "/api/v2/trading/order/cancelMany"}, signedHeaders(body), cpr::Header{{"Content-Type", "application/json"}}, cpr::Body{body}); std::cout << r.text << std::endl; ``` ``` const payload = { "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" } ] }; const res = await fetch(`${BASE}/api/v2/trading/order/cancelMany`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); console.log(await res.json()); ``` **Response** 200 ``` { "order_id": 0, "client_order_id": "ABC-12345^12-10-23", "status": "PENDING_NEW", "created_at": "2024-01-22T22:05:00Z", "message": "string", "error_code": "OTHER" } ``` # Cancel order POST `https://api.pro.anboto.xyz/api/v2/trading/order/cancel` This will initiate a cancellation request and set the order state to pending cancel. For the finalized state call /order/id?orderId=xxx **ApiKeyAuth** required. ### Body params `order_id` integer The Anboto generated order id Example: `123456` `client_order_id` string The client provided order id Example: `xxx-yyy-zzzz` ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | ----------------------------------------------- | | 200 | Cancellation request processed and in progress. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderSummary](https://api-docs.anboto.xyz/reference/schemas/#ordersummary) `order_id` integer The Anboto assigned order identifier `client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `created_at` date-time required The time in UTC when the order was created Example: `2024-01-22T22:05:00Z` `message` string Any additional information, usually if the order was rejected `error_code` [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) Example: `INVALID_ORDER` ``` body='{ "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" }' curl -X POST "$BASE/api/v2/trading/order/cancel" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" \ -H "Content-Type: application/json" -d "$body" ``` ``` payload = { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" } r = requests.post(f"{BASE}/api/v2/trading/order/cancel", data=json.dumps(payload) headers=signed_headers(payload)) print(r.json()) ``` ``` let payload = serde_json::json!({ "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" }); let resp = client .post(format!("{BASE}/api/v2/trading/order/cancel")) .headers(signed_headers(&payload)) .json(&payload) .send()?; println!("{}", resp.text()?); ``` ``` payload := map[string]any{ "order_id": 123456, "client_order_id": "xxx-yyy-zzzz", } body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", BASE+"/api/v2/trading/order/cancel", bytes.NewReader(body)) for k, v := range signedHeaders(string(body)) { req.Header.Set(k, v) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` String jsonBody = mapper.writeValueAsString(payload); HttpResponse resp = client.send( signedPost("/api/v2/trading/order/cancel", jsonBody), HttpResponse.BodyHandlers.ofString()); ``` ``` const payload: CancelUpstreamOrderRequest = { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" }; const res = await fetch(`${BASE}/api/v2/trading/order/cancel`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); const data: OrderSummary = await res.json(); ``` ``` val jsonBody = mapper.writeValueAsString(payload) val request = signedPost("/api/v2/trading/order/cancel", jsonBody) val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` std::string body = R"({ "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" })"; cpr::Response r = cpr::Post( cpr::Url{BASE + "/api/v2/trading/order/cancel"}, signedHeaders(body), cpr::Header{{"Content-Type", "application/json"}}, cpr::Body{body}); std::cout << r.text << std::endl; ``` ``` const payload = { "order_id": 123456, "client_order_id": "xxx-yyy-zzzz" }; const res = await fetch(`${BASE}/api/v2/trading/order/cancel`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); console.log(await res.json()); ``` **Response** 200 ``` { "order_id": 0, "client_order_id": "ABC-12345^12-10-23", "status": "PENDING_NEW", "created_at": "2024-01-22T22:05:00Z", "message": "string", "error_code": "OTHER" } ``` # Create many multi legs orders POST `https://api.pro.anboto.xyz/api/v2/trading/order/createMany/multilegs` Process a set of new order request and returns a summary for each order, the orders are not linked during execution and this endpoint is for convenience only **ApiKeyAuth** required. ### Body params `orders` array\[[CreateMultiLegsParentOrderRequest](https://api-docs.anboto.xyz/reference/schemas/#createmultilegsparentorderrequest)\] required ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 201 | Order processed. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderSummaryList](https://api-docs.anboto.xyz/reference/schemas/#ordersummarylist) `orders` array\[[OrderSummary](https://api-docs.anboto.xyz/reference/schemas/#ordersummary)\] required The list of order summaries for separate orders. `orders[].order_id` integer The Anboto assigned order identifier `orders[].client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `orders[].status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orders[].created_at` date-time required The time in UTC when the order was created Example: `2024-01-22T22:05:00Z` `orders[].message` string Any additional information, usually if the order was rejected `orders[].error_code` [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) Example: `INVALID_ORDER` ``` body='{ "orders": [ { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ {} ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} } ] }' curl -X POST "$BASE/api/v2/trading/order/createMany/multilegs" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" \ -H "Content-Type: application/json" -d "$body" ``` ``` payload = { "orders": [ { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ {} ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} } ] } r = requests.post(f"{BASE}/api/v2/trading/order/createMany/multilegs", data=json.dumps(payload) headers=signed_headers(payload)) print(r.json()) ``` ``` let payload = serde_json::json!({ "orders": [ { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ {} ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} } ] }); let resp = client .post(format!("{BASE}/api/v2/trading/order/createMany/multilegs")) .headers(signed_headers(&payload)) .json(&payload) .send()?; println!("{}", resp.text()?); ``` ``` payload := map[string]any{ "orders": []any{ map[string]any{ "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": []any{ map[string]any{}, }, "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": map[string]any{}, }, }, } body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", BASE+"/api/v2/trading/order/createMany/multilegs", bytes.NewReader(body)) for k, v := range signedHeaders(string(body)) { req.Header.Set(k, v) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` String jsonBody = mapper.writeValueAsString(payload); HttpResponse resp = client.send( signedPost("/api/v2/trading/order/createMany/multilegs", jsonBody), HttpResponse.BodyHandlers.ofString()); ``` ``` const payload: CreateManyMultiLegsParentOrdersRequest = { "orders": [ { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ {} ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} } ] }; const res = await fetch(`${BASE}/api/v2/trading/order/createMany/multilegs`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); const data: OrderSummaryList = await res.json(); ``` ``` val jsonBody = mapper.writeValueAsString(payload) val request = signedPost("/api/v2/trading/order/createMany/multilegs", jsonBody) val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` std::string body = R"({ "orders": [ { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ {} ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} } ] })"; cpr::Response r = cpr::Post( cpr::Url{BASE + "/api/v2/trading/order/createMany/multilegs"}, signedHeaders(body), cpr::Header{{"Content-Type", "application/json"}}, cpr::Body{body}); std::cout << r.text << std::endl; ``` ``` const payload = { "orders": [ { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ {} ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} } ] }; const res = await fetch(`${BASE}/api/v2/trading/order/createMany/multilegs`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); console.log(await res.json()); ``` **Response** 201 ``` { "orders": [ { "order_id": 0, "client_order_id": "ABC-12345^12-10-23", "status": "PENDING_NEW", "created_at": "2024-01-22T22:05:00Z", "message": "string", "error_code": "OTHER" } ] } ``` # Create many orders POST `https://api.pro.anboto.xyz/api/v2/trading/order/createMany` Process a set of new order request and returns a summary for each order, the orders are not linked during execution and this endpoint is for convenience only **ApiKeyAuth** required. ### Body params `orders` array\[[CreateParentOrderRequest](https://api-docs.anboto.xyz/reference/schemas/#createparentorderrequest)\] required ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 201 | Order processed. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderSummaryList](https://api-docs.anboto.xyz/reference/schemas/#ordersummarylist) `orders` array\[[OrderSummary](https://api-docs.anboto.xyz/reference/schemas/#ordersummary)\] required The list of order summaries for separate orders. `orders[].order_id` integer The Anboto assigned order identifier `orders[].client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `orders[].status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orders[].created_at` date-time required The time in UTC when the order was created Example: `2024-01-22T22:05:00Z` `orders[].message` string Any additional information, usually if the order was rejected `orders[].error_code` [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) Example: `INVALID_ORDER` ``` body='{ "orders": [ { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } } ] }' curl -X POST "$BASE/api/v2/trading/order/createMany" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" \ -H "Content-Type: application/json" -d "$body" ``` ``` payload = { "orders": [ { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } } ] } r = requests.post(f"{BASE}/api/v2/trading/order/createMany", data=json.dumps(payload) headers=signed_headers(payload)) print(r.json()) ``` ``` let payload = serde_json::json!({ "orders": [ { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } } ] }); let resp = client .post(format!("{BASE}/api/v2/trading/order/createMany")) .headers(signed_headers(&payload)) .json(&payload) .send()?; println!("{}", resp.text()?); ``` ``` payload := map[string]any{ "orders": []any{ map[string]any{ "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": map[string]any{ "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": map[string]any{}, "trigger": map[string]any{}, "placement_infos": map[string]any{}, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true, }, }, }, } body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", BASE+"/api/v2/trading/order/createMany", bytes.NewReader(body)) for k, v := range signedHeaders(string(body)) { req.Header.Set(k, v) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` String jsonBody = mapper.writeValueAsString(payload); HttpResponse resp = client.send( signedPost("/api/v2/trading/order/createMany", jsonBody), HttpResponse.BodyHandlers.ofString()); ``` ``` const payload: CreateManyParentOrdersRequest = { "orders": [ { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } } ] }; const res = await fetch(`${BASE}/api/v2/trading/order/createMany`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); const data: OrderSummaryList = await res.json(); ``` ``` val jsonBody = mapper.writeValueAsString(payload) val request = signedPost("/api/v2/trading/order/createMany", jsonBody) val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` std::string body = R"({ "orders": [ { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } } ] })"; cpr::Response r = cpr::Post( cpr::Url{BASE + "/api/v2/trading/order/createMany"}, signedHeaders(body), cpr::Header{{"Content-Type", "application/json"}}, cpr::Body{body}); std::cout << r.text << std::endl; ``` ``` const payload = { "orders": [ { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } } ] }; const res = await fetch(`${BASE}/api/v2/trading/order/createMany`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); console.log(await res.json()); ``` **Response** 201 ``` { "orders": [ { "order_id": 0, "client_order_id": "ABC-12345^12-10-23", "status": "PENDING_NEW", "created_at": "2024-01-22T22:05:00Z", "message": "string", "error_code": "OTHER" } ] } ``` # Create multi legs order POST `https://api.pro.anboto.xyz/api/v2/trading/order/create_multiLegs` Process a new order request and return order response **ApiKeyAuth** required. ### Body params `client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `subaccount` string The sub-account under which to trade the order `algo` [enum](https://api-docs.anboto.xyz/reference/schemas/#multilegsalgo) required The execution strategy for the order. — `PAIR` `legs` array\[[CreateOrderLegRequest](https://api-docs.anboto.xyz/reference/schemas/#createorderlegrequest)\] required The order legs `start_time` string The start time in UTC Example: `2024-01-22T22:05:00Z` `end_time` string The end time in UTC Example: `2024-04-22T22:05:00Z` `params` [MultiLegsOrderParams](https://api-docs.anboto.xyz/reference/schemas/#multilegsorderparams) The advanced order parameters to modify the execution behavior. ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 201 | Order created successfully | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderSummary](https://api-docs.anboto.xyz/reference/schemas/#ordersummary) `order_id` integer The Anboto assigned order identifier `client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `created_at` date-time required The time in UTC when the order was created Example: `2024-01-22T22:05:00Z` `message` string Any additional information, usually if the order was rejected `error_code` [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) Example: `INVALID_ORDER` ``` body='{ "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ { "exchange": "BINANCE", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "target_value": "12.0", "ccy": "USD", "limit_price": "2205.10", "strategy": "TWAP", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "is_leading": true } } ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} }' curl -X POST "$BASE/api/v2/trading/order/create_multiLegs" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" \ -H "Content-Type: application/json" -d "$body" ``` ``` payload = { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ { "exchange": "BINANCE", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "target_value": "12.0", "ccy": "USD", "limit_price": "2205.10", "strategy": "TWAP", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "is_leading": true } } ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} } r = requests.post(f"{BASE}/api/v2/trading/order/create_multiLegs", data=json.dumps(payload) headers=signed_headers(payload)) print(r.json()) ``` ``` let payload = serde_json::json!({ "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ { "exchange": "BINANCE", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "target_value": "12.0", "ccy": "USD", "limit_price": "2205.10", "strategy": "TWAP", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "is_leading": true } } ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} }); let resp = client .post(format!("{BASE}/api/v2/trading/order/create_multiLegs")) .headers(signed_headers(&payload)) .json(&payload) .send()?; println!("{}", resp.text()?); ``` ``` payload := map[string]any{ "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": []any{ map[string]any{ "exchange": "BINANCE", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "target_value": "12.0", "ccy": "USD", "limit_price": "2205.10", "strategy": "TWAP", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": map[string]any{ "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": map[string]any{}, "trigger": map[string]any{}, "placement_infos": map[string]any{}, "is_leading": true, }, }, }, "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": map[string]any{}, } body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", BASE+"/api/v2/trading/order/create_multiLegs", bytes.NewReader(body)) for k, v := range signedHeaders(string(body)) { req.Header.Set(k, v) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` String jsonBody = mapper.writeValueAsString(payload); HttpResponse resp = client.send( signedPost("/api/v2/trading/order/create_multiLegs", jsonBody), HttpResponse.BodyHandlers.ofString()); ``` ``` const payload: CreateMultiLegsParentOrderRequest = { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ { "exchange": "BINANCE", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "target_value": "12.0", "ccy": "USD", "limit_price": "2205.10", "strategy": "TWAP", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "is_leading": true } } ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} }; const res = await fetch(`${BASE}/api/v2/trading/order/create_multiLegs`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); const data: OrderSummary = await res.json(); ``` ``` val jsonBody = mapper.writeValueAsString(payload) val request = signedPost("/api/v2/trading/order/create_multiLegs", jsonBody) val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` std::string body = R"({ "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ { "exchange": "BINANCE", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "target_value": "12.0", "ccy": "USD", "limit_price": "2205.10", "strategy": "TWAP", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "is_leading": true } } ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} })"; cpr::Response r = cpr::Post( cpr::Url{BASE + "/api/v2/trading/order/create_multiLegs"}, signedHeaders(body), cpr::Header{{"Content-Type", "application/json"}}, cpr::Body{body}); std::cout << r.text << std::endl; ``` ``` const payload = { "client_order_id": "ABC-12345^12-10-23", "subaccount": "string", "algo": "PAIR", "legs": [ { "exchange": "BINANCE", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "target_value": "12.0", "ccy": "USD", "limit_price": "2205.10", "strategy": "TWAP", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": {}, "trigger": {}, "placement_infos": {}, "is_leading": true } } ], "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "params": {} }; const res = await fetch(`${BASE}/api/v2/trading/order/create_multiLegs`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); console.log(await res.json()); ``` **Response** 201 ``` { "order_id": 0, "client_order_id": "ABC-12345^12-10-23", "status": "PENDING_NEW", "created_at": "2024-01-22T22:05:00Z", "message": "string", "error_code": "OTHER" } ``` # Create order POST `https://api.pro.anboto.xyz/api/v2/trading/order/create` Process a new order request and return order response **ApiKeyAuth** required. ### Body params `client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) required The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) `subaccount` string The sub-account under which to trade the order `symbol` string required The symbol using Anboto symbology, e.g. BTC/USDT `asset_category` [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) required The Asset category of the order. — `SPOT`, `FUTURE` Example: `SPOT` `side` [enum](https://api-docs.anboto.xyz/reference/schemas/#side) required The side of the book to trade. — `BUY`, `SELL` `quantity` string required The quantity to trade as a exchange trade-able decimal value, e.g. 0.015 `strategy` [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) required The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` `limit_price` string The exchange valid limit price for the order Example: `2205.10` `start_time` string The start time in UTC Example: `2024-01-22T22:05:00Z` `end_time` string The end time in UTC Example: `2024-04-22T22:05:00Z` `clip_size_type` [enum](https://api-docs.anboto.xyz/reference/schemas/#clipsizetype) The clip size for the child orders. The default is AUTOMATIC — `ABSOLUTE`, `PERCENTAGE`, `AUTOMATIC`, `ORDER_COUNT` Example: `AUTOMATIC` · Default: `AUTOMATIC` `clip_size_val` string The clip size value, required if the type is ABSOLUTE or PERCENTAGE Example: `0.01` `params` [OrderParams](https://api-docs.anboto.xyz/reference/schemas/#orderparams) The advanced order parameters to modify the execution behavior. ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 201 | Order created successfully | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderSummary](https://api-docs.anboto.xyz/reference/schemas/#ordersummary) `order_id` integer The Anboto assigned order identifier `client_order_id` string A custom string to identify the order Example: `ABC-12345^12-10-23` `status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `created_at` date-time required The time in UTC when the order was created Example: `2024-01-22T22:05:00Z` `message` string Any additional information, usually if the order was rejected `error_code` [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) Example: `INVALID_ORDER` ``` body='{ "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": { "would_price": "string", "would_pct": "string", "would_style": "PASSIVE", "would_is_arrival": true }, "trigger": { "trigger_price": "string", "trigger_condition": "ABOVE" }, "placement_infos": { "placement_mode": "DEFAULT", "placement": "string", "cancel": "string" }, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } }' curl -X POST "$BASE/api/v2/trading/order/create" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" \ -H "Content-Type: application/json" -d "$body" ``` ``` payload = { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": { "would_price": "string", "would_pct": "string", "would_style": "PASSIVE", "would_is_arrival": true }, "trigger": { "trigger_price": "string", "trigger_condition": "ABOVE" }, "placement_infos": { "placement_mode": "DEFAULT", "placement": "string", "cancel": "string" }, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } } r = requests.post(f"{BASE}/api/v2/trading/order/create", data=json.dumps(payload) headers=signed_headers(payload)) print(r.json()) ``` ``` let payload = serde_json::json!({ "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": { "would_price": "string", "would_pct": "string", "would_style": "PASSIVE", "would_is_arrival": true }, "trigger": { "trigger_price": "string", "trigger_condition": "ABOVE" }, "placement_infos": { "placement_mode": "DEFAULT", "placement": "string", "cancel": "string" }, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } }); let resp = client .post(format!("{BASE}/api/v2/trading/order/create")) .headers(signed_headers(&payload)) .json(&payload) .send()?; println!("{}", resp.text()?); ``` ``` payload := map[string]any{ "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": map[string]any{ "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": map[string]any{ "would_price": "string", "would_pct": "string", "would_style": "PASSIVE", "would_is_arrival": true, }, "trigger": map[string]any{ "trigger_price": "string", "trigger_condition": "ABOVE", }, "placement_infos": map[string]any{ "placement_mode": "DEFAULT", "placement": "string", "cancel": "string", }, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true, }, } body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", BASE+"/api/v2/trading/order/create", bytes.NewReader(body)) for k, v := range signedHeaders(string(body)) { req.Header.Set(k, v) } req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` String jsonBody = mapper.writeValueAsString(payload); HttpResponse resp = client.send( signedPost("/api/v2/trading/order/create", jsonBody), HttpResponse.BodyHandlers.ofString()); ``` ``` const payload: CreateParentOrderRequest = { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": { "would_price": "string", "would_pct": "string", "would_style": "PASSIVE", "would_is_arrival": true }, "trigger": { "trigger_price": "string", "trigger_condition": "ABOVE" }, "placement_infos": { "placement_mode": "DEFAULT", "placement": "string", "cancel": "string" }, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } }; const res = await fetch(`${BASE}/api/v2/trading/order/create`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); const data: OrderSummary = await res.json(); ``` ``` val jsonBody = mapper.writeValueAsString(payload) val request = signedPost("/api/v2/trading/order/create", jsonBody) val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` std::string body = R"({ "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": { "would_price": "string", "would_pct": "string", "would_style": "PASSIVE", "would_is_arrival": true }, "trigger": { "trigger_price": "string", "trigger_condition": "ABOVE" }, "placement_infos": { "placement_mode": "DEFAULT", "placement": "string", "cancel": "string" }, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } })"; cpr::Response r = cpr::Post( cpr::Url{BASE + "/api/v2/trading/order/create"}, signedHeaders(body), cpr::Header{{"Content-Type", "application/json"}}, cpr::Body{body}); std::cout << r.text << std::endl; ``` ``` const payload = { "client_order_id": "ABC-12345^12-10-23", "exchange": "BINANCE", "subaccount": "string", "symbol": "string", "asset_category": "SPOT", "side": "BUY", "quantity": "string", "strategy": "TWAP", "limit_price": "2205.10", "start_time": "2024-01-22T22:05:00Z", "end_time": "2024-04-22T22:05:00Z", "clip_size_type": "ABSOLUTE", "clip_size_val": "0.01", "params": { "duration_seconds": "120", "trading_style": "PASSIVE", "urgency": "LOW", "randomize_amount": true, "would": { "would_price": "string", "would_pct": "string", "would_style": "PASSIVE", "would_is_arrival": true }, "trigger": { "trigger_price": "string", "trigger_condition": "ABOVE" }, "placement_infos": { "placement_mode": "DEFAULT", "placement": "string", "cancel": "string" }, "reduce_only": true, "start_ladder_price": "string", "end_ladder_price": "string", "ladder_direction": "string", "ladder_profile": "string", "size_skew": 0.0, "ob_imbalance_cancel": true, "ob_imbalance_threshold": "0.75", "price_lock_bps": "5", "post_only": true } }; const res = await fetch(`${BASE}/api/v2/trading/order/create`, { method: "POST", headers: signedHeaders(payload), body: JSON.stringify(payload), }); console.log(await res.json()); ``` **Response** 201 ``` { "order_id": 0, "client_order_id": "ABC-12345^12-10-23", "status": "PENDING_NEW", "created_at": "2024-01-22T22:05:00Z", "message": "string", "error_code": "OTHER" } ``` # Exchanges GET `https://api.pro.anboto.xyz/api/v2/data/exchanges` Return a list of exchanges available to trade **ApiKeyAuth** required. ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The exchanges. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ``` curl -X GET "$BASE/api/v2/data/exchanges" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` r = requests.get(f"{BASE}/api/v2/data/exchanges", headers=signed_headers_query({})) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/data/exchanges")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/data/exchanges", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/data/exchanges"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/data/exchanges`, { method: "GET", headers: signedHeadersQuery(params), }); const data = await res.json(); ``` ``` val request = signedGet("/api/v2/data/exchanges") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/data/exchanges"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/data/exchanges`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` "string" ``` # Find orders GET `https://api.pro.anboto.xyz/api/v2/trading/order/find` Only matched order within 3 days will be return **ApiKeyAuth** required. ### Query params `startMs` integer The start time for the query as ms since epoch `endMs` integer The end time for the query as ms since epoch `limit` integer The maximum number of orders to return in the results ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The list of matching orders. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderDetailsList](https://api-docs.anboto.xyz/reference/schemas/#orderdetailslist) `orders` array\[[OrderDetails](https://api-docs.anboto.xyz/reference/schemas/#orderdetails)\] required The list of order details for separate orders. `orders[].order_id` integer The Anboto generated order id Example: `123456` `orders[].client_order_id` string The client provided order id Example: `xxx-yyy-zzz` `orders[].symbol` string The order symbol in Anboto's symbology `orders[].status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orders[].asset_class` [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) The Asset category of the order. — `SPOT`, `FUTURE` Example: `SPOT` `orders[].exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) `orders[].strategy` [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` Example: `VWAP` `orders[].start_time` number The time when the order start trading from epoch time in ms `orders[].end_time` number The time when the order is finished from epoch time in ms `orders[].filled_quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].leaves_quantity` number required The absolute amount of the order quantity remaining to be filled Example: `0` `orders[].side` [enum](https://api-docs.anboto.xyz/reference/schemas/#side) The side of the book to trade. — `BUY`, `SELL` `orders[].last_quantity` number required The last qty received in a fill from the exchange Example: `0` `orders[].last_price` number required The last price executed on the exchange Example: `0` `orders[].average_price` number required The average execution price of the order Example: `0` `orders[].trades` array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] The list of trades associated with this order when include_trades=true `orders[].trades[].trade_id` integer The trade id from exchange Example: `123456` `orders[].trades[].symbol` string required The order symbol using Anboto symbology `orders[].trades[].exchangeOrderId` string The order id from exchange `orders[].trades[].clientOrderId` string The client order id `orders[].trades[].quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].trades[].price` number required The traded price Example: `0` `orders[].trades[].direction` string The direction of the trade `orders[].trades[].makerOrTaker` string The trade is from Maker or Taker `orders[].trades[].execTime` integer The time where the trade executed `orders[].trades[].fee` number The fee charged on the trade `orders[].trades[].feeCurrency` string The asset type the fee was charged in `orders[].fees_infos` object Aggregated fees per currency when include_fees=true ``` curl -X GET "$BASE/api/v2/trading/order/find?startMs=0" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"startMs": ..., "endMs": ..., "limit": ...} r = requests.get(f"{BASE}/api/v2/trading/order/find", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/order/find?startMs=0")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/order/find?startMs=0", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/order/find?startMs=0"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/find?startMs=0`, { method: "GET", headers: signedHeadersQuery(params), }); const data: OrderDetailsList = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/order/find?startMs=0") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/order/find?startMs=0"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/find?startMs=0`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzz", "symbol": "string", "status": "PENDING_NEW", "asset_class": "SPOT", "exchange": "BINANCE", "strategy": "TWAP", "start_time": 0.0, "end_time": 0.0, "filled_quantity": 0, "leaves_quantity": 0, "side": "BUY", "last_quantity": 0, "last_price": 0, "average_price": 0, "trades": [ {} ], "fees_infos": {} } ] } ``` # Funding rate history GET `https://api.pro.anboto.xyz/api/v2/data/fundingRateHistory` Return the funding rate history for a symbol on an exchange. Both 'exchange' and 'symbol' are required. **ApiKeyAuth** required. ### Query params `exchange` string The exchange to return funding rate history for `symbol` string The symbol to return funding rate history for ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The last funding rates. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [FundingRate](https://api-docs.anboto.xyz/reference/schemas/#fundingrate) `exchange` string required `symbol` string required `time` date-time required `nextTime` date-time required `rate` number required `nextRate` number `markPrice` number ``` curl -X GET "$BASE/api/v2/data/fundingRateHistory?exchange=string" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"exchange": ..., "symbol": ...} r = requests.get(f"{BASE}/api/v2/data/fundingRateHistory", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/data/fundingRateHistory?exchange=string")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/data/fundingRateHistory?exchange=string", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/data/fundingRateHistory?exchange=string"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/data/fundingRateHistory?exchange=string`, { method: "GET", headers: signedHeadersQuery(params), }); const data: FundingRate = await res.json(); ``` ``` val request = signedGet("/api/v2/data/fundingRateHistory?exchange=string") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/data/fundingRateHistory?exchange=string"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/data/fundingRateHistory?exchange=string`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "exchange": "string", "symbol": "string", "time": "string", "nextTime": "string", "rate": 0.0, "nextRate": 0.0, "markPrice": 0.0 } ``` # Get balance GET `https://api.pro.anboto.xyz/api/v2/trading/balance` shows the asset balance > 0 **ApiKeyAuth** required. ### Query params `exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) required The exchange — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, `MEXC`, `BULLISH`, `B2C2`, `COINBASE_PRIME`, `COINBASE_INTL`, `HYPERLIQUID`, … (15 values) `subaccount` string Sub-account ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The list of asset balance > 0 | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields `[].balance` number The total balance of the asset `[].free` number The balance available for trading `[].symbol` string The asset symbol Example: `BTC` ``` curl -X GET "$BASE/api/v2/trading/balance?exchange=BINANCE" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"exchange": ..., "subaccount": ...} r = requests.get(f"{BASE}/api/v2/trading/balance", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/balance?exchange=BINANCE")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/balance?exchange=BINANCE", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/balance?exchange=BINANCE"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/balance?exchange=BINANCE`, { method: "GET", headers: signedHeadersQuery(params), }); const data = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/balance?exchange=BINANCE") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/balance?exchange=BINANCE"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/balance?exchange=BINANCE`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` [ { "balance": 0.0, "free": 0.0, "symbol": "BTC" } ] ``` # Get open orders GET `https://api.pro.anboto.xyz/api/v2/trading/order/open` All orders that are not in a terminal state will be returned **ApiKeyAuth** required. ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The list of open orders. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderDetailsList](https://api-docs.anboto.xyz/reference/schemas/#orderdetailslist) `orders` array\[[OrderDetails](https://api-docs.anboto.xyz/reference/schemas/#orderdetails)\] required The list of order details for separate orders. `orders[].order_id` integer The Anboto generated order id Example: `123456` `orders[].client_order_id` string The client provided order id Example: `xxx-yyy-zzz` `orders[].symbol` string The order symbol in Anboto's symbology `orders[].status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orders[].asset_class` [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) The Asset category of the order. — `SPOT`, `FUTURE` Example: `SPOT` `orders[].exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) `orders[].strategy` [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` Example: `VWAP` `orders[].start_time` number The time when the order start trading from epoch time in ms `orders[].end_time` number The time when the order is finished from epoch time in ms `orders[].filled_quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].leaves_quantity` number required The absolute amount of the order quantity remaining to be filled Example: `0` `orders[].side` [enum](https://api-docs.anboto.xyz/reference/schemas/#side) The side of the book to trade. — `BUY`, `SELL` `orders[].last_quantity` number required The last qty received in a fill from the exchange Example: `0` `orders[].last_price` number required The last price executed on the exchange Example: `0` `orders[].average_price` number required The average execution price of the order Example: `0` `orders[].trades` array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] The list of trades associated with this order when include_trades=true `orders[].trades[].trade_id` integer The trade id from exchange Example: `123456` `orders[].trades[].symbol` string required The order symbol using Anboto symbology `orders[].trades[].exchangeOrderId` string The order id from exchange `orders[].trades[].clientOrderId` string The client order id `orders[].trades[].quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].trades[].price` number required The traded price Example: `0` `orders[].trades[].direction` string The direction of the trade `orders[].trades[].makerOrTaker` string The trade is from Maker or Taker `orders[].trades[].execTime` integer The time where the trade executed `orders[].trades[].fee` number The fee charged on the trade `orders[].trades[].feeCurrency` string The asset type the fee was charged in `orders[].fees_infos` object Aggregated fees per currency when include_fees=true ``` curl -X GET "$BASE/api/v2/trading/order/open" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` r = requests.get(f"{BASE}/api/v2/trading/order/open", headers=signed_headers_query({})) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/order/open")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/order/open", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/order/open"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/open`, { method: "GET", headers: signedHeadersQuery(params), }); const data: OrderDetailsList = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/order/open") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/order/open"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/open`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzz", "symbol": "string", "status": "PENDING_NEW", "asset_class": "SPOT", "exchange": "BINANCE", "strategy": "TWAP", "start_time": 0.0, "end_time": 0.0, "filled_quantity": 0, "leaves_quantity": 0, "side": "BUY", "last_quantity": 0, "last_price": 0, "average_price": 0, "trades": [ {} ], "fees_infos": {} } ] } ``` # Get orders GET `https://api.pro.anboto.xyz/api/v2/trading/order/byId` Either orderIds or clientOrderIds has to be provided for matching **ApiKeyAuth** required. ### Query params `orderIds` array[integer] The list of anboto generated order ids `clientOrderIds` array[string] The list of client generated order ids `include_trades` boolean Whether to include trades for the matching orders `include_fees` boolean Whether to include aggregated fees per currency for the matching orders ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | return a list of matching orders | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [OrderDetailsList](https://api-docs.anboto.xyz/reference/schemas/#orderdetailslist) `orders` array\[[OrderDetails](https://api-docs.anboto.xyz/reference/schemas/#orderdetails)\] required The list of order details for separate orders. `orders[].order_id` integer The Anboto generated order id Example: `123456` `orders[].client_order_id` string The client provided order id Example: `xxx-yyy-zzz` `orders[].symbol` string The order symbol in Anboto's symbology `orders[].status` [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orders[].asset_class` [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) The Asset category of the order. — `SPOT`, `FUTURE` Example: `SPOT` `orders[].exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) `orders[].strategy` [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` Example: `VWAP` `orders[].start_time` number The time when the order start trading from epoch time in ms `orders[].end_time` number The time when the order is finished from epoch time in ms `orders[].filled_quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].leaves_quantity` number required The absolute amount of the order quantity remaining to be filled Example: `0` `orders[].side` [enum](https://api-docs.anboto.xyz/reference/schemas/#side) The side of the book to trade. — `BUY`, `SELL` `orders[].last_quantity` number required The last qty received in a fill from the exchange Example: `0` `orders[].last_price` number required The last price executed on the exchange Example: `0` `orders[].average_price` number required The average execution price of the order Example: `0` `orders[].trades` array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] The list of trades associated with this order when include_trades=true `orders[].trades[].trade_id` integer The trade id from exchange Example: `123456` `orders[].trades[].symbol` string required The order symbol using Anboto symbology `orders[].trades[].exchangeOrderId` string The order id from exchange `orders[].trades[].clientOrderId` string The client order id `orders[].trades[].quantity` number required The absolute amount of the order quantity filled Example: `0` `orders[].trades[].price` number required The traded price Example: `0` `orders[].trades[].direction` string The direction of the trade `orders[].trades[].makerOrTaker` string The trade is from Maker or Taker `orders[].trades[].execTime` integer The time where the trade executed `orders[].trades[].fee` number The fee charged on the trade `orders[].trades[].feeCurrency` string The asset type the fee was charged in `orders[].fees_infos` object Aggregated fees per currency when include_fees=true ``` curl -X GET "$BASE/api/v2/trading/order/byId?orderIds=..." \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"orderIds": ..., "clientOrderIds": ..., "include_trades": ..., "include_fees": ...} r = requests.get(f"{BASE}/api/v2/trading/order/byId", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/order/byId?orderIds=...")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/order/byId?orderIds=...", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/order/byId?orderIds=..."), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/byId?orderIds=...`, { method: "GET", headers: signedHeadersQuery(params), }); const data: OrderDetailsList = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/order/byId?orderIds=...") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/order/byId?orderIds=..."}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/order/byId?orderIds=...`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "orders": [ { "order_id": 123456, "client_order_id": "xxx-yyy-zzz", "symbol": "string", "status": "PENDING_NEW", "asset_class": "SPOT", "exchange": "BINANCE", "strategy": "TWAP", "start_time": 0.0, "end_time": 0.0, "filled_quantity": 0, "leaves_quantity": 0, "side": "BUY", "last_quantity": 0, "last_price": 0, "average_price": 0, "trades": [ {} ], "fees_infos": {} } ] } ``` # Get position GET `https://api.pro.anboto.xyz/api/v2/trading/position` shows the asset position != 0 **ApiKeyAuth** required. ### Query params `exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) required The exchange — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, `MEXC`, `BULLISH`, `B2C2`, `COINBASE_PRIME`, `COINBASE_INTL`, `HYPERLIQUID`, … (15 values) `subaccount` string Sub-account ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The list of asset positions != 0 | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields `[].collateral` number The collateral amount for the position `[].contracts` number The number of contracts `[].entryPrice` number The average entry price `[].leverage` number The position leverage `[].liquidationPrice` number The liquidation price `[].marginMode` enum The margin mode of the position — `CROSS`, `ISOLATED` `[].markPrice` number The current mark price `[].notional` number The notional value of the position `[].side` enum The position side — `LONG`, `SHORT`, `BOTH` `[].symbol` string The trading symbol `[].timestamp` integer Unix timestamp in milliseconds `[].unrealizedPnl` number The unrealized profit and loss ``` curl -X GET "$BASE/api/v2/trading/position?exchange=BINANCE" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"exchange": ..., "subaccount": ...} r = requests.get(f"{BASE}/api/v2/trading/position", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/position?exchange=BINANCE")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/position?exchange=BINANCE", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/position?exchange=BINANCE"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/position?exchange=BINANCE`, { method: "GET", headers: signedHeadersQuery(params), }); const data = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/position?exchange=BINANCE") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/position?exchange=BINANCE"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/position?exchange=BINANCE`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` [ { "collateral": 0.0, "contracts": 0.0, "entryPrice": 0.0, "leverage": 0.0, "liquidationPrice": 0.0, "marginMode": "CROSS", "markPrice": 0.0, "notional": 0.0, "side": "LONG", "symbol": "string", "timestamp": 0, "unrealizedPnl": 0.0 } ] ``` # Get user trades GET `https://api.pro.anboto.xyz/api/v2/trading/userTrades` Either orderIds or clientOrderIds has to be provided for matching **ApiKeyAuth** required. ### Query params `exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) required The exchange — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, `MEXC`, `BULLISH`, `B2C2`, `COINBASE_PRIME`, `COINBASE_INTL`, `HYPERLIQUID`, … (15 values) `subaccount` string Sub-account `orderIds` array[integer] The list of anboto generated order ids `clientOrderIds` array[string] The list of client generated order ids ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | A list of matching trades. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [TradeDetailsList](https://api-docs.anboto.xyz/reference/schemas/#tradedetailslist) `trades` array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] required The list of trade details `trades[].trade_id` integer The trade id from exchange Example: `123456` `trades[].symbol` string required The order symbol using Anboto symbology `trades[].exchangeOrderId` string The order id from exchange `trades[].clientOrderId` string The client order id `trades[].quantity` number required The absolute amount of the order quantity filled Example: `0` `trades[].price` number required The traded price Example: `0` `trades[].direction` string The direction of the trade `trades[].makerOrTaker` string The trade is from Maker or Taker `trades[].execTime` integer The time where the trade executed `trades[].fee` number The fee charged on the trade `trades[].feeCurrency` string The asset type the fee was charged in ``` curl -X GET "$BASE/api/v2/trading/userTrades?exchange=BINANCE" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"exchange": ..., "subaccount": ..., "orderIds": ..., "clientOrderIds": ...} r = requests.get(f"{BASE}/api/v2/trading/userTrades", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/userTrades?exchange=BINANCE")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/userTrades?exchange=BINANCE", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/userTrades?exchange=BINANCE"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/userTrades?exchange=BINANCE`, { method: "GET", headers: signedHeadersQuery(params), }); const data: TradeDetailsList = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/userTrades?exchange=BINANCE") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/userTrades?exchange=BINANCE"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/userTrades?exchange=BINANCE`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "trades": [ { "trade_id": 123456, "symbol": "string", "exchangeOrderId": "string", "clientOrderId": "string", "quantity": 0, "price": 0, "direction": "string", "makerOrTaker": "string", "execTime": 0, "fee": 0.0, "feeCurrency": "string" } ] } ``` # Instruments GET `https://api.pro.anboto.xyz/api/v2/data/instruments` Return all instruments based on filter parameters **ApiKeyAuth** required. ### Query params `exchange` string Return all instruments on this exchange for each asset `symbol` string Return instrument with this symbol ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The instruments | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [Instrument](https://api-docs.anboto.xyz/reference/schemas/#instrument) `exchange` [enum](https://api-docs.anboto.xyz/reference/schemas/#exchange_1) required `BINANCE`, `HUOBI`, `COINBASE_ADV`, `GATEIO`, `KRAKEN`, `KUCOIN`, `OKX`, `BYBIT`, … (18 values) `symbol` string required `baseAsset` string required `quoteAsset` string required `exchangeSymbol` string required `exchangeAssetClass` string required `assetClass` [enum](https://api-docs.anboto.xyz/reference/schemas/#assetclass) required `UNDEFINED`, `SPOT`, `FUTURE`, `OPTION`, `CFD` `quantityPrecision` integer `pricePrecision` integer `maxQuantityLimit` number `minQuantityLimit` number `minCostLimit` number `maxCostLimit` number `contractSize` number `minMarketLimit` number `maxMarketLimit` number `minPriceLimit` number `maxPriceLimit` number `enabled` boolean required `timestamp` date-time required `priceSignificantFigure` integer `quantitySignificantFigure` integer `assetId` string ``` curl -X GET "$BASE/api/v2/data/instruments?exchange=string" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"exchange": ..., "symbol": ...} r = requests.get(f"{BASE}/api/v2/data/instruments", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/data/instruments?exchange=string")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/data/instruments?exchange=string", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/data/instruments?exchange=string"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/data/instruments?exchange=string`, { method: "GET", headers: signedHeadersQuery(params), }); const data: Instrument = await res.json(); ``` ``` val request = signedGet("/api/v2/data/instruments?exchange=string") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/data/instruments?exchange=string"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/data/instruments?exchange=string`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "exchange": "BINANCE", "symbol": "string", "baseAsset": "string", "quoteAsset": "string", "exchangeSymbol": "string", "exchangeAssetClass": "string", "assetClass": "UNDEFINED", "quantityPrecision": 0, "pricePrecision": 0, "maxQuantityLimit": 0.0, "minQuantityLimit": 0.0, "minCostLimit": 0.0, "maxCostLimit": 0.0, "contractSize": 0.0, "minMarketLimit": 0.0, "maxMarketLimit": 0.0, "minPriceLimit": 0.0, "maxPriceLimit": 0.0, "enabled": true, "timestamp": "string", "priceSignificantFigure": 0, "quantitySignificantFigure": 0, "assetId": "string" } ``` # Last funding rates GET `https://api.pro.anboto.xyz/api/v2/data/lastFundingRates` Return all funding rates based on filter parameters **ApiKeyAuth** required. ### Query params `exchange` string Return last funding rates on this exchange for each asset `symbol` string Return last funding rates for this asset on each exchange ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The last funding rates. | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ### Response fields — [FundingRate](https://api-docs.anboto.xyz/reference/schemas/#fundingrate) `exchange` string required `symbol` string required `time` date-time required `nextTime` date-time required `rate` number required `nextRate` number `markPrice` number ``` curl -X GET "$BASE/api/v2/data/lastFundingRates?exchange=string" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` params = {"exchange": ..., "symbol": ...} r = requests.get(f"{BASE}/api/v2/data/lastFundingRates", params=params headers=signed_headers_query(params)) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/data/lastFundingRates?exchange=string")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/data/lastFundingRates?exchange=string", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/data/lastFundingRates?exchange=string"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/data/lastFundingRates?exchange=string`, { method: "GET", headers: signedHeadersQuery(params), }); const data: FundingRate = await res.json(); ``` ``` val request = signedGet("/api/v2/data/lastFundingRates?exchange=string") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/data/lastFundingRates?exchange=string"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/data/lastFundingRates?exchange=string`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` { "exchange": "string", "symbol": "string", "time": "string", "nextTime": "string", "rate": 0.0, "nextRate": 0.0, "markPrice": 0.0 } ``` # Listen key GET `https://api.pro.anboto.xyz/api/v2/trading/listenKey` Returns a listenKey (JWT, valid 1 hour) to authenticate on wss:///api/v2/ws?listenKey=. See the WebSocket API documentation (asynapi.yml). **ApiKeyAuth** required. ### Headers | Header | | | | --------------- | ----------------- | -------- | | `X-API-KEY` | string | required | | `X-TIMESTAMP` | int64 ms | required | | `X-SIGN` | string | required | | `X-RECV-WINDOW` | int, default 5000 | | ### Responses | | | | --- | -------------------------------- | | 200 | The listenKey token | | 401 | Unauthorized, Invalid Signature | | 429 | Rate limit exceeded, retry later | ``` curl -X GET "$BASE/api/v2/trading/listenKey" \ -H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \ -H "X-SIGN: $sign" ``` ``` r = requests.get(f"{BASE}/api/v2/trading/listenKey", headers=signed_headers_query({})) print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/api/v2/trading/listenKey")) .headers(signed_headers_query(¶ms)) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/listenKey", nil) for k, v := range signedHeadersQuery(req.URL.Query()) { req.Header.Set(k, v) } resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/api/v2/trading/listenKey"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/api/v2/trading/listenKey`, { method: "GET", headers: signedHeadersQuery(params), }); const data = await res.json(); ``` ``` val request = signedGet("/api/v2/trading/listenKey") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/api/v2/trading/listenKey"}, signedHeadersQuery(params)); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/api/v2/trading/listenKey`, { method: "GET", headers: signedHeadersQuery(params), }); console.log(await res.json()); ``` **Response** 200 ``` "string" ``` # Schemas Request and response objects of the Anboto Trading API. Endpoint pages link here from their type columns. ## AccountPositionResponse Documentation model for one entry of the GET /position response. Mirrors the fields selected by PositionQuery. | Field | Type | | Description | Example | | ------------------ | ------- | --- | ----------------------------------------------------- | ------- | | `collateral` | number | | The collateral amount for the position | | | `contracts` | number | | The number of contracts | | | `entryPrice` | number | | The average entry price | | | `leverage` | number | | The position leverage | | | `liquidationPrice` | number | | The liquidation price | | | `marginMode` | enum | | The margin mode of the position — `CROSS`, `ISOLATED` | | | `markPrice` | number | | The current mark price | | | `notional` | number | | The notional value of the position | | | `side` | enum | | The position side — `LONG`, `SHORT`, `BOTH` | | | `symbol` | string | | The trading symbol | | | `timestamp` | integer | | Unix timestamp in milliseconds | | | `unrealizedPnl` | number | | The unrealized profit and loss | | ## ApiErrorCode The error code used to describe why an order was rejected. Values: `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, `INVALID_ORDER`, `EXCHANGE_ERROR`, `EMS_INSTANCES_DOWN`, `SLIPPAGE_EXCEEDED`, `EXPIRY_REACHED`, `MAX_FEE_PER_GAS_IS_TOO_LOW`, `PARENT_ORDER_WAS_TERMINATED`, `MAX_PRIORITY_FEE_PER_GAS_IS_TOO_LOW`, `INVALID_QUANTITY`, `INVALID_END_TIME`, `INVALID_TRADE_TIME`, `INVALID_FEE`, `INVALID_SYMBOL`, `INVALID_TRADE_STRATEGY`, `INVALID_LIMIT_PRICE`, `INVALID_WOULD_PRICE`, `INVALID_TRIGGER_PRICE`, `INVALID_PARAM`, `INVALID_EXCHANGE`, `INVALID_SIGNATURE`, `INVALID_API_KEY`, `INVALID_TIMESTAMP`, `BATCH_OVERSIZE`, `SYSTEM_ERROR`, `INVALID_REQUEST`, `SYSTEM_BUSY` ## AssetBalanceResponse Documentation model for one entry of the GET /balance response. Mirrors the fields selected by BalanceQuery. | Field | Type | | Description | Example | | --------- | ------ | --- | --------------------------------- | ------- | | `balance` | number | | The total balance of the asset | | | `free` | number | | The balance available for trading | | | `symbol` | string | | The asset symbol | `BTC` | ## AssetCategory The Asset category of the order. Values: `SPOT`, `FUTURE` ## AssetClass Values: `UNDEFINED`, `SPOT`, `FUTURE`, `OPTION`, `CFD` ## CancelManyUpstreamOrdersRequest Used for cancelling many parent orders at the same time | Field | Type | | Description | Example | | -------------------------- | ---------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------- | -------------- | | `orders` | array\[[CancelUpstreamOrderRequest](https://api-docs.anboto.xyz/reference/schemas/#cancelupstreamorderrequest)\] | required | The list of parent cancellation requests | | | `orders[].order_id` | integer | | The Anboto generated order id | `123456` | | `orders[].client_order_id` | string | | The client provided order id | `xxx-yyy-zzzz` | ## CancelUpstreamOrderRequest Used for cancelling a parent order | Field | Type | | Description | Example | | ----------------- | ------- | --- | ----------------------------- | -------------- | | `order_id` | integer | | The Anboto generated order id | `123456` | | `client_order_id` | string | | The client provided order id | `xxx-yyy-zzzz` | ## ClipSizeType The clip size for the child orders. The default is AUTOMATIC Values: `ABSOLUTE`, `PERCENTAGE`, `AUTOMATIC`, `ORDER_COUNT` ## CreateManyMultiLegsParentOrdersRequest A request to create many multilegs orders in a single request. | Field | Type | | Description | Example | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------- | --------------------------------------------------------------- | ---------------------- | | `orders` | array\[[CreateMultiLegsParentOrderRequest](https://api-docs.anboto.xyz/reference/schemas/#createmultilegsparentorderrequest)\] | required | | | | `orders[].client_order_id` | string | | A custom string to identify the order | `ABC-12345^12-10-23` | | `orders[].subaccount` | string | | The sub-account under which to trade the order | | | `orders[].algo` | [enum](https://api-docs.anboto.xyz/reference/schemas/#multilegsalgo) | required | The execution strategy for the order. — `PAIR` | | | `orders[].legs` | array\[[CreateOrderLegRequest](https://api-docs.anboto.xyz/reference/schemas/#createorderlegrequest)\] | required | The order legs | | | `orders[].start_time` | string | | The start time in UTC | `2024-01-22T22:05:00Z` | | `orders[].end_time` | string | | The end time in UTC | `2024-04-22T22:05:00Z` | | `orders[].params` | [MultiLegsOrderParams](https://api-docs.anboto.xyz/reference/schemas/#multilegsorderparams) | | The advanced order parameters to modify the execution behavior. | | ## CreateManyParentOrdersRequest A request to create many parent orders in a single request. | Field | Type | | Description | Example | | -------------------------- | ------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- | | `orders` | array\[[CreateParentOrderRequest](https://api-docs.anboto.xyz/reference/schemas/#createparentorderrequest)\] | required | | | | `orders[].client_order_id` | string | | A custom string to identify the order | `ABC-12345^12-10-23` | | `orders[].exchange` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) | required | The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) | | | `orders[].subaccount` | string | | The sub-account under which to trade the order | | | `orders[].symbol` | string | required | The symbol using Anboto symbology, e.g. BTC/USDT | | | `orders[].asset_category` | [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) | required | The Asset category of the order. — `SPOT`, `FUTURE` | `SPOT` | | `orders[].side` | [enum](https://api-docs.anboto.xyz/reference/schemas/#side) | required | The side of the book to trade. — `BUY`, `SELL` | | | `orders[].quantity` | string | required | The quantity to trade as a exchange trade-able decimal value, e.g. 0.015 | | | `orders[].strategy` | [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) | required | The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` | | | `orders[].limit_price` | string | | The exchange valid limit price for the order | `2205.10` | | `orders[].start_time` | string | | The start time in UTC | `2024-01-22T22:05:00Z` | | `orders[].end_time` | string | | The end time in UTC | `2024-04-22T22:05:00Z` | | `orders[].clip_size_type` | [enum](https://api-docs.anboto.xyz/reference/schemas/#clipsizetype) | | The clip size for the child orders. The default is AUTOMATIC — `ABSOLUTE`, `PERCENTAGE`, `AUTOMATIC`, `ORDER_COUNT` | `AUTOMATIC` | | `orders[].clip_size_val` | string | | The clip size value, required if the type is ABSOLUTE or PERCENTAGE | `0.01` | | `orders[].params` | [OrderParams](https://api-docs.anboto.xyz/reference/schemas/#orderparams) | | The advanced order parameters to modify the execution behavior. | | ## CreateMultiLegsParentOrderRequest Used for creating a parent order. | Field | Type | | Description | Example | | ----------------------- | ------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- | | `client_order_id` | string | | A custom string to identify the order | `ABC-12345^12-10-23` | | `subaccount` | string | | The sub-account under which to trade the order | | | `algo` | [enum](https://api-docs.anboto.xyz/reference/schemas/#multilegsalgo) | required | The execution strategy for the order. — `PAIR` | | | `legs` | array\[[CreateOrderLegRequest](https://api-docs.anboto.xyz/reference/schemas/#createorderlegrequest)\] | required | The order legs | | | `legs[].exchange` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) | required | The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) | | | `legs[].symbol` | string | required | The symbol using Anboto symbology, e.g. BTC/USDT | | | `legs[].asset_category` | [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) | required | The Asset category of the order. — `SPOT`, `FUTURE` | `SPOT` | | `legs[].side` | [enum](https://api-docs.anboto.xyz/reference/schemas/#side) | required | The side of the book to trade. — `BUY`, `SELL` | | | `legs[].target_value` | string | required | The target value to be filled | `12.0` | | `legs[].ccy` | string | required | The currency of target value | `USD` | | `legs[].limit_price` | string | | The exchange valid limit price for the order leg | `2205.10` | | `legs[].strategy` | [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) | required | The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` | | | `legs[].clip_size_type` | [enum](https://api-docs.anboto.xyz/reference/schemas/#clipsizetype) | | The clip size for the child orders. The default is AUTOMATIC — `ABSOLUTE`, `PERCENTAGE`, `AUTOMATIC`, `ORDER_COUNT` | `AUTOMATIC` | | `legs[].clip_size_val` | string | | The clip size value, required if the type is ABSOLUTE or PERCENTAGE | `0.01` | | `legs[].params` | [OrderLegParams](https://api-docs.anboto.xyz/reference/schemas/#orderlegparams) | | The advanced order parameters to modify the execution behavior. | | | `start_time` | string | | The start time in UTC | `2024-01-22T22:05:00Z` | | `end_time` | string | | The end time in UTC | `2024-04-22T22:05:00Z` | | `params` | [MultiLegsOrderParams](https://api-docs.anboto.xyz/reference/schemas/#multilegsorderparams) | | The advanced order parameters to modify the execution behavior. | | ## CreateOrderLegRequest Used for creating a parent order. | Field | Type | | Description | Example | | ------------------------- | ------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | | `exchange` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) | required | The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) | | | `symbol` | string | required | The symbol using Anboto symbology, e.g. BTC/USDT | | | `asset_category` | [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) | required | The Asset category of the order. — `SPOT`, `FUTURE` | `SPOT` | | `side` | [enum](https://api-docs.anboto.xyz/reference/schemas/#side) | required | The side of the book to trade. — `BUY`, `SELL` | | | `target_value` | string | required | The target value to be filled | `12.0` | | `ccy` | string | required | The currency of target value | `USD` | | `limit_price` | string | | The exchange valid limit price for the order leg | `2205.10` | | `strategy` | [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) | required | The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` | | | `clip_size_type` | [enum](https://api-docs.anboto.xyz/reference/schemas/#clipsizetype) | | The clip size for the child orders. The default is AUTOMATIC — `ABSOLUTE`, `PERCENTAGE`, `AUTOMATIC`, `ORDER_COUNT` | `AUTOMATIC` | | `clip_size_val` | string | | The clip size value, required if the type is ABSOLUTE or PERCENTAGE | `0.01` | | `params` | [OrderLegParams](https://api-docs.anboto.xyz/reference/schemas/#orderlegparams) | | The advanced order parameters to modify the execution behavior. | | | `params.duration_seconds` | string | | The duration of the order in seconds, this is a required field for TWAP and VWAP. | `120` | | `params.trading_style` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingstyle) | | The trading style of the order, the default is HYBRID — `PASSIVE`, `AGGRESSIVE`, `HYBRID` | | | `params.urgency` | [enum](https://api-docs.anboto.xyz/reference/schemas/#urgency) | | The Urgency or Risk Aversion of the IS strategy, the default is MEDIUM. The parameter is not case-sensitive. Each risk aversion levels correspond to a lambda value, "that is, how much we penalize variance relative to expected cost" Low : 0.2e-6 Medium: 1e-6 High: 5e-6 Based on the paper from Almgren Chriss https://www.smallake.kr/wp-content/uploads/2016/03/optliq.pdf — `LOW`, `MEDIUM`, `HIGH` | | | `params.randomize_amount` | boolean | | Whether to randomize the slice amount | | | `params.would` | [WouldInfo](https://api-docs.anboto.xyz/reference/schemas/#wouldinfo) | | Information to instruct how to execute a Would price trigger. | | | `params.trigger` | [TriggerInfo](https://api-docs.anboto.xyz/reference/schemas/#triggerinfo) | | Information related to how the order should be triggered. | | | `params.placement_infos` | [PlacementInfo](https://api-docs.anboto.xyz/reference/schemas/#placementinfo) | | How to place an order into the book | | | `params.is_leading` | boolean | | true if this is a leading leg | | ## CreateParentOrderRequest Used for creating a parent order. | Field | Type | | Description | Example | | ------------------------------- | ----------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | | `client_order_id` | string | | A custom string to identify the order | `ABC-12345^12-10-23` | | `exchange` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) | required | The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) | | | `subaccount` | string | | The sub-account under which to trade the order | | | `symbol` | string | required | The symbol using Anboto symbology, e.g. BTC/USDT | | | `asset_category` | [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) | required | The Asset category of the order. — `SPOT`, `FUTURE` | `SPOT` | | `side` | [enum](https://api-docs.anboto.xyz/reference/schemas/#side) | required | The side of the book to trade. — `BUY`, `SELL` | | | `quantity` | string | required | The quantity to trade as a exchange trade-able decimal value, e.g. 0.015 | | | `strategy` | [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) | required | The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` | | | `limit_price` | string | | The exchange valid limit price for the order | `2205.10` | | `start_time` | string | | The start time in UTC | `2024-01-22T22:05:00Z` | | `end_time` | string | | The end time in UTC | `2024-04-22T22:05:00Z` | | `clip_size_type` | [enum](https://api-docs.anboto.xyz/reference/schemas/#clipsizetype) | | The clip size for the child orders. The default is AUTOMATIC — `ABSOLUTE`, `PERCENTAGE`, `AUTOMATIC`, `ORDER_COUNT` | `AUTOMATIC` | | `clip_size_val` | string | | The clip size value, required if the type is ABSOLUTE or PERCENTAGE | `0.01` | | `params` | [OrderParams](https://api-docs.anboto.xyz/reference/schemas/#orderparams) | | The advanced order parameters to modify the execution behavior. | | | `params.duration_seconds` | string | | The duration of the order in seconds, this is a required field for TWAP and VWAP. | `120` | | `params.trading_style` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingstyle) | | The trading style of the order, the default is HYBRID — `PASSIVE`, `AGGRESSIVE`, `HYBRID` | | | `params.urgency` | [enum](https://api-docs.anboto.xyz/reference/schemas/#urgency) | | The Urgency or Risk Aversion of the IS strategy, the default is MEDIUM. The parameter is not case-sensitive. Each risk aversion levels correspond to a lambda value, "that is, how much we penalize variance relative to expected cost" Low : 0.2e-6 Medium: 1e-6 High: 5e-6 Based on the paper from Almgren Chriss https://www.smallake.kr/wp-content/uploads/2016/03/optliq.pdf — `LOW`, `MEDIUM`, `HIGH` | | | `params.randomize_amount` | boolean | | Whether to randomize the slice amount | | | `params.would` | [WouldInfo](https://api-docs.anboto.xyz/reference/schemas/#wouldinfo) | | Information to instruct how to execute a Would price trigger. | | | `params.trigger` | [TriggerInfo](https://api-docs.anboto.xyz/reference/schemas/#triggerinfo) | | Information related to how the order should be triggered. | | | `params.placement_infos` | [PlacementInfo](https://api-docs.anboto.xyz/reference/schemas/#placementinfo) | | How to place an order into the book | | | `params.reduce_only` | boolean | | Reduce Only for future positions | | | `params.start_ladder_price` | string | | Start price for Scale (ICEBERG) ladder | | | `params.end_ladder_price` | string | | End price for Scale (ICEBERG) ladder | | | `params.ladder_direction` | string | | Scale ladder direction: upwards or downwards | | | `params.ladder_profile` | string | | Scale ladder profile. Default: linear | | | `params.size_skew` | number | | Scale size skew (1 = linear). Default: 1 | | | `params.ob_imbalance_cancel` | boolean | | Cancel resting child orders and pause re-posting while the orderbook L1 imbalance leans against the order | | | `params.ob_imbalance_threshold` | string | | Opposing-side share of L1 quantity that triggers the imbalance cancel, between 0.5 and 0.99. Default: 0.75. Only used with ob_imbalance_cancel | `0.75` | | `params.price_lock_bps` | string | | Opportunistic completion: take the full remainder aggressively when the market is this many bps better than the arrival price, between 1 and 100 | `5` | | `params.post_only` | boolean | | Send passive placements post-only: the exchange rejects a child that would cross instead of matching it, so passive placements are maker-only. Would executions and deadline paths still cross by design. Currently supported on Binance only. | | ## Exchange_1 Values: `BINANCE`, `HUOBI`, `COINBASE_ADV`, `GATEIO`, `KRAKEN`, `KUCOIN`, `OKX`, `BYBIT`, `WOO`, `MEXC`, `BITGET`, `BULLISH`, `B2C2`, `HYPERLIQUID`, `COINBASE_PRIME`, `COINBASE_INTL`, `EXTENDED`, `LIGHTER` ## ExecutionStrategy The execution strategy for the order. Values: `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` ## FundingRate | Field | Type | | Description | Example | | ----------- | --------- | -------- | ----------- | ------- | | `exchange` | string | required | | | | `symbol` | string | required | | | | `time` | date-time | required | | | | `nextTime` | date-time | required | | | | `rate` | number | required | | | | `nextRate` | number | | | | | `markPrice` | number | | | | ## Instrument | Field | Type | | Description | Example | | --------------------------- | ----------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------- | ------- | | `exchange` | [enum](https://api-docs.anboto.xyz/reference/schemas/#exchange_1) | required | `BINANCE`, `HUOBI`, `COINBASE_ADV`, `GATEIO`, `KRAKEN`, `KUCOIN`, `OKX`, `BYBIT`, … (18 values) | | | `symbol` | string | required | | | | `baseAsset` | string | required | | | | `quoteAsset` | string | required | | | | `exchangeSymbol` | string | required | | | | `exchangeAssetClass` | string | required | | | | `assetClass` | [enum](https://api-docs.anboto.xyz/reference/schemas/#assetclass) | required | `UNDEFINED`, `SPOT`, `FUTURE`, `OPTION`, `CFD` | | | `quantityPrecision` | integer | | | | | `pricePrecision` | integer | | | | | `maxQuantityLimit` | number | | | | | `minQuantityLimit` | number | | | | | `minCostLimit` | number | | | | | `maxCostLimit` | number | | | | | `contractSize` | number | | | | | `minMarketLimit` | number | | | | | `maxMarketLimit` | number | | | | | `minPriceLimit` | number | | | | | `maxPriceLimit` | number | | | | | `enabled` | boolean | required | | | | `timestamp` | date-time | required | | | | `priceSignificantFigure` | integer | | | | | `quantitySignificantFigure` | integer | | | | | `assetId` | string | | | | ## MultiLegsAlgo The execution strategy for the order. Values: `PAIR` ## MultiLegsOrderParams The advanced order parameters to modify the execution behavior. Type: `object` ## OrderDetails | Field | Type | | Description | Example | | -------------------------- | ------------------------------------------------------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | `order_id` | integer | | The Anboto generated order id | `123456` | | `client_order_id` | string | | The client provided order id | `xxx-yyy-zzz` | | `symbol` | string | | The order symbol in Anboto's symbology | | | `status` | [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) | | The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) | | | `asset_class` | [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) | | The Asset category of the order. — `SPOT`, `FUTURE` | `SPOT` | | `exchange` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) | | The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) | | | `strategy` | [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) | | The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` | `VWAP` | | `start_time` | number | | The time when the order start trading from epoch time in ms | | | `end_time` | number | | The time when the order is finished from epoch time in ms | | | `filled_quantity` | number | required | The absolute amount of the order quantity filled | `0` | | `leaves_quantity` | number | required | The absolute amount of the order quantity remaining to be filled | `0` | | `side` | [enum](https://api-docs.anboto.xyz/reference/schemas/#side) | | The side of the book to trade. — `BUY`, `SELL` | | | `last_quantity` | number | required | The last qty received in a fill from the exchange | `0` | | `last_price` | number | required | The last price executed on the exchange | `0` | | `average_price` | number | required | The average execution price of the order | `0` | | `trades` | array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] | | The list of trades associated with this order when include_trades=true | | | `trades[].trade_id` | integer | | The trade id from exchange | `123456` | | `trades[].symbol` | string | required | The order symbol using Anboto symbology | | | `trades[].exchangeOrderId` | string | | The order id from exchange | | | `trades[].clientOrderId` | string | | The client order id | | | `trades[].quantity` | number | required | The absolute amount of the order quantity filled | `0` | | `trades[].price` | number | required | The traded price | `0` | | `trades[].direction` | string | | The direction of the trade | | | `trades[].makerOrTaker` | string | | The trade is from Maker or Taker | | | `trades[].execTime` | integer | | The time where the trade executed | | | `trades[].fee` | number | | The fee charged on the trade | | | `trades[].feeCurrency` | string | | The asset type the fee was charged in | | | `fees_infos` | object | | Aggregated fees per currency when include_fees=true | | ## OrderDetailsList | Field | Type | | Description | Example | | -------------------------- | ------------------------------------------------------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | `orders` | array\[[OrderDetails](https://api-docs.anboto.xyz/reference/schemas/#orderdetails)\] | required | The list of order details for separate orders. | | | `orders[].order_id` | integer | | The Anboto generated order id | `123456` | | `orders[].client_order_id` | string | | The client provided order id | `xxx-yyy-zzz` | | `orders[].symbol` | string | | The order symbol in Anboto's symbology | | | `orders[].status` | [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) | | The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) | | | `orders[].asset_class` | [enum](https://api-docs.anboto.xyz/reference/schemas/#assetcategory) | | The Asset category of the order. — `SPOT`, `FUTURE` | `SPOT` | | `orders[].exchange` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingexchange) | | The exchanges available for order placement via the API — `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, … (15 values) | | | `orders[].strategy` | [enum](https://api-docs.anboto.xyz/reference/schemas/#executionstrategy) | | The execution strategy for the order. — `TWAP`, `VWAP`, `ICEBERG`, `POV`, `MARKET`, `LIMIT`, `IS`, `SCALE` | `VWAP` | | `orders[].start_time` | number | | The time when the order start trading from epoch time in ms | | | `orders[].end_time` | number | | The time when the order is finished from epoch time in ms | | | `orders[].filled_quantity` | number | required | The absolute amount of the order quantity filled | `0` | | `orders[].leaves_quantity` | number | required | The absolute amount of the order quantity remaining to be filled | `0` | | `orders[].side` | [enum](https://api-docs.anboto.xyz/reference/schemas/#side) | | The side of the book to trade. — `BUY`, `SELL` | | | `orders[].last_quantity` | number | required | The last qty received in a fill from the exchange | `0` | | `orders[].last_price` | number | required | The last price executed on the exchange | `0` | | `orders[].average_price` | number | required | The average execution price of the order | `0` | | `orders[].trades` | array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] | | The list of trades associated with this order when include_trades=true | | | `orders[].fees_infos` | object | | Aggregated fees per currency when include_fees=true | | ## OrderLegParams The advanced order parameters to modify the execution behavior. | Field | Type | | Description | Example | | -------------------------------- | ----------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | `duration_seconds` | string | | The duration of the order in seconds, this is a required field for TWAP and VWAP. | `120` | | `trading_style` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingstyle) | | The trading style of the order, the default is HYBRID — `PASSIVE`, `AGGRESSIVE`, `HYBRID` | | | `urgency` | [enum](https://api-docs.anboto.xyz/reference/schemas/#urgency) | | The Urgency or Risk Aversion of the IS strategy, the default is MEDIUM. The parameter is not case-sensitive. Each risk aversion levels correspond to a lambda value, "that is, how much we penalize variance relative to expected cost" Low : 0.2e-6 Medium: 1e-6 High: 5e-6 Based on the paper from Almgren Chriss https://www.smallake.kr/wp-content/uploads/2016/03/optliq.pdf — `LOW`, `MEDIUM`, `HIGH` | | | `randomize_amount` | boolean | | Whether to randomize the slice amount | | | `would` | [WouldInfo](https://api-docs.anboto.xyz/reference/schemas/#wouldinfo) | | Information to instruct how to execute a Would price trigger. | | | `would.would_price` | string | | The price to trigger Would mode | | | `would.would_pct` | string | required | The percent of the order to trade when the Would price triggers | | | `would.would_style` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingstyle) | required | The trading style of the order, the default is HYBRID — `PASSIVE`, `AGGRESSIVE`, `HYBRID` | | | `would.would_is_arrival` | boolean | | Would price as arrival price | | | `trigger` | [TriggerInfo](https://api-docs.anboto.xyz/reference/schemas/#triggerinfo) | | Information related to how the order should be triggered. | | | `trigger.trigger_price` | string | required | The price to monitor for the trigger | | | `trigger.trigger_condition` | [enum](https://api-docs.anboto.xyz/reference/schemas/#triggercondition) | required | The trigger condition to start the order — `ABOVE`, `BELOW` | | | `placement_infos` | [PlacementInfo](https://api-docs.anboto.xyz/reference/schemas/#placementinfo) | | How to place an order into the book | | | `placement_infos.placement_mode` | [enum](https://api-docs.anboto.xyz/reference/schemas/#placementmode) | required | The style used to place an order in the book. DEFAULT is the default and will be at the discretion of the trading strategy — `DEFAULT`, `TIGHT`, `CUSTOM` | | | `placement_infos.placement` | string | | Where to place new orders in the book, e.g. 2 would slice at the second best observed price. | | | `placement_infos.cancel` | string | | At what level to cancel an existing order on the book, e.g. 6 would cancel the order when it got to level 6 in the book | | | `is_leading` | boolean | | true if this is a leading leg | | ## OrderParams The advanced order parameters to modify the execution behavior. | Field | Type | | Description | Example | | -------------------------------- | ----------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | `duration_seconds` | string | | The duration of the order in seconds, this is a required field for TWAP and VWAP. | `120` | | `trading_style` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingstyle) | | The trading style of the order, the default is HYBRID — `PASSIVE`, `AGGRESSIVE`, `HYBRID` | | | `urgency` | [enum](https://api-docs.anboto.xyz/reference/schemas/#urgency) | | The Urgency or Risk Aversion of the IS strategy, the default is MEDIUM. The parameter is not case-sensitive. Each risk aversion levels correspond to a lambda value, "that is, how much we penalize variance relative to expected cost" Low : 0.2e-6 Medium: 1e-6 High: 5e-6 Based on the paper from Almgren Chriss https://www.smallake.kr/wp-content/uploads/2016/03/optliq.pdf — `LOW`, `MEDIUM`, `HIGH` | | | `randomize_amount` | boolean | | Whether to randomize the slice amount | | | `would` | [WouldInfo](https://api-docs.anboto.xyz/reference/schemas/#wouldinfo) | | Information to instruct how to execute a Would price trigger. | | | `would.would_price` | string | | The price to trigger Would mode | | | `would.would_pct` | string | required | The percent of the order to trade when the Would price triggers | | | `would.would_style` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingstyle) | required | The trading style of the order, the default is HYBRID — `PASSIVE`, `AGGRESSIVE`, `HYBRID` | | | `would.would_is_arrival` | boolean | | Would price as arrival price | | | `trigger` | [TriggerInfo](https://api-docs.anboto.xyz/reference/schemas/#triggerinfo) | | Information related to how the order should be triggered. | | | `trigger.trigger_price` | string | required | The price to monitor for the trigger | | | `trigger.trigger_condition` | [enum](https://api-docs.anboto.xyz/reference/schemas/#triggercondition) | required | The trigger condition to start the order — `ABOVE`, `BELOW` | | | `placement_infos` | [PlacementInfo](https://api-docs.anboto.xyz/reference/schemas/#placementinfo) | | How to place an order into the book | | | `placement_infos.placement_mode` | [enum](https://api-docs.anboto.xyz/reference/schemas/#placementmode) | required | The style used to place an order in the book. DEFAULT is the default and will be at the discretion of the trading strategy — `DEFAULT`, `TIGHT`, `CUSTOM` | | | `placement_infos.placement` | string | | Where to place new orders in the book, e.g. 2 would slice at the second best observed price. | | | `placement_infos.cancel` | string | | At what level to cancel an existing order on the book, e.g. 6 would cancel the order when it got to level 6 in the book | | | `reduce_only` | boolean | | Reduce Only for future positions | | | `start_ladder_price` | string | | Start price for Scale (ICEBERG) ladder | | | `end_ladder_price` | string | | End price for Scale (ICEBERG) ladder | | | `ladder_direction` | string | | Scale ladder direction: upwards or downwards | | | `ladder_profile` | string | | Scale ladder profile. Default: linear | | | `size_skew` | number | | Scale size skew (1 = linear). Default: 1 | | | `ob_imbalance_cancel` | boolean | | Cancel resting child orders and pause re-posting while the orderbook L1 imbalance leans against the order | | | `ob_imbalance_threshold` | string | | Opposing-side share of L1 quantity that triggers the imbalance cancel, between 0.5 and 0.99. Default: 0.75. Only used with ob_imbalance_cancel | `0.75` | | `price_lock_bps` | string | | Opportunistic completion: take the full remainder aggressively when the market is this many bps better than the arrival price, between 1 and 100 | `5` | | `post_only` | boolean | | Send passive placements post-only: the exchange rejects a child that would cross instead of matching it, so passive placements are maker-only. Would executions and deadline paths still cross by design. Currently supported on Binance only. | | ## OrderStatus The order status Values: `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, `PAUSED`, `PENDING_UNPAUSE`, `EXPIRED`, `CANCEL_REJECTED` ## OrderSummary Summarizes the state of the parent order | Field | Type | | Description | Example | | ----------------- | ------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | | `order_id` | integer | | The Anboto assigned order identifier | | | `client_order_id` | string | | A custom string to identify the order | `ABC-12345^12-10-23` | | `status` | [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) | | The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) | | | `created_at` | date-time | required | The time in UTC when the order was created | `2024-01-22T22:05:00Z` | | `message` | string | | Any additional information, usually if the order was rejected | | | `error_code` | [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) | | The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) | `INVALID_ORDER` | ## OrderSummaryList | Field | Type | | Description | Example | | -------------------------- | ------------------------------------------------------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | | `orders` | array\[[OrderSummary](https://api-docs.anboto.xyz/reference/schemas/#ordersummary)\] | required | The list of order summaries for separate orders. | | | `orders[].order_id` | integer | | The Anboto assigned order identifier | | | `orders[].client_order_id` | string | | A custom string to identify the order | `ABC-12345^12-10-23` | | `orders[].status` | [enum](https://api-docs.anboto.xyz/reference/schemas/#orderstatus) | | The order status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) | | | `orders[].created_at` | date-time | required | The time in UTC when the order was created | `2024-01-22T22:05:00Z` | | `orders[].message` | string | | Any additional information, usually if the order was rejected | | | `orders[].error_code` | [enum](https://api-docs.anboto.xyz/reference/schemas/#apierrorcode) | | The error code used to describe why an order was rejected. — `OTHER`, `QUANTITY_EXCEED`, `AUTHENTICATION_ERROR`, `INSUFFICIENT_FUNDS`, `RATE_LIMIT_EXCEEDED`, `DDOS_PROTECTION`, `EXCHANGE_NOT_AVAILABLE`, `NETWORK_ERROR`, … (34 values) | `INVALID_ORDER` | ## PlacementInfo How to place an order into the book | Field | Type | | Description | Example | | ---------------- | -------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | `placement_mode` | [enum](https://api-docs.anboto.xyz/reference/schemas/#placementmode) | required | The style used to place an order in the book. DEFAULT is the default and will be at the discretion of the trading strategy — `DEFAULT`, `TIGHT`, `CUSTOM` | | | `placement` | string | | Where to place new orders in the book, e.g. 2 would slice at the second best observed price. | | | `cancel` | string | | At what level to cancel an existing order on the book, e.g. 6 would cancel the order when it got to level 6 in the book | | ## PlacementMode The style used to place an order in the book. DEFAULT is the default and will be at the discretion of the trading strategy Values: `DEFAULT`, `TIGHT`, `CUSTOM` ## Side The side of the book to trade. Values: `BUY`, `SELL` ## TradeDetails | Field | Type | | Description | Example | | ----------------- | ------- | -------- | ------------------------------------------------ | -------- | | `trade_id` | integer | | The trade id from exchange | `123456` | | `symbol` | string | required | The order symbol using Anboto symbology | | | `exchangeOrderId` | string | | The order id from exchange | | | `clientOrderId` | string | | The client order id | | | `quantity` | number | required | The absolute amount of the order quantity filled | `0` | | `price` | number | required | The traded price | `0` | | `direction` | string | | The direction of the trade | | | `makerOrTaker` | string | | The trade is from Maker or Taker | | | `execTime` | integer | | The time where the trade executed | | | `fee` | number | | The fee charged on the trade | | | `feeCurrency` | string | | The asset type the fee was charged in | | ## TradeDetailsList | Field | Type | | Description | Example | | -------------------------- | ------------------------------------------------------------------------------------ | -------- | ------------------------------------------------ | -------- | | `trades` | array\[[TradeDetails](https://api-docs.anboto.xyz/reference/schemas/#tradedetails)\] | required | The list of trade details | | | `trades[].trade_id` | integer | | The trade id from exchange | `123456` | | `trades[].symbol` | string | required | The order symbol using Anboto symbology | | | `trades[].exchangeOrderId` | string | | The order id from exchange | | | `trades[].clientOrderId` | string | | The client order id | | | `trades[].quantity` | number | required | The absolute amount of the order quantity filled | `0` | | `trades[].price` | number | required | The traded price | `0` | | `trades[].direction` | string | | The direction of the trade | | | `trades[].makerOrTaker` | string | | The trade is from Maker or Taker | | | `trades[].execTime` | integer | | The time where the trade executed | | | `trades[].fee` | number | | The fee charged on the trade | | | `trades[].feeCurrency` | string | | The asset type the fee was charged in | | ## TradingExchange The exchanges available for order placement via the API Values: `BINANCE`, `HUOBI`, `GATEIO`, `KUCOIN`, `OKX`, `BYBIT`, `BITGET`, `WOO`, `MEXC`, `BULLISH`, `B2C2`, `COINBASE_PRIME`, `COINBASE_INTL`, `HYPERLIQUID`, `LIGHTER` ## TradingStyle The trading style of the order, the default is HYBRID Values: `PASSIVE`, `AGGRESSIVE`, `HYBRID` ## TriggerCondition The trigger condition to start the order Values: `ABOVE`, `BELOW` ## TriggerInfo Information related to how the order should be triggered. | Field | Type | | Description | Example | | ------------------- | ----------------------------------------------------------------------- | -------- | ----------------------------------------------------------- | ------- | | `trigger_price` | string | required | The price to monitor for the trigger | | | `trigger_condition` | [enum](https://api-docs.anboto.xyz/reference/schemas/#triggercondition) | required | The trigger condition to start the order — `ABOVE`, `BELOW` | | ## Urgency The Urgency or Risk Aversion of the IS strategy, the default is MEDIUM. The parameter is not case-sensitive. Each risk aversion levels correspond to a lambda value, "that is, how much we penalize variance relative to expected cost" Low : 0.2e-6 Medium: 1e-6 High: 5e-6 Based on the paper from Almgren Chriss https://www.smallake.kr/wp-content/uploads/2016/03/optliq.pdf Values: `LOW`, `MEDIUM`, `HIGH` ## WouldInfo Information to instruct how to execute a Would price trigger. | Field | Type | | Description | Example | | ------------------ | ------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------- | ------- | | `would_price` | string | | The price to trigger Would mode | | | `would_pct` | string | required | The percent of the order to trade when the Would price triggers | | | `would_style` | [enum](https://api-docs.anboto.xyz/reference/schemas/#tradingstyle) | required | The trading style of the order, the default is HYBRID — `PASSIVE`, `AGGRESSIVE`, `HYBRID` | | | `would_is_arrival` | boolean | | Would price as arrival price | | # Status GET `https://api.pro.anboto.xyz/status/ping` Returns service status and the current server timestamp in milliseconds. No authentication required. ### Responses | | | | --- | ------------- | | 200 | Service is up | ``` curl -X GET "$BASE/status/ping" ``` ``` r = requests.get(f"{BASE}/status/ping") print(r.json()) ``` ``` let resp = client .get(format!("{BASE}/status/ping")) .send()?; println!("{}", resp.text()?); ``` ``` req, _ := http.NewRequest("GET", BASE+"/status/ping", nil) resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() io.Copy(os.Stdout, resp.Body) ``` ``` HttpResponse resp = client.send( signedGet("/status/ping"), HttpResponse.BodyHandlers.ofString()); ``` ``` const res = await fetch(`${BASE}/status/ping`, { method: "GET", }); const data = await res.json(); ``` ``` val request = signedGet("/status/ping") val response = client.send(request, HttpResponse.BodyHandlers.ofString()) println(response.body()) ``` ``` cpr::Response r = cpr::Get( cpr::Url{BASE + "/status/ping"}); std::cout << r.text << std::endl; ``` ``` const res = await fetch(`${BASE}/status/ping`, { method: "GET", }); console.log(await res.json()); ``` **Response** 200 ``` "{status=ok, timestamp=1783329083000}" ``` # balance WS `wss://api.pro.anboto.xyz/api/v2/ws` Channel for subscribing to asset balance updates for a specific exchange Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `balance` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `balance` decimal Total balance `free` decimal Available balance `symbol` string required Asset symbol `timestamp` integer required Unix timestamp in milliseconds ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | ``` { "topic": "balance", "exchange": "OKX", "method": "subscribe" } ``` ``` { "topic": "balance", "exchange": "OKX", "method": "unsubscribe" } ``` **Update** balance ``` { "balance": "100000.00", "free": "95000.00", "symbol": "USDT", "timestamp": 1708840800000 } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # child_order WS `wss://api.pro.anboto.xyz/api/v2/ws` Channel for subscribing to child-order (slice) updates; subscribe with {"topic":"child_order","exchange":...,"method":"subscribe"} Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `child_order` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `orderStatus` OrderStatusObj Order Status `orderStatus.source` string Component sending the status `orderStatus.orderId` int64 Anboto's order Id `orderStatus.clientOrderId` string Client referenced order Id `orderStatus.extId` string Order Id from exchange `orderStatus.exchangeId` integer Exchange Id `orderStatus.status` enum Order Status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orderStatus.createdAt` integer Unix timestamp of this status change in milliseconds `orderStatus.filledQuantity` integer filled quantity of the order `orderStatus.leavesQuantity` integer leave quantity of the order `orderStatus.side` enum order side — `BUY`, `SELL` `orderStatus.averagePrice` decimal average price of the fills `orderStatus.message` string Status message `orderStatus.errorCode` string Error code `order` object Child order context: orderId, clientOrderId, parentOrderId, exchangeId, exchangeName, symbol, assetClass, side, quantity, limitPrice, tif, expiryTime, createdAt, orderType. `orderProgress` number Execution progress of the parent order, 0..1 ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | **Update** child_order ``` { "orderStatus": { "source": "string", "orderId": "string", "clientOrderId": "string", "extId": "string", "exchangeId": 0, "status": "PENDING_NEW", "createdAt": 0, "filledQuantity": 0, "leavesQuantity": 0, "side": "BUY", "averagePrice": "string", "message": "string", "errorCode": "string" }, "order": {}, "orderProgress": 0.0 } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # WebSocket API v2.0.0 Real-time streams for orders, child orders, trades, positions, position risk, balances and market data. **Read-only** — orders are placed and cancelled through the REST API. [Download AsyncAPI spec](https://api-docs.anboto.xyz/spec/asynapi.yml) · [OpenAPI (REST) spec](https://api-docs.anboto.xyz/spec/anboto-trading-api-2.0.yml) ## Endpoints | Environment | URL | | ----------- | ---------------------------------------- | | Production | `wss://api.pro.anboto.xyz/api/v2/ws` | | Testnet | `wss://api.testnet.anboto.xyz/api/v2/ws` | ## Authentication 1. Call `GET /api/v2/trading/listenKey` ([guide](https://api-docs.anboto.xyz/resources/websocket/#authentication-listenkey)) — signed like any REST request. The response body is a listenKey (JWT, valid **1 hour**). 1. Connect to `wss:///api/v2/ws?listenKey=`, or send `Authorization: Bearer ` as a handshake header (keeps the token out of proxy logs). Invalid or expired listenKey → handshake rejected with HTTP 401. Checked at handshake only; open connections are not dropped on expiry, but every reconnect needs a fresh key. A read-only API key is sufficient. Details: [WebSocket guide](https://api-docs.anboto.xyz/resources/websocket/index.md). ## Keep-alive Server sends `{"topic":"ping"}` every 60 s — reply `{"topic":"pong"}`. No client message for 5 min → close 1001. Subscriptions are per connection: re-subscribe after every reconnect. See [Keep-alive](https://api-docs.anboto.xyz/reference/ws-keep-alive/index.md). ## Subscribing All messages are JSON text frames. One subscription per `(topic, exchange)` pair per connection. ``` {"topic": "order", "exchange": "binance", "method": "subscribe"} ``` | Field | | Description | | ---------- | -------- | -------------------------------------- | | `topic` | required | one of the topics below | | `exchange` | required | any trading exchange, case-insensitive | | `method` | required | `subscribe` / `unsubscribe` | Every request gets `{code, message}` back — `0` = ack; non-zero codes in [Errors](https://api-docs.anboto.xyz/resources/errors/#websocket). ## Topics | | Topic | Description | | --- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | WS | [position](https://api-docs.anboto.xyz/reference/ws-position/index.md) | Channel for subscribing to account position updates for a specific exchange | | WS | [balance](https://api-docs.anboto.xyz/reference/ws-balance/index.md) | Channel for subscribing to asset balance updates for a specific exchange | | WS | [order](https://api-docs.anboto.xyz/reference/ws-order/index.md) | Channel for subscribing to order updates for a specific exchange | | WS | [trade](https://api-docs.anboto.xyz/reference/ws-trade/index.md) | Channel for subscribing to trade (fill) updates for a specific exchange | | WS | [child_order](https://api-docs.anboto.xyz/reference/ws-child-order/index.md) | Channel for subscribing to child-order (slice) updates; subscribe with | | WS | [position_risk](https://api-docs.anboto.xyz/reference/ws-position-risk/index.md) | Channel for subscribing to position risk telemetry; subscribe with | | WS | [ticker](https://api-docs.anboto.xyz/reference/ws-ticker/index.md) | Best bid/offer stream per symbol; subscribe with {"topic":"ticker","exchange":...,"symbol":"BTC/USDT","method":"subscribe"}. Market data subscriptions are capped per connection and may be disabled per environment. | | WS | [ohlcv](https://api-docs.anboto.xyz/reference/ws-ohlcv/index.md) | Candlestick stream per symbol; subscribe with | | WS | [open_interest](https://api-docs.anboto.xyz/reference/ws-open-interest/index.md) | Open interest stream per symbol; subscribe with {"topic":"open_interest","exchange":...,"symbol":"BTC/USDT","method":"subscribe"}. Market data subscriptions are capped per connection and may be disabled per environment. | | WS | [Keep-alive (ping/pong)](https://api-docs.anboto.xyz/reference/ws-keep-alive/index.md) | Keep-alive channel for maintaining WebSocket connection | Limits: [Rate limits](https://api-docs.anboto.xyz/resources/rate-limits/#websocket). # Keep-alive (ping/pong) WS `wss://api.pro.anboto.xyz/api/v2/ws` Keep-alive channel for maintaining WebSocket connection Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Responses | | | | ---- | --------------------------------------------------- | | pong | Reply to every server ping; idle 5 min → close 1001 | ``` { "topic": "ping" } ``` ``` { "topic": "pong" } ``` # ohlcv WS `wss://api.pro.anboto.xyz/api/v2/ws` Candlestick stream per symbol; subscribe with {"topic":"ohlcv","exchange":...,"symbol":"BTC/USDT","method":"subscribe"} Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `ohlcv` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `symbol` string `exchange` string `assetClass` string `open` number `high` number `low` number `close` number `volume` number `last` number `openTime` integer `closeTime` integer `interval` enum `ONE_MINUTE`, `FIVE_MINUTE`, `FIFTEEN_MINUTE`, `THIRTY_MINUTE`, `ONE_HOUR`, `SIX_HOUR`, `ONE_DAY` ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | **Update** ohlcv ``` { "symbol": "string", "exchange": "string", "assetClass": "string", "open": 0.0, "high": 0.0, "low": 0.0, "close": 0.0, "volume": 0.0, "last": 0.0, "openTime": 0, "closeTime": 0, "interval": "ONE_MINUTE" } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # open_interest WS `wss://api.pro.anboto.xyz/api/v2/ws` Open interest stream per symbol; subscribe with {"topic":"open_interest","exchange":...,"symbol":"BTC/USDT","method":"subscribe"}. Market data subscriptions are capped per connection and may be disabled per environment. Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `open_interest` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `symbol` string `exchange` string `assetClass` string `openInterest` number contracts/base units as reported by the exchange `openInterestValue` number quote currency value when available `timestamp` integer ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | **Update** open_interest ``` { "symbol": "string", "exchange": "string", "assetClass": "string", "openInterest": 0.0, "openInterestValue": 0.0, "timestamp": 0 } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # order WS `wss://api.pro.anboto.xyz/api/v2/ws` Channel for subscribing to order updates for a specific exchange Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `order` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `orderStatus` OrderStatusObj Order Status `orderStatus.source` string Component sending the status `orderStatus.orderId` int64 Anboto's order Id `orderStatus.clientOrderId` string Client referenced order Id `orderStatus.extId` string Order Id from exchange `orderStatus.exchangeId` integer Exchange Id `orderStatus.status` enum Order Status — `PENDING_NEW`, `ACCEPTED`, `REJECTED`, `PARTIALLY_FILLED`, `FILLED`, `PENDING_CANCEL`, `CANCELLED`, `PENDING_PAUSE`, … (12 values) `orderStatus.createdAt` integer Unix timestamp of this status change in milliseconds `orderStatus.filledQuantity` integer filled quantity of the order `orderStatus.leavesQuantity` integer leave quantity of the order `orderStatus.side` enum order side — `BUY`, `SELL` `orderStatus.averagePrice` decimal average price of the fills `orderStatus.message` string Status message `orderStatus.errorCode` string Error code `order` object The order context: orderId, clientOrderId, exchangeId, exchangeName, subaccount, symbol, assetClass, side, quantity, limitPrice, strategy, orderType, tif, createdAt, startTime, endTime, clipSizeType, clipSizeVal, targetValue, feeUrgency, params, source, linkId. Multi-leg orders carry algo and legs[] instead of the single-symbol fields. `orderProgress` number Execution progress of the parent order, 0..1 `mishedge` number Multi-leg only — current mishedge between the legs ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | ``` { "topic": "order", "exchange": "BINANCE", "method": "subscribe" } ``` ``` { "topic": "order", "exchange": "BINANCE", "method": "unsubscribe" } ``` **Update** order ``` { "orderStatus": { "clientOrderId": "554500941080543232", "createdAt": 1773198526482, "filledQuantity": 0, "leavesQuantity": 0, "orderId": "554500941080543233", "side": "BUY", "source": "ods-764fc58e30", "status": "PENDING_NEW" }, "order": { "orderId": "554500941080543233", "clientOrderId": "554500941080543232", "exchangeId": 1, "exchangeName": "BINANCE", "symbol": "BTC/USDT", "assetClass": "SPOT", "side": "BUY", "quantity": 1.0, "strategy": "TWAP", "orderType": "LIMIT", "createdAt": 1773198526000, "startTime": 1773198526000, "endTime": 1773202126000 }, "orderProgress": 0 } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # position_risk WS `wss://api.pro.anboto.xyz/api/v2/ws` Channel for subscribing to position risk telemetry; subscribe with {"topic":"position_risk","exchange":...,"method":"subscribe"} Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `position_risk` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `exchangeId` integer `subaccount` string `error` string `positionRisk` object `positionRisk.symbol` string `positionRisk.contracts` number `positionRisk.contractSize` number `positionRisk.unrealizedPnl` number `positionRisk.leverage` number `positionRisk.liquidationPrice` number `positionRisk.collateral` number `positionRisk.notional` number `positionRisk.markPrice` number `positionRisk.entryPrice` number `positionRisk.timestamp` integer `positionRisk.initialMargin` number `positionRisk.initialMarginPercentage` number `positionRisk.maintenanceMargin` number `positionRisk.maintenanceMarginPercentage` number `positionRisk.marginRatio` number `positionRisk.marginMode` string `positionRisk.side` string `positionRisk.hedged` boolean `positionRisk.percentage` number `positionRisk.stopLossPrice` number `positionRisk.takeProfitPrice` number ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | **Update** position_risk ``` { "exchangeId": 0, "subaccount": "string", "error": "string", "positionRisk": { "symbol": "string", "contracts": 0.0, "contractSize": 0.0, "unrealizedPnl": 0.0, "leverage": 0.0, "liquidationPrice": 0.0, "collateral": 0.0, "notional": 0.0, "markPrice": 0.0, "entryPrice": 0.0, "timestamp": 0, "initialMargin": 0.0, "initialMarginPercentage": 0.0, "maintenanceMargin": 0.0, "maintenanceMarginPercentage": 0.0, "marginRatio": 0.0, "marginMode": "string", "side": "string", "hedged": true, "percentage": 0.0, "stopLossPrice": 0.0, "takeProfitPrice": 0.0 } } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # position WS `wss://api.pro.anboto.xyz/api/v2/ws` Channel for subscribing to account position updates for a specific exchange Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `position` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `collateral` decimal Collateral amount for the position `contracts` decimal Number of contracts `entryPrice` decimal Average entry price `leverage` decimal Position leverage `liquidationPrice` decimal Liquidation price `marginMode` enum Margin mode for the position — `CROSS`, `ISOLATED` `markPrice` decimal Current mark price `notional` decimal Notional value of the position `side` enum Position side — `LONG`, `SHORT`, `BOTH` `symbol` string required Trading symbol `timestamp` integer required Unix timestamp in milliseconds `unrealizedPnl` decimal Unrealized profit and loss `instrument` Instrument Trading instrument details `instrument.assetClass` enum Asset class of the instrument — `UNDEFINED`, `SPOT`, `FUTURE`, `OPTION`, `CFD` `instrument.assetId` string Unique asset identifier `instrument.baseAsset` string Base asset symbol `instrument.contractSize` number Contract size `instrument.enabled` boolean required Whether the instrument is enabled for trading `instrument.exchangeAssetClass` string Exchange-specific asset class `instrument.exchangeSymbol` string Symbol as used on the exchange `instrument.maxCostLimit` number Maximum cost limit `instrument.maxMarketLimit` number Maximum market order limit `instrument.maxPriceLimit` number Maximum price limit `instrument.maxQuantityLimit` number Maximum quantity limit `instrument.minCostLimit` number Minimum cost limit `instrument.minMarketLimit` number Minimum market order limit `instrument.minPriceLimit` number Minimum price limit `instrument.minQuantityLimit` number Minimum quantity limit `instrument.pricePrecision` integer Price decimal precision `instrument.priceSignificantFigure` integer Price significant figures `instrument.quantityPrecision` integer Quantity decimal precision `instrument.quantitySignificantFigure` integer Quantity significant figures `instrument.quoteAsset` string Quote asset symbol `instrument.symbol` string Instrument symbol `instrument.timestamp` date-time Last update timestamp ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | ``` { "topic": "position", "exchange": "BINANCE", "method": "subscribe" } ``` ``` { "topic": "position", "exchange": "BINANCE", "method": "unsubscribe" } ``` **Update** position ``` { "collateral": "50000.00", "contracts": "2.5", "entryPrice": "45000.00", "leverage": "10.0", "liquidationPrice": "40500.00", "marginMode": "CROSS", "markPrice": "46000.00", "notional": "115000.00", "side": "LONG", "symbol": "BTC-USDT", "timestamp": 1708840800000, "unrealizedPnl": "2500.00", "instrument": { "assetClass": "FUTURE", "symbol": "BTC-USDT", "baseAsset": "BTC", "quoteAsset": "USDT" } } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # ticker WS `wss://api.pro.anboto.xyz/api/v2/ws` Best bid/offer stream per symbol; subscribe with {"topic":"ticker","exchange":...,"symbol":"BTC/USDT","method":"subscribe"}. Market data subscriptions are capped per connection and may be disabled per environment. Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `ticker` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `symbol` string `exchange` string `assetClass` string `bid` number `ask` number `bidQty` number `askQty` number `timestamp` integer ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | **Update** ticker ``` { "symbol": "string", "exchange": "string", "assetClass": "string", "bid": 0.0, "ask": 0.0, "bidQty": 0.0, "askQty": 0.0, "timestamp": 0 } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ``` # trade WS `wss://api.pro.anboto.xyz/api/v2/ws` Channel for subscribing to trade (fill) updates for a specific exchange Authenticate the connection with a listenKey — see [WebSocket](https://api-docs.anboto.xyz/resources/websocket/index.md). ### Subscribe message `topic` string required `trade` `exchange` string required Trading exchange, case-insensitive Example: `BINANCE` `method` enum required `subscribe` / `unsubscribe` ### Update message fields `tradeId` string Anboto's trade Id `orderId` integer Order where the trade belong `symbol` string the symbol of the trade `takerOrMaker` enum maker or taker of the trade — `MAKER`, `TAKER` `price` decimal the price of the trade `amount` decimal the quantity of the trade `cost` decimal the notional of the trade `feeCurrency` string fee currency `feeCost` decimal the fee of the trade `timestamp` integer Unix timestamp of this status change in milliseconds `extTradeId` string trade Id from exchange `extOrderId` string order Id of the trade from exchnage ### Responses | | | | -------- | ------------------------------------------------------------------------------------------------------------ | | code 0 | Acknowledgment of successful subscription | | code ≠ 0 | Error response for failed subscription — see [Errors](https://api-docs.anboto.xyz/resources/errors/index.md) | ``` { "topic": "trade", "exchange": "BINANCE", "method": "subscribe" } ``` ``` { "topic": "order", "exchange": "BINANCE", "method": "unsubscribe" } ``` **Update** trade ``` { "tradeId": 151990408, "orderId": "558547168212975616", "symbol": "KITE/USDT:USDT", "side": "SELL", "takerOrMaker": "MAKER", "price": 0.21735, "amount": 153, "cost": 33.25455, "feeCurrency": "BNB", "feeCost": 7.55e-06, "timestamp": null, "extTradeId": 1204004183, "extOrderId": 151990408, "clientOrderId": "554500941080543232" } ``` **Ack** code 0 ``` { "code": 0, "message": "string" } ```