{ "openapi": "3.1.0", "info": { "title": "ekiden-gateway", "description": "API Gateway and WebSocket proxy based on Axum and Utoipa, handling auth, rate limiting, and connection buffering.", "license": { "name": "" }, "version": "0.1.1" }, "servers": [ { "url": "https://api.ekiden.fi/", "description": "Production" }, { "url": "https://api.staging.ekiden.fi/", "description": "Staging" }, { "url": "https://api.dev.ekiden.fi/", "description": "Development" }, { "url": "http://localhost:4020/", "description": "Local" } ], "paths": { "/api/v1/account/balance": { "get": { "tags": [ "Account" ], "summary": "Get Account Balance", "description": "Query account balances. Returns all subaccounts' vault balances.", "operationId": "get_account_balance", "responses": { "200": { "description": "Balances", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAccountBalanceResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/account/fund": { "post": { "tags": [ "Account" ], "operationId": "fund", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FundRequest" } } }, "required": true }, "responses": { "200": { "description": "Funding request successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FundResult" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limit exceeded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/account/statistics": { "get": { "tags": [ "Account" ], "summary": "Get Account Statistics", "description": "Returns historical snapshots of equity, PnL, volume, and ROI. When step is omitted, raw snapshots are returned, otherwise time bucketed by day/week/month. Optional sub_account_address: when set, the result includes only specified subaccount, otherwise all of the user's subaccounts;. Default limit 100, max 1000.", "operationId": "get_account_statistics", "parameters": [ { "name": "sub_account_address", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "step", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "type": "string", "description": "Temporal resolution for statistics. Single-letter shorthands are allowed(h/d/w/m).", "enum": [ "hour", "day", "week", "month" ] } ] } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "sorting_order", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "type": "string", "description": "Sort direction for account statistics snapshots (older/newer first).", "enum": [ "asc", "desc" ] } ] } } ], "responses": { "200": { "description": "Account statistics", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAccountStatisticsResponse" } } } }, "400": { "description": "Bad Request" }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/account/withdraw-from-trading": { "post": { "tags": [ "Account" ], "summary": "Withdraw from Trading", "description": "Initiate a withdrawal from a Trading vault to the Funding vault.", "operationId": "withdraw_from_trading", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WithdrawFromTradingRequest" } } }, "required": true }, "responses": { "200": { "description": "Withdrawal initiated" } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/authorize": { "post": { "tags": [ "User" ], "summary": "Authorize User", "description": "Authorize and obtain an access token", "operationId": "authorize", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthorizeRequest" } } }, "required": true }, "responses": { "200": { "description": "Successfully authorized and token generated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthorizeResponse" } } } } } } }, "/api/v1/authorize/session": { "post": { "tags": [ "User" ], "summary": "Authorize Session", "description": "Authorize a session key via delegation", "operationId": "authorize_session", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionAuthRequest" } } }, "required": true }, "responses": { "200": { "description": "Successfully authorized and token generated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthorizeResponse" } } } } } } }, "/api/v1/authorize/whitelist/check": { "get": { "tags": [ "User" ], "operationId": "check_root_whitelist", "parameters": [ { "name": "root_address", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } }, { "name": "root_public_key", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Whitelist status", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RootWhitelistResponse" } } } }, "400": { "description": "Bad request" } } } }, "/api/v1/authorize/whitelist/{root_address}": { "put": { "tags": [ "User" ], "operationId": "add_root_whitelist_entry", "parameters": [ { "name": "root_address", "in": "path", "description": "Canonical or short Aptos root address", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Root address added to whitelist", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RootWhitelistResponse" } } } }, "401": { "description": "Unauthorized" }, "500": { "description": "Internal server error" } }, "security": [ { "root_whitelist_basic_auth": [] } ] }, "delete": { "tags": [ "User" ], "operationId": "remove_root_whitelist_entry", "parameters": [ { "name": "root_address", "in": "path", "description": "Canonical or short Aptos root address", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Root address removed from whitelist", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RootWhitelistResponse" } } } }, "401": { "description": "Unauthorized" }, "500": { "description": "Internal server error" } }, "security": [ { "root_whitelist_basic_auth": [] } ] } }, "/api/v1/competitions": { "get": { "tags": [ "competitions" ], "operationId": "get_public_competitions", "parameters": [ { "name": "status", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/CompetitionStatus" } ] } } ], "responses": { "200": { "description": "Public competitions list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListCompetitionsResponse" } } } } } } }, "/api/v1/competitions/{competition_slug}": { "get": { "tags": [ "competitions" ], "operationId": "get_public_competition", "parameters": [ { "name": "competition_slug", "in": "path", "description": "Competition slug", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Public competition detail", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompetitionSummary" } } } }, "404": { "description": "Competition not found" } } } }, "/api/v1/competitions/{competition_slug}/leaderboard": { "get": { "tags": [ "competitions" ], "operationId": "get_public_competition_leaderboard", "parameters": [ { "name": "competition_slug", "in": "path", "description": "Competition slug", "required": true, "schema": { "type": "string" } }, { "name": "offset", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "sub_account", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Public competition leaderboard", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompetitionLeaderboardResponse" } } } }, "404": { "description": "Competition not found" } } } }, "/api/v1/execution/list": { "get": { "tags": [ "Trade" ], "summary": "Get Trade History", "description": "Query users' execution records, sorted by execTime in descending order.", "operationId": "get_trade_history", "parameters": [ { "name": "sub_account_address", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "order_id", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderId" } ] } }, { "name": "order_link_id", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Trade history", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetTradeHistoryResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/info": { "get": { "tags": [ "System" ], "summary": "Get system configuration and discovery info", "operationId": "get_system_info", "responses": { "200": { "description": "System info retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SystemInfo" } } } } } } }, "/api/v1/market/account-ratio": { "get": { "tags": [ "Market" ], "summary": "Get Long Short Ratio", "description": "This refers to the net long and short positions as percentages of all position holders during the selected time.\nLong account ratio = Number of holders with long positions / Total number of holders\nShort account ratio = Number of holders with short positions / Total number of holders\nLong-short account ratio = Long account ratio / Short account ratio", "operationId": "get_long_short_ratio", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } }, { "name": "period", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/IntervalTime" } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "cursor", "in": "query", "description": "Cursor. Use the next_page_cursor token from the response to retrieve the next page of the data set", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Long short ratio data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetLongShortRatioResponse" } } } } } } }, "/api/v1/market/adl-alert": { "get": { "tags": [ "Market" ], "summary": "Get ADL Alerts", "description": "Get the latest ADL alert snapshot for one symbol or all pools.", "operationId": "get_adl_alert", "parameters": [ { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } } ], "responses": { "200": { "description": "ADL alert snapshots", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAdlAlertsResponse" } } } }, "503": { "description": "Trading temporarily unavailable" } } } }, "/api/v1/market/adl-alert/history": { "get": { "tags": [ "Market" ], "summary": "Get ADL Alert History", "description": "Get archived ADL alert snapshots for one symbol or all pools.", "operationId": "get_adl_alert_history", "parameters": [ { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "ADL alert history", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAdlAlertsHistoryResponse" } } } } } } }, "/api/v1/market/funding/history": { "get": { "tags": [ "Market" ], "summary": "Get Funding Rate History", "description": "Query for historical funding rates. Each symbol has a different funding interval. For example, if the interval is 8 hours and the current time is UTC 12, then it returns the last funding rate, which settled at UTC 8.", "operationId": "get_funding_rate_history", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Funding rate history", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetFundingRateHistoryResponse" } } } } } } }, "/api/v1/market/index-price-kline": { "get": { "tags": [ "Market" ], "summary": "Get Index Price Kline", "description": "Query for historical index price klines. Charts are returned in groups based on the requested interval.", "operationId": "get_index_price_kline", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } }, { "name": "interval", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Interval" } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Klines", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetPriceKlineResponse" } } } } } } }, "/api/v1/market/instruments-info": { "get": { "tags": [ "Market" ], "operationId": "get_instruments_info", "responses": { "200": { "description": "Get all instruments information", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetInstrumentsInfoResponse" } } } } } } }, "/api/v1/market/insurance-pool": { "get": { "tags": [ "Market" ], "summary": "Get Insurance Pool", "description": "Get the latest insurance pool snapshot for one symbol or all pools.", "operationId": "get_insurance_pool", "parameters": [ { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } } ], "responses": { "200": { "description": "Insurance pool snapshots", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetInsurancePoolResponse" } } } }, "503": { "description": "Trading temporarily unavailable" } } } }, "/api/v1/market/insurance-pool/history": { "get": { "tags": [ "Market" ], "summary": "Get Insurance Pool History", "description": "Get archived insurance pool snapshots for one symbol or all pools.", "operationId": "get_insurance_pool_history", "parameters": [ { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Insurance pool history", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetInsurancePoolHistoryResponse" } } } } } } }, "/api/v1/market/kline": { "get": { "tags": [ "Market" ], "summary": "Get Kline", "description": "Query for historical klines (also known as candles/candlesticks). Charts are returned in groups based on the requested interval.", "operationId": "get_kline", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } }, { "name": "interval", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Interval" } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Klines", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetKlineResponse" } } } } } } }, "/api/v1/market/mark-price-kline": { "get": { "tags": [ "Market" ], "summary": "Get Mark Price Kline", "description": "Query for historical mark price klines. Charts are returned in groups based on the requested interval.", "operationId": "get_mark_price_kline", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } }, { "name": "interval", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Interval" } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Klines", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetPriceKlineResponse" } } } } } } }, "/api/v1/market/open-interest": { "get": { "tags": [ "Market" ], "summary": "Get Open Interest", "description": "Get historical open interest snapshots for one symbol. Values are returned as closed interval buckets sorted newest first.", "operationId": "get_open_interest", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } }, { "name": "interval", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/IntervalTime" } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Open interest data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOpenInterestResponse" } } } } } } }, "/api/v1/market/orderbook": { "get": { "tags": [ "Market" ], "summary": "Get Orderbook", "description": "Query for orderbook depth data.", "operationId": "get_orderbook", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } }, { "name": "depth", "in": "query", "description": "Depth level", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Depth" } ] } } ], "responses": { "200": { "description": "Orderbook", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOrderBookResponse" } } } } } } }, "/api/v1/market/price-limit": { "get": { "tags": [ "Market" ], "summary": "Get Order Price Limit", "description": "Query for order price limit parameters.", "operationId": "get_order_price_limit", "parameters": [ { "name": "symbol", "in": "query", "required": true, "schema": { "$ref": "#/components/schemas/Symbol" } } ], "responses": { "200": { "description": "Order price limit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderPriceLimit" } } } } } } }, "/api/v1/market/recent-trade": { "get": { "tags": [ "Market" ], "summary": "Get Recent Trades", "description": "Query for recent public trades, optionally filtered by symbol.", "operationId": "get_recent_trade", "parameters": [ { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Recent trades", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetRecentTradeResponse" } } } }, "400": { "description": "Bad Request" } } } }, "/api/v1/market/risk-limit": { "get": { "tags": [ "Market" ], "summary": "Get Risk Limit", "description": "Query for the risk limit margin parameters.", "operationId": "get_risk_limit", "parameters": [ { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "cursor", "in": "query", "description": "Cursor. Use the next_page_cursor token from the response to retrieve the next page of the data set", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Risk limit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetRiskLimitResponse" } } } } } } }, "/api/v1/market/tickers": { "get": { "tags": [ "Market" ], "summary": "Get Tickers", "description": "Query for the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.", "operationId": "get_tickers", "parameters": [ { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } } ], "responses": { "200": { "description": "Tickers", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetTickersResponse" } } } }, "400": { "description": "Bad Request" }, "404": { "description": "Not Found: tickers" } } } }, "/api/v1/order/amend": { "post": { "tags": [ "Trade" ], "summary": "Amend Order", "description": "Amend an existing order", "operationId": "amend_order", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AmendOrderRequest" } } }, "required": true }, "responses": { "200": { "description": "Order amended", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AmendOrderResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/amend-batch": { "post": { "tags": [ "Trade" ], "summary": "Batch Amend Orders", "description": "Amend multiple existing orders in a single request", "operationId": "batch_amend_orders", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchAmendOrdersRequest" } } }, "required": true }, "responses": { "200": { "description": "Orders amended", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchAmendOrdersResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/cancel": { "post": { "tags": [ "Trade" ], "summary": "Cancel Order", "description": "Cancel an existing order", "operationId": "cancel_order", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CancelOrderRequest" } } }, "required": true }, "responses": { "200": { "description": "Order canceled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CancelOrderResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/cancel-all": { "post": { "tags": [ "Trade" ], "summary": "Cancel All Orders", "description": "Cancel all existing orders for a user", "operationId": "cancel_all_orders", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CancelAllOrdersRequest" } } }, "required": true }, "responses": { "200": { "description": "Orders canceled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CancelAllOrdersResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/cancel-batch": { "post": { "tags": [ "Trade" ], "summary": "Batch Cancel Orders", "description": "Cancel multiple existing orders in a single request", "operationId": "batch_cancel_orders", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchCancelOrdersRequest" } } }, "required": true }, "responses": { "200": { "description": "Orders canceled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchCancelOrdersResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/history": { "get": { "tags": [ "Trade" ], "summary": "Get Order History", "description": "Query order history. As order creation/cancellation is asynchronous, the data returned from this endpoint may delay.", "operationId": "get_history_orders", "parameters": [ { "name": "sub_account_address", "in": "query", "description": "Trading vault address (subaccount) to query against.", "required": true, "schema": { "type": "string" } }, { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "order_id", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderId" } ] } }, { "name": "order_link_id", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] } }, { "name": "order_filter", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderFilter" } ] } }, { "name": "order_status", "in": "query", "required": false, "schema": { "type": [ "array", "null" ], "items": { "$ref": "#/components/schemas/OrderStatus" } } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Orders", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderListResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/place": { "post": { "tags": [ "Trade" ], "summary": "Place Order", "description": "Create a new order", "operationId": "place_order", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaceOrderRequest" } } }, "required": true }, "responses": { "200": { "description": "Order placed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaceOrderResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/place-batch": { "post": { "tags": [ "Trade" ], "summary": "Batch Place Orders", "description": "Create multiple new orders in a single request", "operationId": "batch_place_orders", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchPlaceOrdersRequest" } } }, "required": true }, "responses": { "200": { "description": "Orders placed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchPlaceOrdersResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/order/realtime": { "get": { "tags": [ "Trade" ], "summary": "Get Open & Closed Orders", "description": "Primarily query unfilled or partially filled orders in real-time, but also supports querying recent 500 closed status (Cancelled, Filled) orders. Please see the usage of request param open_only.", "operationId": "get_realtime_orders", "parameters": [ { "name": "sub_account_address", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "symbol", "in": "query", "description": "Symbol name", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "order_id", "in": "query", "description": "Order ID", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderId" } ] } }, { "name": "order_link_id", "in": "query", "description": "User customised order ID", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] } }, { "name": "open_only", "in": "query", "description": "* `true` (default): query open status orders (New or PartiallyFilled).\n* `false`: query a maximum of recent 500 closed status orders (Cancelled, Rejected, Filled).", "required": false, "schema": { "type": "boolean" } }, { "name": "order_filter", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderFilter" } ] } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Orders", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrderListResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/position/closed-pnl": { "get": { "tags": [ "Position" ], "summary": "Get Closed PnL", "description": "Query user's closed profit and loss records", "operationId": "get_closed_pnl", "parameters": [ { "name": "sub_account_address", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "start_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "end_time", "in": "query", "required": false, "schema": { "type": [ "string", "null" ], "format": "date-time" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Closed PnL", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetClosedPnlResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/position/list": { "get": { "tags": [ "Position" ], "summary": "Get Position Info", "description": "Query real-time position data, such as position size, cumulative realized PNL, etc.", "operationId": "get_position_info", "parameters": [ { "name": "sub_account_address", "in": "query", "description": "Trading vault address (subaccount) to query against.", "required": true, "schema": { "type": "string" } }, { "name": "symbol", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Positions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetPositionInfoResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/position/set-leverage": { "post": { "tags": [ "Position" ], "summary": "Set leverage", "description": "Set leverage for a symbol", "operationId": "set_leverage", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetLeverageRequest" } } }, "required": true }, "responses": { "200": { "description": "Leverage updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetLeverageResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/position/trading-stop": { "post": { "tags": [ "Position" ], "summary": "Set Trading Stop", "description": "Set the take profit, stop loss or trailing stop for the position.", "operationId": "set_trading_stop", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetTradingStopRequest" } } }, "required": true }, "responses": { "200": { "description": "Trading stop set", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetTradingStopResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/api-keys": { "get": { "tags": [ "user" ], "operationId": "list_api_keys", "responses": { "200": { "description": "List API keys", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListApiKeysResponse" } } } }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" } }, "security": [ { "bearer_auth": [] } ] }, "post": { "tags": [ "user" ], "operationId": "create_api_key", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateApiKeyRequest" } } }, "required": true }, "responses": { "200": { "description": "API key created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateApiKeyResponse" } } } }, "400": { "description": "Bad request" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/api-keys/{id}": { "delete": { "tags": [ "user" ], "operationId": "revoke_api_key", "parameters": [ { "name": "id", "in": "path", "description": "API Key ID", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "API key revoked" }, "400": { "description": "Bad request" }, "401": { "description": "Unauthorized" }, "403": { "description": "Forbidden" }, "404": { "description": "API key not found" } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/competitions": { "get": { "tags": [ "user" ], "operationId": "get_competitions", "parameters": [ { "name": "status", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/CompetitionStatus" } ] } } ], "responses": { "200": { "description": "Competitions list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListCompetitionsResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/competitions/{competition_id}/leaderboard": { "get": { "tags": [ "user" ], "operationId": "get_competition_leaderboard", "parameters": [ { "name": "competition_id", "in": "path", "description": "Competition UUID", "required": true, "schema": { "type": "string" } }, { "name": "offset", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "sub_account", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Competition leaderboard", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompetitionLeaderboardResponse" } } } }, "400": { "description": "Bad request" }, "401": { "description": "Unauthorized" }, "404": { "description": "Competition not found" } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/competitions/{competition_id}/placement": { "get": { "tags": [ "user" ], "operationId": "get_competition_placement", "parameters": [ { "name": "competition_id", "in": "path", "description": "Competition UUID", "required": true, "schema": { "type": "string" } }, { "name": "sub_account", "in": "query", "required": false, "schema": { "type": [ "string", "null" ] } } ], "responses": { "200": { "description": "Own competition placement", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompetitionPlacementResponse" } } } }, "400": { "description": "Bad request" }, "401": { "description": "Unauthorized" }, "404": { "description": "Competition not found" } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/leaderboard": { "get": { "tags": [ "Leaderboard" ], "summary": "Get Leaderboard", "description": "Returns a paginated leaderboard of subaccounts ranked by unrealised PnL for the given timeframe. Timeframe is required and relative to now (today, 7d, 30d, or all). Default limit 10, max 100; default offset 0.", "operationId": "get_leaderboard", "parameters": [ { "name": "offset", "in": "query", "description": "Pagination offset (default 0).", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "limit", "in": "query", "description": "Max number of entries to return (default 10, max 100).", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } }, { "name": "timeframe", "in": "query", "description": "Ranking window.", "required": true, "schema": { "type": "string", "description": "Leaderboard ranking window: today, last 7 days, last 30 days, or all time.", "enum": [ "today", "7d", "30d", "all" ] } } ], "responses": { "200": { "description": "Leaderboard", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LeaderboardResponse" } } } } } } }, "/api/v1/user/leaderboard/placement": { "get": { "tags": [ "Leaderboard" ], "summary": "Get Leaderboard Placement", "description": "Placement(s) for the authenticated user. When sub_account is omitted, returns one entry per user trading subaccount; otherwise exactly one entry. When the user has no trading subaccounts, data is an empty array. If the account is not ranked, ranked is false and place is \"0\".", "operationId": "get_leaderboard_placement", "parameters": [ { "name": "sub_account", "in": "query", "description": "When set, return placement for this subaccount only; otherwise one entry per subaccount.", "required": false, "schema": { "type": [ "string", "null" ] } }, { "name": "timeframe", "in": "query", "description": "Ranking window.", "required": true, "schema": { "type": "string", "description": "Leaderboard ranking window: today, last 7 days, last 30 days, or all time.", "enum": [ "today", "7d", "30d", "all" ] } } ], "responses": { "200": { "description": "Placements (ranked false when not on board)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LeaderboardPlacementResponse" } } } }, "400": { "description": "Bad Request (invalid sub_account or address)" }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/referral": { "get": { "tags": [ "User" ], "operationId": "get_referral_summary", "responses": { "200": { "description": "Referral summary", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReferralSummaryResponse" } } } } }, "security": [ { "bearer_auth": [] } ] }, "post": { "tags": [ "User" ], "operationId": "bind_referral", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BindReferralRequest" } } }, "required": true }, "responses": { "200": { "description": "Referral summary", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReferralSummaryResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/rewards": { "get": { "tags": [ "User" ], "operationId": "get_rewards_summary", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Reward summary", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RewardSummaryResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/root-account": { "get": { "tags": [ "User" ], "summary": "Get Root Account", "description": "Return the Root Account address for the current user", "operationId": "get_root_account", "responses": { "200": { "description": "Root Account", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetRootAccountResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } }, "/api/v1/user/sub-accounts": { "get": { "tags": [ "User" ], "summary": "Get Sub Accounts", "description": "List Sub Accounts under the Root Account", "operationId": "get_sub_accounts", "responses": { "200": { "description": "Sub Accounts", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetSubAccountsResponse" } } } } }, "security": [ { "bearer_auth": [] } ] } } }, "components": { "schemas": { "AccountBalance": { "type": "object", "description": "Account-wide wallet and margin metrics.", "required": [ "sub_account_address", "account_type", "equity", "vault_balance", "margin_balance", "available_balance", "accrued_interest", "total_order_im", "total_position_im", "total_position_mm", "unrealised_pnl", "unrealized_funding", "realised_pnl_cum" ], "properties": { "account_type": { "type": "string", "description": "Account type (e.g. Funding, Trading)" }, "accrued_interest": { "type": "string", "description": "Accrued interest" }, "available_balance": { "type": "string", "description": "The amount of an asset that can be used to open USDC Perpetual positions (USDC)" }, "equity": { "type": "string", "description": "Equity under the account without considering the collateral value ratio (calculated in USDC).\nEquity = Vault Balance + Perp & Futures Unrealized P&L + Unrealized Funding" }, "margin_balance": { "type": "string", "description": "Amount that can be used as margin under the account\nafter considering the collateral value ratio (calculated in USDC)\nTotal Vault Balance + Perp Unrealized P&L" }, "realised_pnl_cum": { "type": "string", "description": "Cumulative Realised P&L" }, "sub_account_address": { "type": "string", "description": "Sub-Account address (the owner of the technical vault)" }, "total_order_im": { "type": "string", "description": "Pre-occupied margin for order. Locked balance (USDC)" }, "total_position_im": { "type": "string", "description": "Sum of initial margin of all positions." }, "total_position_mm": { "type": "string", "description": "Sum of maintenance margin for all positions, including estimated close fees." }, "unrealised_pnl": { "type": "string", "description": "Unrealised P&L" }, "unrealized_funding": { "type": "string", "description": "Aggregated unrealized funding across all positions (USDC)" }, "vault_balance": { "type": "string", "description": "Vault Balance (USDC)" } } }, "AccountStatistics": { "type": "object", "required": [ "sub_account_address", "equity", "realised_pnl_cum", "unrealised_pnl", "volume", "roi", "timestamp" ], "properties": { "equity": { "type": "string" }, "realised_pnl_cum": { "type": "string" }, "roi": { "type": "string" }, "sub_account_address": { "type": "string" }, "timestamp": { "type": "string", "format": "date-time" }, "unrealised_pnl": { "type": "string" }, "volume": { "type": "string" } } }, "AccountStatisticsOrder": { "type": "string", "description": "Sort direction for account statistics snapshots (older/newer first).", "enum": [ "asc", "desc" ] }, "AccountStatisticsStep": { "type": "string", "description": "Temporal resolution for statistics. Single-letter shorthands are allowed(h/d/w/m).", "enum": [ "hour", "day", "week", "month" ] }, "AdlAlertSnapshot": { "type": "object", "required": [ "pool_id", "pool_group_id", "symbol", "adl_mode", "equity", "updated_time" ], "properties": { "adl_mode": { "type": "string" }, "adl_trigger_reason": { "type": [ "string", "null" ] }, "equity": { "type": "string" }, "latest_pnl_ratio": { "type": [ "string", "null" ] }, "pool_group_id": { "type": "string" }, "pool_id": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "updated_time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "AdlRankIndicator": { "type": "string", "description": "Auto-deleverage rank indicator.", "enum": [ "Zero", "One", "Two", "Three", "Four", "Five" ] }, "AmendOrderRequest": { "type": "object", "description": "Request to amend an order.", "required": [ "sub_account_address", "symbol", "qty", "price" ], "properties": { "order_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderId" } ] }, "order_iv": { "type": [ "integer", "null" ], "format": "int64", "minimum": 0 }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] }, "price": { "type": "string" }, "qty": { "type": "string" }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "tpsl": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/TpSl" } ] }, "trigger": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/ConditionalOrder" } ] } } }, "AmendOrderResponse": { "type": "object", "description": "Response for amending an order.", "properties": { "order_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderId" } ] }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] } } }, "ApiKeyInfo": { "type": "object", "required": [ "id", "name", "public_key", "scopes", "created_at" ], "properties": { "created_at": { "type": "integer", "format": "int64" }, "expires_at": { "type": [ "integer", "null" ], "format": "int64" }, "id": { "type": "string" }, "name": { "type": "string" }, "public_key": { "type": "string" }, "scopes": { "type": "array", "items": { "$ref": "#/components/schemas/Scope" } } } }, "AuthorizeRequest": { "type": "object", "required": [ "signature", "public_key", "timestamp_ms", "nonce" ], "properties": { "full_message": { "type": [ "string", "null" ], "description": "Optional Aptos Wallet Standard full message (APTOS-prefixed, newline-delimited).\nIf provided, the backend will verify the signature against this exact string\nand also validate that it contains `message: AUTHORIZE|{timestamp_ms}|{nonce}` and a matching `nonce:`.\n\nExample:\n\nAPTOS\\nmessage: AUTHORIZE|1731541800000|b7d1c2e8f5a94f3db2f8c6a9d1e4\\nnonce: b7d1c2e8f5a94f3db2f8c6a9d1e4" }, "nonce": { "type": "string", "description": "Example: b7d1c2e8f5a94f3db2f8c6a9d1e4" }, "public_key": { "type": "string", "description": "Example: 0xa9d81da788977638194c857b918f12ff2233c7a86e82b44705761b2d02426f6d" }, "signature": { "type": "string", "description": "Example: 0xf5ec808e52d014f5193eccf680acf84c6256bdddb0159088e7cb18d74b9c590b92eb4381e10307fccc0868612993dfb9a542257aab22d7a3decfda33045fb905" }, "timestamp_ms": { "type": "integer", "format": "int64", "description": "Example: 1731541800000" } } }, "AuthorizeResponse": { "type": "object", "required": [ "token", "user_id" ], "properties": { "token": { "type": "string" }, "user_id": { "$ref": "#/components/schemas/UserId" } } }, "BatchAmendOrdersRequest": { "type": "object", "description": "Batch amend order request.\nYou can amend unfilled or partially filled orders.\nTODO: Maximum 20 orders per request", "required": [ "request" ], "properties": { "await_outcome": { "type": "boolean", "description": "If true, gateway waits up to a server-defined timeout (currently 3s)\nfor final engine outcomes and maps them into `exit_info`.\n\nIf false (default), `exit_info` reports edge outcomes\n(validation + publish ack)." }, "request": { "type": "array", "items": { "$ref": "#/components/schemas/AmendOrderRequest" } } } }, "BatchAmendOrdersResponse": { "type": "object", "description": "Response of batch amend orders.", "required": [ "result", "exit_info", "time" ], "properties": { "exit_info": { "type": "array", "items": { "$ref": "#/components/schemas/ExitMessage" }, "description": "Information about the exit status of each order in the batch." }, "result": { "type": "array", "items": { "$ref": "#/components/schemas/AmendOrderResponse" } }, "time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "BatchCancelOrdersRequest": { "type": "object", "description": "Batch cancel order request.\nYou can cancel unfilled or partially filled orders.\nTODO: Maximum 20 orders per request", "required": [ "request" ], "properties": { "await_outcome": { "type": "boolean", "description": "If true, gateway waits up to a server-defined timeout (currently 3s)\nfor final engine outcomes and maps them into `exit_info`.\n\nIf false (default), `exit_info` reports edge outcomes\n(validation + publish ack)." }, "request": { "type": "array", "items": { "$ref": "#/components/schemas/CancelOrderRequest" } } } }, "BatchCancelOrdersResponse": { "type": "object", "description": "Response of batch cancel orders.", "required": [ "result", "exit_info", "time" ], "properties": { "exit_info": { "type": "array", "items": { "$ref": "#/components/schemas/ExitMessage" }, "description": "Information about the exit status of each order in the batch." }, "result": { "type": "array", "items": { "$ref": "#/components/schemas/CancelOrderResponse" } }, "time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "BatchPlaceOrdersRequest": { "type": "object", "description": "Batch place order request.\nTODO: Maximum 20 orders per request\nTODO: Rate limiting (10 reqs per sec, 20 * 10 = 200 orders in one sec)", "required": [ "request" ], "properties": { "await_outcome": { "type": "boolean", "description": "If true, gateway waits up to a server-defined timeout (currently 3s)\nfor final engine outcomes and maps them into `exit_info`.\n\nIf false (default), `exit_info` reports edge outcomes\n(validation + publish ack)." }, "request": { "type": "array", "items": { "$ref": "#/components/schemas/PlaceOrderRequest" } } } }, "BatchPlaceOrdersResponse": { "type": "object", "description": "Response of batch place orders.", "required": [ "result", "exit_info", "time" ], "properties": { "exit_info": { "type": "array", "items": { "$ref": "#/components/schemas/ExitMessage" }, "description": "Information about the exit status of each order in the batch." }, "result": { "type": "array", "items": { "$ref": "#/components/schemas/PlaceOrderResponse" } }, "time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "BindReferralRequest": { "type": "object", "required": [ "referral_code" ], "properties": { "referral_code": { "type": "string" } } }, "CancelAllOrdersRequest": { "type": "object", "description": "Request to cancel all orders, optionally filtered by symbol\nTODO: Cancels up to 500 orders per request\nTODO: System picks up 500 orders randomly to cancel when you have over 500 orders", "required": [ "sub_account_address" ], "properties": { "sub_account_address": { "type": "string" }, "symbol": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/Symbol" } ] } } }, "CancelAllOrdersResponse": { "type": "object", "required": [ "result", "exit_info", "time" ], "properties": { "exit_info": { "$ref": "#/components/schemas/ExitMessage", "description": "Information about the exit status of the cancel all operation." }, "result": { "type": "array", "items": { "$ref": "#/components/schemas/CancelOrderResponse" } }, "time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "CancelOrderRequest": { "type": "object", "description": "Request to cancel an order.", "required": [ "sub_account_address", "symbol" ], "properties": { "order_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderId" } ] }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" } } }, "CancelOrderResponse": { "type": "object", "description": "Response for canceling an order.", "properties": { "order_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderId" } ] }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] } } }, "CancelType": { "type": "string", "description": "Reason/Source of the order cancellation.", "enum": [ "CancelByUser", "CancelByAdmin", "CancelBySystem", "CancelByReduceOnly", "CancelByPrepareLiq", "CancelAllBeforeLiq", "CancelByPrepareAdl", "CancelAllBeforeAdl", "CancelBySettle", "CancelByTpSlTsClear", "CancelBySmp", "CancelByDcp", "CancelByRebalance", "CancelByOcoTpCanceledBySlTriggered", "CancelByOcoSlCanceledByTpTriggered" ] }, "ClosedPnl": { "type": "object", "description": "Closed PnL entry.", "required": [ "symbol", "order_id", "sub_account_address", "side", "qty", "order_price", "order_type", "exec_type", "closed_size", "cum_entry_value", "avg_entry_price", "cum_exit_value", "avg_exit_price", "closed_pnl", "fill_count", "leverage", "open_fee", "close_fee", "created_time", "updated_time" ], "properties": { "avg_entry_price": { "type": "string", "description": "Average entry price" }, "avg_exit_price": { "type": "string", "description": "Average exit price" }, "close_fee": { "type": "string", "description": "Close position trading fee" }, "closed_pnl": { "type": "string", "description": "Closed PnL" }, "closed_size": { "type": "string" }, "created_time": { "type": "string", "format": "date-time", "example": "1672531200000" }, "cum_entry_value": { "type": "string", "description": "Cumulated Position value" }, "cum_exit_value": { "type": "string", "description": "Cumulated exit position value" }, "exec_type": { "$ref": "#/components/schemas/ExecType" }, "fill_count": { "type": "string", "description": "The number of fills in a single order" }, "leverage": { "type": "string", "description": "Leverage" }, "open_fee": { "type": "string", "description": "Open position trading fee" }, "order_id": { "$ref": "#/components/schemas/OrderId" }, "order_price": { "type": "string" }, "order_type": { "$ref": "#/components/schemas/OrderType" }, "qty": { "type": "string" }, "side": { "$ref": "#/components/schemas/Side" }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "updated_time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "CompetitionLeaderboardData": { "type": "object", "required": [ "sub_account_address", "score", "metric_value", "active_days", "eligible", "projected_xp" ], "properties": { "active_days": { "type": "integer", "format": "int32", "description": "Number of days that met the daily-activity threshold.", "minimum": 0 }, "eligible": { "type": "boolean", "description": "Whether this entry is eligible to be ranked (min active days met, score > 0)." }, "ineligible_reason": { "type": [ "string", "null" ] }, "metric_value": { "type": "string", "description": "Raw metric total across all days (before capping / weighting)." }, "projected_xp": { "type": "string", "description": "Live display-only XP projected from the current eligible leaderboard scores." }, "rank": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 }, "score": { "type": "string", "description": "Weighted, capped score summed across all days." }, "sub_account_address": { "type": "string" } } }, "CompetitionLeaderboardMeta": { "type": "object", "required": [ "offset", "limit", "total" ], "properties": { "limit": { "type": "integer", "format": "int32", "minimum": 0 }, "offset": { "type": "integer", "format": "int32", "minimum": 0 }, "total": { "type": "integer", "format": "int64", "minimum": 0 } } }, "CompetitionLeaderboardResponse": { "type": "object", "required": [ "competition", "data", "meta" ], "properties": { "competition": { "$ref": "#/components/schemas/CompetitionSummary" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/CompetitionLeaderboardData" } }, "meta": { "$ref": "#/components/schemas/CompetitionLeaderboardMeta" } } }, "CompetitionMetric": { "type": "string", "enum": [ "volume", "pnl" ] }, "CompetitionPlacementResponse": { "type": "object", "required": [ "competition", "data" ], "properties": { "competition": { "$ref": "#/components/schemas/CompetitionSummary" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/CompetitionLeaderboardData" } } } }, "CompetitionScoringConfig": { "type": "object", "description": "Parameters that drive score calculation.\n\n- min_daily_activity_units is raw USDC 1e6 units.\n- All bps values are basis points (1 bp = 0.01%).", "required": [ "metric", "min_daily_activity_units", "min_active_days", "max_daily_contribution_bps", "start_weight_bps", "end_weight_bps" ], "properties": { "consistency_max_bonus_bps": { "type": [ "integer", "null" ], "format": "int32", "description": "Max bonus (bps) granted when a participant hits `consistency_target_days`.", "minimum": 0 }, "consistency_target_days": { "type": [ "integer", "null" ], "format": "int32", "description": "Target active day count for maximum bonus; required when `use_consistency_multiplier`.", "minimum": 0 }, "end_weight_bps": { "type": "integer", "format": "int32", "description": "Weight applied to the last day, in bps. Linear interpolation between start and end.", "minimum": 0 }, "max_daily_contribution_bps": { "type": "integer", "format": "int32", "description": "Per-day contribution cap as a fraction (bps) of the positive sum across the window.", "minimum": 0 }, "metric": { "$ref": "#/components/schemas/CompetitionMetric", "description": "Which metric to score." }, "min_active_days": { "type": "integer", "format": "int32", "description": "Required active days for a sub-account to qualify for a rank.", "minimum": 0 }, "min_daily_activity_units": { "type": "integer", "format": "int64", "description": "Minimum daily raw metric value (USDC 1e6 units) for a day to count toward `active_days`.", "minimum": 0 }, "start_weight_bps": { "type": "integer", "format": "int32", "description": "Weight applied to the first day, in bps (typical: 10000 = 100%).", "minimum": 0 }, "use_consistency_multiplier": { "type": "boolean", "description": "Whether to apply the consistency multiplier (scales with active days)." } } }, "CompetitionStatus": { "type": "string", "enum": [ "draft", "scheduled", "active", "ended", "cancelled" ] }, "CompetitionSummary": { "type": "object", "required": [ "id", "slug", "title", "status", "start_time_ms", "end_time_ms", "prize_usdc", "description_md", "scoring" ], "properties": { "description_md": { "type": "string" }, "end_time_ms": { "type": "integer", "format": "int64" }, "id": { "type": "string" }, "prize_usdc": { "type": "integer", "format": "int32", "minimum": 0 }, "scoring": { "$ref": "#/components/schemas/CompetitionScoringConfig" }, "slug": { "type": "string" }, "start_time_ms": { "type": "integer", "format": "int64" }, "status": { "$ref": "#/components/schemas/CompetitionStatus" }, "symbol": { "type": [ "string", "null" ] }, "title": { "type": "string" } } }, "ConditionalOrder": { "type": "object", "required": [ "trigger_price", "trigger_direction", "trigger_by" ], "properties": { "trigger_by": { "$ref": "#/components/schemas/TriggerBy", "description": "Last Price, Mark Price, or Index Price." }, "trigger_direction": { "$ref": "#/components/schemas/TriggerDirection", "description": "Up or Down." }, "trigger_price": { "type": "string", "description": "The price level that activates the order." } } }, "CreateApiKeyRequest": { "type": "object", "required": [ "name", "public_key", "scopes" ], "properties": { "expires_at": { "type": [ "integer", "null" ], "format": "int64" }, "name": { "type": "string" }, "public_key": { "type": "string" }, "scopes": { "type": "array", "items": { "$ref": "#/components/schemas/Scope" } } } }, "CreateApiKeyResponse": { "type": "object", "required": [ "id", "public_key", "scopes", "created_at" ], "properties": { "created_at": { "type": "integer", "format": "int64" }, "expires_at": { "type": [ "integer", "null" ], "format": "int64" }, "id": { "type": "string" }, "public_key": { "type": "string" }, "scopes": { "type": "array", "items": { "$ref": "#/components/schemas/Scope" } } } }, "CreateType": { "type": "string", "enum": [ "CreateByUser", "CreateByFutureSpread", "CreateByAdminClosing", "CreateBySettle", "CreateByStopOrder", "CreateByTakeProfit", "CreateByPartialTakeProfit", "CreateByStopLoss", "CreateByPartialStopLoss", "CreateByTrailingStop", "CreateByTrailingProfit", "CreateByLiq", "CreateByTakeOverPassThrough", "CreateByAdlPassThrough", "CreateByBlockPassThrough", "CreateByBlockTradeMovePositionPassThrough", "CreateByClosing", "CreateByFGridBot", "CloseByFGridBot", "CreateByTWAP", "CreateByTVSignal", "CreateByMmRateClose", "CreateByMartingaleBot", "CloseByMartingaleBot", "CreateByIceBerg", "CreateByArbitrage", "CreateByDdh", "CreateByBboOrder" ] }, "ErrorResponse": { "type": "object", "required": [ "error", "message" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "reset_time": { "type": [ "integer", "null" ], "format": "int64", "minimum": 0 }, "retry_after": { "type": [ "string", "null" ] } } }, "ExecType": { "type": "string", "description": "Execution type for trade history entries.", "enum": [ "Trade", "AdlTrade", "Funding", "BustTrade", "Delivery", "Settle", "BlockTrade", "MovePosition", "FutureSpread" ] }, "Execution": { "type": "object", "description": "Single execution (trade fill) record.", "required": [ "exec_id", "symbol", "order_id", "side", "sub_account_address", "order_price", "order_qty", "leaves_qty", "order_type", "exec_price", "exec_qty", "exec_value", "exec_type", "exec_time", "is_maker", "fee_rate", "mark_price", "index_price", "seq" ], "properties": { "closed_size": { "type": [ "string", "null" ], "description": "Closed position size" }, "create_type": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/CreateType", "description": "Order create type" } ] }, "exec_id": { "$ref": "#/components/schemas/ExecutionId", "description": "Execution ID" }, "exec_price": { "type": "string", "description": "Execution price" }, "exec_qty": { "type": "string", "description": "Execution quantity" }, "exec_time": { "type": "string", "format": "date-time", "description": "Executed timestamp (ms)", "example": "1672531200000" }, "exec_type": { "$ref": "#/components/schemas/ExecType", "description": "Execution type (e.g. Trade, Adl, Bust)" }, "exec_value": { "type": "string", "description": "Executed value (price * qty)" }, "fee_rate": { "type": "string", "description": "Trading fee rate" }, "index_price": { "type": "string", "description": "Index price at execution" }, "is_maker": { "type": "boolean", "description": "Is maker order. true: maker, false: taker" }, "leaves_qty": { "type": "string", "description": "Remaining quantity not yet executed after this fill" }, "mark_price": { "type": "string", "description": "Mark price at execution" }, "order_id": { "$ref": "#/components/schemas/OrderId" }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] }, "order_price": { "type": "string", "description": "Original order price" }, "order_qty": { "type": "string", "description": "Original order quantity" }, "order_type": { "$ref": "#/components/schemas/OrderType", "description": "Order type. Market or Limit" }, "seq": { "type": "integer", "format": "int64", "description": "Cross sequence, used to associate each fill and each position update\n* The seq will be the same when conclude multiple transactions at the same time\n* Different symbols may have the same seq, please use seq + symbol to check unique", "minimum": 0 }, "side": { "$ref": "#/components/schemas/Side", "description": "Side. Buy or Sell" }, "stop_order_type": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/StopOrderType", "description": "Stop order type if this was a stop order" } ] }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol", "description": "Symbol name, e.g. BTCUSDC" } } }, "ExecutionId": { "type": "string", "format": "uuid" }, "ExitMessage": { "oneOf": [ { "type": "object", "required": [ "Error" ], "properties": { "Error": { "type": "object", "required": [ "code", "msg" ], "properties": { "code": { "type": "integer", "format": "int32", "minimum": 0 }, "msg": { "$ref": "#/components/schemas/String" } } } } }, { "type": "object", "required": [ "Success" ], "properties": { "Success": { "type": "object", "required": [ "code", "msg" ], "properties": { "code": { "type": "integer", "format": "int32", "minimum": 0 }, "msg": { "type": "string" } } } } } ] }, "FundRequest": { "type": "object", "required": [ "receiver", "metadatas", "amounts" ], "properties": { "amounts": { "type": "array", "items": { "type": "integer", "format": "int64", "minimum": 0 } }, "metadatas": { "type": "array", "items": { "type": "string" } }, "receiver": { "type": "string" }, "request_id": { "type": [ "string", "null" ] } } }, "FundResult": { "type": "object", "required": [ "txid" ], "properties": { "txid": { "type": "string" } } }, "FundingRateHistory": { "type": "object", "required": [ "symbol", "funding_rate", "funding_time" ], "properties": { "funding_rate": { "type": "string" }, "funding_time": { "type": "string", "format": "date-time", "example": "1672531200000" }, "symbol": { "$ref": "#/components/schemas/Symbol" } } }, "GetAccountBalanceResponse": { "type": "object", "description": "Account balance response structure.", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/AccountBalance" } } } }, "GetAccountStatisticsResponse": { "type": "object", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/AccountStatistics" } } } }, "GetAdlAlertsHistoryResponse": { "type": "object", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/AdlAlertSnapshot" } } } }, "GetAdlAlertsResponse": { "type": "object", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/AdlAlertSnapshot" } } } }, "GetClosedPnlResponse": { "type": "object", "description": "Closed PnL response.", "required": [ "list", "next_page_cursor" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/ClosedPnl" } }, "next_page_cursor": { "type": "string" } } }, "GetCompetitionLeaderboardParams": { "type": "object", "properties": { "limit": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 }, "offset": { "type": [ "integer", "null" ], "format": "int32", "minimum": 0 }, "sub_account": { "type": [ "string", "null" ] } } }, "GetCompetitionPlacementParams": { "type": "object", "properties": { "sub_account": { "type": [ "string", "null" ] } } }, "GetFundingRateHistoryResponse": { "type": "object", "description": "Funding rate history response.", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/FundingRateHistory" } } } }, "GetInstrumentsInfoResponse": { "allOf": [ { "$ref": "#/components/schemas/SystemInfo" }, { "type": "object", "required": [ "category", "list" ], "properties": { "category": { "type": "string" }, "list": { "type": "array", "items": { "$ref": "#/components/schemas/InstrumentInfo" } } } } ] }, "GetInsurancePoolHistoryResponse": { "type": "object", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/InsurancePoolSnapshot" } } } }, "GetInsurancePoolResponse": { "type": "object", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/InsurancePoolSnapshot" } } } }, "GetKlineResponse": { "type": "object", "description": "Kline response.", "required": [ "symbol", "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/KlineSnapshot" } }, "symbol": { "$ref": "#/components/schemas/Symbol" } } }, "GetLongShortRatioResponse": { "type": "object", "description": "This refers to the net long and short positions as percentages of all position holders during the selected time.", "required": [ "list", "next_page_cursor" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/LongShortRatio" } }, "next_page_cursor": { "type": "string" } } }, "GetOpenInterestResponse": { "type": "object", "description": "Open interest response.", "required": [ "symbol", "list", "next_page_cursor" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/OpenInterest" } }, "next_page_cursor": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" } } }, "GetOrderBookResponse": { "type": "object", "description": "Get OrderBook response.", "required": [ "result", "time" ], "properties": { "result": { "$ref": "#/components/schemas/OrderBookSnapshot" }, "time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "GetPositionInfoResponse": { "type": "object", "description": "Position info response.", "required": [ "list", "next_page_cursor" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/Position" } }, "next_page_cursor": { "type": "string", "description": "Cursor. Use the next_page_cursor token from the response to retrieve the next page of the data set" } } }, "GetPriceKlineResponse": { "type": "object", "description": "Price-only kline response.", "required": [ "symbol", "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/PriceKlineSnapshot" } }, "symbol": { "$ref": "#/components/schemas/Symbol" } } }, "GetRecentTradeResponse": { "type": "object", "description": "Response for recent public trades.", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/PublicTrade" } } } }, "GetRiskLimitResponse": { "type": "object", "description": "Risk limit response.", "required": [ "list", "next_page_cursor" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/RiskLimit" } }, "next_page_cursor": { "type": "string" } } }, "GetRootAccountResponse": { "type": "object", "required": [ "root_addr" ], "properties": { "root_addr": { "type": "string" } } }, "GetSubAccountsResponse": { "type": "object", "required": [ "sub_account_addresses" ], "properties": { "sub_account_addresses": { "type": "array", "items": { "type": "string" } } } }, "GetTickersResponse": { "type": "object", "description": "Ticker snapshots response.", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/TickerSnapshot" } } } }, "GetTradeHistoryResponse": { "type": "object", "description": "Response for trade history queries.", "required": [ "list" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/Execution" } }, "next_page_cursor": { "type": [ "string", "null" ] } } }, "InstrumentInfo": { "type": "object", "required": [ "symbol", "status", "base_coin", "quote_coin", "launch_time", "delivery_time", "delivery_fee_rate", "price_scale", "leverage_filter", "price_filter", "lot_size_filter", "unified_margin_trade", "funding_interval", "settle_coin", "addr", "quote_addr", "maker_fee_rate", "taker_fee_rate", "base_scale", "quote_scale" ], "properties": { "addr": { "type": "string" }, "base_coin": { "type": "string" }, "base_scale": { "type": "integer", "format": "int32", "minimum": 0 }, "delivery_fee_rate": { "type": "string" }, "delivery_time": { "type": "string" }, "funding_interval": { "type": "integer", "format": "int32", "minimum": 0 }, "launch_time": { "type": "string" }, "leverage_filter": { "$ref": "#/components/schemas/LeverageFilter" }, "lot_size_filter": { "$ref": "#/components/schemas/LotSizeFilter" }, "maker_fee_rate": { "type": "string" }, "price_filter": { "$ref": "#/components/schemas/PriceFilter" }, "price_scale": { "type": "integer", "format": "int32", "minimum": 0 }, "quote_addr": { "type": "string" }, "quote_coin": { "type": "string" }, "quote_scale": { "type": "integer", "format": "int32", "minimum": 0 }, "settle_coin": { "type": "string" }, "status": { "type": "string" }, "symbol": { "type": "string" }, "taker_fee_rate": { "type": "string" }, "unified_margin_trade": { "type": "boolean" } } }, "InsurancePoolInventoryPosition": { "type": "object", "required": [ "symbol", "side", "size", "avg_entry_price", "unrealized_pnl" ], "properties": { "avg_entry_price": { "type": "string" }, "side": { "$ref": "#/components/schemas/Side" }, "size": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "unrealized_pnl": { "type": "string" } } }, "InsurancePoolSnapshot": { "type": "object", "required": [ "pool_id", "pool_group_id", "cash_balance", "realized_pnl_cum", "unrealized_pnl", "base_equity", "equity", "group_redistribution_in", "group_redistribution_out", "group_adl_obligation", "adl_mode", "updated_time", "inventory" ], "properties": { "adl_mode": { "type": "string" }, "adl_trigger_reason": { "type": [ "string", "null" ] }, "base_equity": { "type": "string" }, "cash_balance": { "type": "string" }, "equity": { "type": "string" }, "group_adl_obligation": { "type": "string" }, "group_redistribution_in": { "type": "string" }, "group_redistribution_out": { "type": "string" }, "inventory": { "type": "array", "items": { "$ref": "#/components/schemas/InsurancePoolInventoryPosition" } }, "latest_pnl_ratio": { "type": [ "string", "null" ] }, "pool_group_id": { "type": "string" }, "pool_id": { "type": "string" }, "realized_pnl_cum": { "type": "string" }, "unrealized_pnl": { "type": "string" }, "updated_time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "Interval": { "type": "string", "enum": [ "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "12h", "1d", "3d", "1w", "1M" ] }, "KlineSnapshot": { "type": "object", "required": [ "t", "i", "o", "h", "l", "c", "T", "v", "V", "Q", "n" ], "properties": { "Q": { "type": "string", "description": "Taker buy quote asset volume. Binance `Q` field." }, "T": { "type": "string", "format": "date-time", "description": "Candle close time (ms).", "example": "1672531200000" }, "V": { "type": "string", "description": "Taker buy base asset volume. Binance `V` field." }, "c": { "type": "string", "description": "Close - the price of the last trade in this candle (closing price)." }, "h": { "type": "string", "description": "High - the highest trade price within this interval." }, "i": { "$ref": "#/components/schemas/Interval", "description": "Candle interval - timeframe." }, "l": { "type": "string", "description": "Low - the minimum trade price within this interval." }, "n": { "type": "string", "description": "Trade count. The number of trades included in this candle" }, "o": { "type": "string", "description": "Open - the price of the first trade in this candle (opening price)." }, "t": { "type": "string", "format": "date-time", "description": "Candle open time (ms).", "example": "1672531200000" }, "v": { "type": "string", "description": "Volume. the trading volume for the candle" } } }, "LeaderboardData": { "type": "object", "description": "A single leaderboard row: subaccount, rank, and metrics.", "required": [ "account_value", "place", "pnl", "ranked", "roi", "sub_account_address", "volume", "trading_xp", "referral_xp", "total_xp" ], "properties": { "account_value": { "type": "string", "description": "Equity in quote units (e.g. USDC)." }, "place": { "type": "string", "description": "Rank position (1-based), or \"0\" when not ranked." }, "pnl": { "type": "string", "description": "Unrealised PnL in quote units." }, "ranked": { "type": "boolean", "description": "Whether this entry is on the board (false when not ranked)." }, "referral_xp": { "type": "integer", "format": "int64", "description": "XP earned from referral bonuses." }, "roi": { "type": "string", "description": "Return on investment as a decimal string (e.g. \"0.05\" for 5%)." }, "sub_account_address": { "type": "string", "description": "Subaccount address." }, "total_xp": { "type": "integer", "format": "int64", "description": "Total XP balance." }, "trading_xp": { "type": "integer", "format": "int64", "description": "XP earned from trading activity." }, "volume": { "type": "string", "description": "Cumulative volume in quote units." } } }, "LeaderboardMeta": { "type": "object", "description": "Pagination metadata for a leaderboard list response.", "required": [ "offset", "limit", "total" ], "properties": { "limit": { "type": "integer", "format": "int32", "description": "Applied limit.", "minimum": 0 }, "offset": { "type": "integer", "format": "int32", "description": "Applied offset.", "minimum": 0 }, "total": { "type": "integer", "format": "int64", "description": "Total number of entries in the window.", "minimum": 0 } } }, "LeaderboardPlacementResponse": { "type": "object", "description": "Response for the current user's placement(s) on the leaderboard.", "required": [ "data" ], "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/LeaderboardData" }, "description": "One row per subaccount (or single row when sub_account query is set)." } } }, "LeaderboardResponse": { "type": "object", "description": "Paginated leaderboard list response.", "required": [ "data", "meta" ], "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/LeaderboardData" }, "description": "Leaderboard rows." }, "meta": { "$ref": "#/components/schemas/LeaderboardMeta", "description": "Pagination info." } } }, "LeverageFilter": { "type": "object", "required": [ "min_leverage", "max_leverage", "leverage_step" ], "properties": { "leverage_step": { "type": "string" }, "max_leverage": { "type": "string" }, "min_leverage": { "type": "string" } } }, "ListApiKeysResponse": { "type": "object", "required": [ "keys" ], "properties": { "keys": { "type": "array", "items": { "$ref": "#/components/schemas/ApiKeyInfo" } } } }, "ListCompetitionsParams": { "type": "object", "properties": { "status": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/CompetitionStatus" } ] } } }, "ListCompetitionsResponse": { "type": "object", "required": [ "data" ], "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/CompetitionSummary" } } } }, "LongShortRatio": { "type": "object", "required": [ "symbol", "buy_ratio", "sell_ratio", "timestamp" ], "properties": { "buy_ratio": { "type": "string", "description": "The ratio of the number of long position" }, "sell_ratio": { "type": "string", "description": "The ratio of the number of short position" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "timestamp": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "LotSizeFilter": { "type": "object", "required": [ "max_order_qty", "min_order_qty", "qty_step", "post_only_max_order_qty", "max_mkt_order_qty", "min_notional_value" ], "properties": { "max_mkt_order_qty": { "type": "string" }, "max_order_qty": { "type": "string" }, "min_notional_value": { "type": "string" }, "min_order_qty": { "type": "string" }, "post_only_max_order_qty": { "type": "string" }, "qty_step": { "type": "string" } } }, "MarginMode": { "type": "string", "enum": [ "Cross", "Isolated" ] }, "OpenInterest": { "type": "object", "required": [ "open_interest", "open_interest_value", "timestamp" ], "properties": { "open_interest": { "type": "string" }, "open_interest_value": { "type": "string" }, "timestamp": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "Order": { "type": "object", "description": "Summary information about an order.", "required": [ "order_id", "symbol", "sub_account_address", "price", "qty", "side", "margin_mode", "order_status", "avg_price", "leaves_qty", "leaves_value", "cum_exec_qty", "cum_exec_value", "cum_exec_fee", "time_in_force", "order_type", "last_price_on_created", "post_only", "reduce_only", "close_on_trigger", "created_time", "updated_time" ], "properties": { "avg_price": { "type": "string", "description": "Average price at which part (or all) of the order has been executed (i.e. filled)" }, "cancel_type": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/CancelType" } ] }, "close_on_trigger": { "type": "boolean" }, "closed_pnl": { "type": [ "string", "null" ], "description": "Closed profit and loss for each close position order.\nValid only in order WebSocket" }, "create_type": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/CreateType" } ] }, "created_time": { "type": "string", "format": "date-time", "example": "1672531200000" }, "cum_exec_fee": { "type": "string", "description": "Cumulative executed trading fee: the total fees charged so far for the executed portion of this order" }, "cum_exec_qty": { "type": "string", "description": "Cumulative executed quantity: total amount of the order\nthat has already been filled/executed so far" }, "cum_exec_value": { "type": "string", "description": "Cumulative executed value: the total value corresponding to the part of\nthe order that has already been filled. Basically: how much worth in total has been executed so far" }, "expire_time": { "type": [ "string", "null" ], "format": "date-time", "description": "Expiration time for orders with a time-in-force of Good-Til-Date (GTD)", "example": "1672531200000" }, "last_price_on_created": { "type": "string", "description": "Last price at the time the order was created" }, "leaves_qty": { "type": "string", "description": "Remaining quantity from the order that has not yet been executed" }, "leaves_value": { "type": "string", "description": "Estimated value of the remaining quantity (leavesQty)\nthat remains unfilled. Basically: how much the unfilled portion is “worth”" }, "margin_mode": { "$ref": "#/components/schemas/MarginMode" }, "order_id": { "$ref": "#/components/schemas/OrderId" }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] }, "order_status": { "$ref": "#/components/schemas/OrderStatus" }, "order_type": { "$ref": "#/components/schemas/OrderType", "description": "Order type. Market, Limit. For TP/SL orders, is the order type after the order was triggered" }, "post_only": { "type": "boolean" }, "price": { "type": "string" }, "qty": { "type": "string" }, "reduce_only": { "type": "boolean" }, "reject_reason": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/RejectReason" } ] }, "side": { "$ref": "#/components/schemas/Side" }, "stop_order_type": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/StopOrderType", "description": "Stop order type. For example, Stop Market or Stop Limit." } ] }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "time_in_force": { "$ref": "#/components/schemas/TimeInForce" }, "tpsl": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/TpSl", "description": "Take Profit / Stop Loss details if set" } ] }, "trigger": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/ConditionalOrder", "description": "Conditional order details if this is a conditional order" } ] }, "updated_time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "OrderBookLevel": { "type": "array", "items": { "type": "string", "description": "Order book level consisting of price and size." }, "description": "Order book level consisting of price and size.", "maxItems": 2, "minItems": 2 }, "OrderBookSnapshot": { "type": "object", "description": "Order book Snapshot at a specific point in time.", "required": [ "s", "ts", "b", "a", "u", "seq", "mts" ], "properties": { "a": { "type": "array", "items": { "$ref": "#/components/schemas/OrderBookLevel" }, "description": "Ask levels" }, "b": { "type": "array", "items": { "$ref": "#/components/schemas/OrderBookLevel" }, "description": "Bid levels" }, "mts": { "type": "string", "format": "date-time", "description": "The timestamp from the matching engine when this orderbook data is produced.\nIt can be correlated with T from public trade channel", "example": "1672531200000" }, "s": { "$ref": "#/components/schemas/Symbol", "description": "Symbol name" }, "seq": { "type": "integer", "format": "int64", "example": 21, "minimum": 0 }, "ts": { "type": "string", "format": "date-time", "description": "The timestamp (ms) that the system generates the data", "example": "1672531200000" }, "u": { "type": "integer", "format": "int64", "description": "Update ID, is always in sequence", "example": 1, "minimum": 0 } } }, "OrderId": { "type": "string", "format": "uuid" }, "OrderLinkId": { "type": "string" }, "OrderListResponse": { "type": "object", "description": "Response for order list and order history requests.", "required": [ "list", "next_page_cursor" ], "properties": { "list": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } }, "next_page_cursor": { "type": "string" } } }, "OrderPriceLimit": { "type": "object", "description": "Order price limits for a given trading symbol.", "required": [ "symbol", "buy_limit", "sell_limit", "ts" ], "properties": { "buy_limit": { "type": "string", "description": "Highest Bid Price" }, "sell_limit": { "type": "string", "description": "Lowest Ask Price" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "ts": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "OrderStatus": { "type": "string", "enum": [ "New", "PartiallyFilled", "Untriggered", "CancelRequested", "Rejected", "PartiallyFilledCanceled", "Filled", "Canceled", "Triggered", "Deactivated", "Expired" ] }, "OrderType": { "type": "string", "description": "Order type: Limit, Market.", "enum": [ "Limit", "Market" ] }, "PlaceOrderRequest": { "type": "object", "description": "Request to place an order.", "required": [ "sub_account_address", "symbol", "side", "order_type", "qty", "price", "margin_mode", "time_in_force", "post_only", "reduce_only", "close_on_trigger" ], "properties": { "close_on_trigger": { "type": "boolean" }, "expire_time": { "type": [ "string", "null" ], "format": "date-time", "example": "1672531200000" }, "margin_mode": { "$ref": "#/components/schemas/MarginMode" }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] }, "order_type": { "$ref": "#/components/schemas/OrderType" }, "post_only": { "type": "boolean" }, "price": { "type": "string" }, "qty": { "type": "string" }, "reduce_only": { "type": "boolean" }, "side": { "$ref": "#/components/schemas/Side" }, "slippage_tolerance": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/SlippageTolerance" } ] }, "smp_group": { "type": [ "integer", "null" ], "format": "int64", "description": "Self-match prevention group id. Orders with the same `(user_id, smp_group)` are eligible\nfor SMP checks.", "minimum": 0 }, "smp_type": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/SmpType", "description": "Self-match prevention (SMP/STP) strategy. If unset, SMP is disabled." } ] }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "time_in_force": { "$ref": "#/components/schemas/TimeInForce" }, "tpsl": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/TpSl" } ] }, "trigger": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/ConditionalOrder" } ] } } }, "PlaceOrderResponse": { "type": "object", "description": "Response for placing an order.", "required": [ "order_id" ], "properties": { "order_id": { "$ref": "#/components/schemas/OrderId" }, "order_link_id": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/OrderLinkId" } ] } } }, "PointsLedgerEntry": { "type": "object", "required": [ "ledger_id", "run_id", "delta_xp", "reason", "metadata_json", "created_at" ], "properties": { "created_at": { "type": "integer", "format": "int64" }, "delta_xp": { "type": "integer", "format": "int64" }, "ledger_id": { "type": "string" }, "metadata_json": {}, "reason": { "type": "string" }, "run_id": { "type": "string" } } }, "Position": { "type": "object", "description": "Position information.\n\n* risk_id: numeric identifier of the current risk tier your position is on for that symbol.\n* risk_limit_value: the maximum position value allowed under that tier (the tier’s limit). If your position value grows beyond this, the tier steps up (higher requirements).\n\nDetails:\n* Meaning: Bybit enforces “risk limit tiers” to cap position value and scale maintenance margin. The tier is referenced by riskId, and its cap is riskLimitValue.\n* Effects: Higher tiers allow larger positions but increase maintenance margin and may constrain leverage.\n* Portfolio margin note: In portfolio margin mode, both fields are not meaningful and are returned as 0 (docs: “risk limit rules are invalid”).", "required": [ "risk_id", "risk_limit_value", "symbol", "sub_account_address", "side", "size", "avg_price", "position_value", "margin_mode", "position_balance", "position_status", "leverage", "mark_price", "liq_price", "bust_price", "position_im", "position_im_by_mp", "position_mm", "position_mm_by_mp", "unrealized_pnl", "unrealized_funding", "realized_pnl_cur", "realized_pnl_cum", "cum_funding", "adl_rank_indicator", "is_reduce_only", "created_time", "updated_time", "seq" ], "properties": { "adl_rank_indicator": { "$ref": "#/components/schemas/AdlRankIndicator", "description": "Auto-deleverage rank indicator." }, "avg_price": { "type": "string", "description": "Average entry price." }, "bust_price": { "type": "string", "description": "Bankruptcy price" }, "created_time": { "type": "string", "format": "date-time", "description": "Timestamp of the first time a position was created on this symbol (ms)", "example": "1672531200000" }, "cum_funding": { "type": "string", "description": "Net realized funding PnL accumulated for this position (receive positive, pay negative)." }, "is_reduce_only": { "type": "boolean" }, "leverage": { "type": "string", "description": "Position leverage" }, "leverage_sys_updated_time": { "type": [ "string", "null" ], "format": "date-time", "example": "1672531200000" }, "liq_price": { "type": "string", "description": "Position liquidation price" }, "margin_mode": { "$ref": "#/components/schemas/MarginMode", "description": "Is position cross margin or isolated margin" }, "mark_price": { "type": "string", "description": "Mark price" }, "mmr_sys_update_time": { "type": [ "string", "null" ], "format": "date-time", "example": "1672531200000" }, "position_balance": { "type": "string", "description": "Position margin" }, "position_im": { "type": "string", "description": "Initial margin" }, "position_im_by_mp": { "type": "string", "description": "Initial margin calculated by mark price" }, "position_mm": { "type": "string", "description": "Maintenance margin" }, "position_mm_by_mp": { "type": "string", "description": "Maintenance margin calculated by mark price" }, "position_status": { "$ref": "#/components/schemas/PositionStatus", "description": "Position status. Normal, Liq, Adl" }, "position_value": { "type": "string", "description": "Position value" }, "realized_pnl_cum": { "type": "string", "description": "Sum of all historical Current Realized PnLs (and the latest one)." }, "realized_pnl_cur": { "type": "string", "description": "Sum of Fill Realized PnL for position of this symbol/side\nsince this position was created last time" }, "risk_id": { "type": "integer", "format": "int32", "description": "Risk tier ID", "minimum": 0 }, "risk_limit_value": { "type": "string", "description": "Risk limit value" }, "seq": { "type": "integer", "format": "int64", "description": "Cross sequence, used to associate each fill and each position update\n* Different symbols may have the same seq, please use seq + symbol to check unique", "minimum": 0 }, "side": { "$ref": "#/components/schemas/Side", "description": "Position side. Buy: long, Sell: short" }, "size": { "type": "string", "description": "Position size, always positive" }, "stop_loss": { "type": [ "string", "null" ], "description": "Stop loss price" }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol", "description": "Symbol name" }, "take_profit": { "type": [ "string", "null" ], "description": "Take profit price" }, "trailing_stop": { "type": [ "string", "null" ], "description": "Trailing stop (The distance from market price)" }, "unrealized_funding": { "type": "string", "description": "Net unsettled funding PnL for this position (receive positive, pay negative)." }, "unrealized_pnl": { "type": "string", "description": "How much USDC an account will receive (or pay if negative)\nif the position is closed at the current MarkPrice" }, "updated_time": { "type": "string", "format": "date-time", "description": "Position data updated timestamp (ms)", "example": "1672531200000" } } }, "PositionStatus": { "type": "string", "enum": [ "Normal", "Liq", "Adl" ] }, "PriceFilter": { "type": "object", "required": [ "min_price", "max_price", "tick_size" ], "properties": { "max_price": { "type": "string" }, "min_price": { "type": "string" }, "tick_size": { "type": "string" } } }, "PriceKlineSnapshot": { "type": "object", "description": "Price-only kline entry. Used for mark price and index price klines.", "required": [ "t", "o", "h", "l", "c" ], "properties": { "c": { "type": "string" }, "h": { "type": "string" }, "l": { "type": "string" }, "o": { "type": "string" }, "t": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "PublicTrade": { "type": "object", "description": "A single trade entry from the public trade stream.", "required": [ "i", "s", "S", "v", "p", "seq", "T" ], "properties": { "S": { "$ref": "#/components/schemas/Side", "description": "Side of taker." }, "T": { "type": "integer", "format": "int64", "description": "The timestamp (ms) that the order is filled.", "example": "1672531200000", "minimum": 0 }, "i": { "type": "string", "description": "Trade ID." }, "p": { "type": "string", "description": "Trade price." }, "s": { "$ref": "#/components/schemas/Symbol", "description": "Symbol name." }, "seq": { "type": "integer", "format": "int64", "description": "Cross sequence.", "minimum": 0 }, "v": { "type": "string", "description": "Trade size." } } }, "ReferralSummaryResponse": { "type": "object", "required": [ "referral_code", "downline_count" ], "properties": { "downline_count": { "type": "integer", "format": "int64", "minimum": 0 }, "referral_code": { "type": "string" }, "referrer_code": { "type": [ "string", "null" ] }, "referrer_user_id": { "type": [ "string", "null" ] } } }, "RejectReason": { "type": "string", "enum": [ "EcNoError", "EcOthers", "EcInsufficientFunds", "EcUnknownMessageType", "EcMissingClOrdId", "EcMissingOrigClOrdId", "EcClOrdIdOrigClOrdIdAreTheSame", "EcDuplicatedClOrdId", "EcOrigClOrdIdDoesNotExist", "EcTooLateToCancel", "EcUnknownOrderType", "EcUnknownSide", "EcUnknownTimeInForce", "EcWronglyRouted", "EcMarketOrderPriceIsNotZero", "EcLimitOrderInvalidPrice", "EcNoEnoughQtyToFill", "EcNoImmediateQtyToFill", "EcPerCancelRequest", "EcMarketOrderCannotBePostOnly", "EcPostOnlyWillTakeLiquidity", "EcReduceOnlyNoPosition", "EcReduceOnlyWouldIncreasePosition", "EcReduceOnlyExceedsPosition", "EcReduceOnlyMode", "EcTradingHalted", "EcCancelReplaceOrder", "EcInvalidSymbolStatus", "EcCancelForNoFullFill", "EcBySelfMatch", "EcInCallAuctionStatus", "EcQtyCannotBeZero", "EcMarketOrderNoSupportTif", "EcReachMaxTradeNum", "EcInvalidPriceScale", "EcBitIndexInvalid", "EcStopBySelfMatch", "EcInvalidSmpType", "EcCancelByMmp", "EcInvalidUserType", "EcInvalidMirrorOid", "EcInvalidMirrorUid", "EcEcInvalidQty", "EcInvalidAmount", "EcLoadOrderCancel", "EcMarketQuoteNoSuppSell", "EcDisorderOrderId", "EcInvalidBaseValue", "EcLoadOrderCanMatch", "EcSecurityStatusFail", "EcReachRiskPriceLimit", "EcOrderNotExist", "EcCancelByOrderValueZero", "EcCancelByMatchValueZero", "EcReachMarketPriceLimit" ] }, "RewardSummaryResponse": { "type": "object", "required": [ "current_week", "history", "xp_balance", "ledger" ], "properties": { "current_week": { "$ref": "#/components/schemas/RewardWeekSummary" }, "history": { "type": "array", "items": { "$ref": "#/components/schemas/RewardWeekSummary" } }, "ledger": { "type": "array", "items": { "$ref": "#/components/schemas/PointsLedgerEntry" } }, "xp_balance": { "type": "integer", "format": "int64" } } }, "RewardWeekSummary": { "type": "object", "required": [ "week_start", "week_end", "own_ps", "bonus_ps", "final_ps", "xp", "finalized" ], "properties": { "bonus_ps": { "type": "string" }, "final_ps": { "type": "string" }, "finalized": { "type": "boolean" }, "own_ps": { "type": "string" }, "week_end": { "type": "integer", "format": "int64" }, "week_start": { "type": "integer", "format": "int64" }, "xp": { "type": "string" } } }, "RiskLimit": { "type": "object", "required": [ "symbol", "risk_id", "risk_limit_value", "maintenance_margin", "initial_margin", "is_lowest_risk", "max_leverage", "mm_duration" ], "properties": { "initial_margin": { "type": "string", "description": "Initial margin rate" }, "is_lowest_risk": { "type": "boolean" }, "maintenance_margin": { "type": "string", "description": "Maintain margin rate" }, "max_leverage": { "type": "string", "description": "Allowed max leverage" }, "mm_duration": { "type": "string", "description": "The maintenance margin deduction value when risk limit tier changed" }, "risk_id": { "type": "integer", "format": "int32", "description": "Risk ID", "minimum": 0 }, "risk_limit_value": { "type": "string", "description": "Position limit" }, "symbol": { "$ref": "#/components/schemas/Symbol", "description": "Symbol name" } } }, "RootWhitelistCheckQuery": { "type": "object", "properties": { "root_address": { "type": [ "string", "null" ] }, "root_public_key": { "type": [ "string", "null" ] } } }, "RootWhitelistResponse": { "type": "object", "required": [ "root_address", "whitelisted" ], "properties": { "root_address": { "type": "string" }, "whitelisted": { "type": "boolean" } } }, "Scope": { "type": "string", "enum": [ "full", "read", "trade", "withdraw", "admin" ] }, "SessionAuthRequest": { "type": "object", "description": "A request to authenticate using a Session Key.", "required": [ "delegation", "nonce", "timestamp_ms", "session_signature" ], "properties": { "delegation": { "$ref": "#/components/schemas/SessionDelegation" }, "nonce": { "type": "string" }, "session_signature": { "type": "string" }, "timestamp_ms": { "type": "integer", "format": "int64" } } }, "SessionDelegation": { "type": "object", "description": "A delegation of authority from a Root Key to a Session Key.", "required": [ "root_public_key", "session_public_key", "scopes", "expires_at", "root_signature" ], "properties": { "expires_at": { "type": "integer", "format": "int64" }, "root_public_key": { "type": "string" }, "root_signature": { "type": "string" }, "scopes": { "type": "array", "items": { "$ref": "#/components/schemas/Scope" } }, "session_public_key": { "type": "string" } } }, "SetLeverageRequest": { "type": "object", "description": "Request to set leverage.", "required": [ "sub_account_address", "symbol", "leverage" ], "properties": { "leverage": { "type": "string" }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" } } }, "SetLeverageResponse": { "type": "object", "description": "Set leverage response.", "required": [ "success", "time" ], "properties": { "success": { "type": "boolean" }, "time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "SetTradingStopRequest": { "type": "object", "description": "Set the take profit, stop loss or trailing stop for the position.", "required": [ "symbol", "sub_account_address" ], "properties": { "active_price": { "type": [ "string", "null" ] }, "sl_size": { "type": [ "string", "null" ], "description": "Stop loss size\nvalid for TP/SL partial mode, note: the value of tpSize and slSize must equal" }, "sub_account_address": { "type": "string" }, "symbol": { "$ref": "#/components/schemas/Symbol" }, "tp_size": { "type": [ "string", "null" ], "description": "Take profit size\nvalid for TP/SL partial mode, note: the value of tpSize and slSize must equal" }, "tpsl": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/TpSl" } ] }, "trailing_stop": { "type": [ "string", "null" ] } } }, "SetTradingStopResponse": { "type": "object", "description": "Response for setting trading stop.", "required": [ "success", "time" ], "properties": { "success": { "type": "boolean" }, "time": { "type": "string", "format": "date-time", "example": "1672531200000" } } }, "Side": { "type": "string", "description": "Order side: buy or sell.", "enum": [ "Sell", "Buy" ] }, "SlippageTolerance": { "oneOf": [ { "type": "object", "required": [ "tick_size" ], "properties": { "tick_size": { "type": "integer", "format": "int64", "minimum": 0 } } }, { "type": "object", "required": [ "percent" ], "properties": { "percent": { "type": "number", "format": "double" } } } ] }, "SmpType": { "type": "string", "description": "Self Match Prevention strategy.", "enum": [ "CancelMaker", "CancelTaker", "CancelBoth" ] }, "StopOrderType": { "type": "string", "enum": [ "TakeProfit", "StopLoss", "TrailingStop", "Stop", "PartialTakeProfit", "PartialStopLoss", "TpslOrder", "OcoOrder", "MmRateClose", "BidirectionalTpslOrder" ] }, "String": { "type": "string" }, "Symbol": { "type": "string", "example": "BTCUSDC" }, "SystemInfo": { "type": "object", "required": [ "build_id", "aptos_network", "perpetual_addr", "quote_asset_metadata", "runtime_manifest_generation", "runtime_manifest_phase" ], "properties": { "aptos_network": { "type": "string" }, "build_id": { "type": "string", "description": "Build identifier for the running backend (e.g. git commit SHA).\n\nThis is used for milestone acceptance verification without disclosing source code." }, "perpetual_addr": { "type": "string" }, "quote_asset_metadata": { "type": "string" }, "runtime_manifest_generation": { "type": "integer", "format": "int64", "minimum": 0 }, "runtime_manifest_phase": { "type": "string" } } }, "TickerSnapshot": { "type": "object", "description": "Query for the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.", "required": [ "symbol", "addr", "last_price", "index_price", "mark_price", "prev_price_24h", "high_price_24h", "low_price_24h", "prev_price_1h", "volume_24h", "turnover_24h", "open_interest", "open_interest_value", "funding_rate", "next_funding_time", "best_ask_size", "best_ask_price", "best_bid_size", "best_bid_price" ], "properties": { "addr": { "type": "string", "description": "Market address" }, "best_ask_price": { "type": "string", "description": "Best ask price" }, "best_ask_size": { "type": "string", "description": "Best ask size" }, "best_bid_price": { "type": "string", "description": "Best bid price" }, "best_bid_size": { "type": "string", "description": "Best bid size" }, "funding_rate": { "type": "string", "description": "Funding rate" }, "high_price_24h": { "type": "string", "description": "The highest price in the last 24 hours" }, "index_price": { "type": "string", "description": "Index price" }, "last_price": { "type": "string", "description": "Last traded price" }, "low_price_24h": { "type": "string", "description": "The lowest price in the last 24 hours" }, "mark_price": { "type": "string", "description": "Mark price" }, "next_funding_time": { "type": "string", "format": "date-time", "description": "Next funding time (ms)", "example": "1672531200000" }, "open_interest": { "type": "string", "description": "Open interest size" }, "open_interest_value": { "type": "string", "description": "Open interest value" }, "prev_price_1h": { "type": "string", "description": "Market price 1 hour ago" }, "prev_price_24h": { "type": "string", "description": "Market price 24 hours ago" }, "symbol": { "$ref": "#/components/schemas/Symbol", "description": "Symbol name" }, "turnover_24h": { "type": "string", "description": "Turnover for 24h" }, "volume_24h": { "type": "string", "description": "Volume for 24h" } } }, "TimeInForce": { "oneOf": [ { "type": "string", "description": "Good Till Cancel", "enum": [ "GTC" ] }, { "type": "string", "description": "Immediate or Cancel", "enum": [ "IOC" ] }, { "type": "string", "description": "Fill or Kill", "enum": [ "FOK" ] }, { "type": "object", "description": "Good Till Date", "required": [ "GTD" ], "properties": { "GTD": { "type": "integer", "format": "int64", "description": "Good Till Date", "minimum": 0 } } }, { "type": "string", "description": "Good For Day", "enum": [ "Day" ] } ], "description": "Time in Force instructions." }, "Timeframe": { "type": "string", "description": "Leaderboard ranking window: today, last 7 days, last 30 days, or all time.", "enum": [ "today", "7d", "30d", "all" ] }, "TpSl": { "type": "object", "required": [ "mode" ], "properties": { "mode": { "$ref": "#/components/schemas/TpSlMode" }, "stop_loss": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/TpSlSpec" } ] }, "take_profit": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/TpSlSpec" } ] } } }, "TpSlMode": { "type": "string", "enum": [ "Full", "Partial" ] }, "TpSlSpec": { "oneOf": [ { "type": "object", "required": [ "market" ], "properties": { "market": { "type": "object", "required": [ "trigger_price", "trigger_by" ], "properties": { "trigger_by": { "$ref": "#/components/schemas/TriggerBy" }, "trigger_price": { "type": "string" } } } } }, { "type": "object", "required": [ "limit" ], "properties": { "limit": { "type": "object", "required": [ "trigger_price", "limit_price", "trigger_by" ], "properties": { "limit_price": { "type": "string" }, "trigger_by": { "$ref": "#/components/schemas/TriggerBy" }, "trigger_price": { "type": "string" } } } } } ] }, "TriggerBy": { "type": "string", "enum": [ "LastPrice", "IndexPrice", "MarkPrice" ] }, "TriggerDirection": { "type": "string", "enum": [ "Up", "Down" ] }, "UserId": { "type": "string", "format": "uuid" }, "WithdrawFromTradingRequest": { "type": "object", "required": [ "amount", "addr_from", "addr_to", "asset_metadata", "nonce", "signature", "withdraw_available" ], "properties": { "addr_from": { "type": "string" }, "addr_to": { "type": "string" }, "amount": { "type": "string", "example": "100.0" }, "asset_metadata": { "type": "string" }, "nonce": { "type": "integer", "format": "int64", "minimum": 0 }, "signature": { "type": "string" }, "withdraw_available": { "type": "boolean" } } } }, "securitySchemes": { "api_key_auth": { "type": "apiKey", "in": "header", "name": "X-API-KEY" }, "bearer_auth": { "type": "http", "scheme": "bearer" }, "root_whitelist_basic_auth": { "type": "http", "scheme": "basic" } } } }