{ "openapi": "3.1.0", "info": { "title": "AllTick Market Data API", "description": "Real-time and historical market data API for stocks, forex, cryptocurrencies, and commodities.", "version": "1.0.0" }, "servers": [ { "url": "https://quote.alltick.co", "description": "Production" } ], "paths": { "/quote-stock-b-api/kline": { "get": { "operationId": "getStockKline", "summary": "Stock K-Line Query", "description": "Query historical K-line (candlestick) data for a single stock product (US stocks, HK stocks, A-shares). Returns OHLCV data. Max 500 K-lines per request.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "query", "in": "query", "required": true, "description": "URL-encoded JSON string containing trace and data fields.", "schema": { "type": "string", "default": "{\"trace\":\"abc-123\",\"data\":{\"code\":\"700.HK\",\"kline_type\":1,\"kline_timestamp_end\":0,\"query_kline_num\":2,\"adjust_type\":0}}" }, "example": "{\"trace\":\"abc-123\",\"data\":{\"code\":\"700.HK\",\"kline_type\":1,\"kline_timestamp_end\":0,\"query_kline_num\":2,\"adjust_type\":0}}" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/KlineResponse" } } } } } } }, "/quote-b-api/kline": { "get": { "operationId": "getForexKline", "summary": "Forex/Crypto K-Line Query", "description": "Query historical K-line data for forex, cryptocurrency, precious metals, crude oil, and commodity products. Max 500 K-lines per request.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "query", "in": "query", "required": true, "description": "URL-encoded JSON string containing trace and data fields.", "schema": { "type": "string", "default": "{\"trace\":\"abc-123\",\"data\":{\"code\":\"BTCUSDT\",\"kline_type\":1,\"kline_timestamp_end\":0,\"query_kline_num\":2,\"adjust_type\":0}}" }, "example": "{\"trace\":\"abc-123\",\"data\":{\"code\":\"BTCUSDT\",\"kline_type\":1,\"kline_timestamp_end\":0,\"query_kline_num\":2,\"adjust_type\":0}}" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/KlineResponse" } } } } } } }, "/quote-stock-b-api/batch-kline": { "post": { "operationId": "postStockBatchKline", "summary": "Stock Batch K-Line Query", "description": "Batch query latest 2 K-lines for multiple stock products. Supports querying multiple products and K-line types simultaneously.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchKlineRequest" }, "example": { "trace": "abc-123", "data": { "data_list": [ { "code": "700.HK", "kline_type": 1, "kline_timestamp_end": 0, "query_kline_num": 2, "adjust_type": 0 }, { "code": "AAPL.US", "kline_type": 8, "kline_timestamp_end": 0, "query_kline_num": 2, "adjust_type": 0 } ] } } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchKlineResponse" } } } } } } }, "/quote-b-api/batch-kline": { "post": { "operationId": "postForexBatchKline", "summary": "Forex/Crypto Batch K-Line Query", "description": "Batch query latest 2 K-lines for multiple forex, crypto, or commodity products.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchKlineRequest" }, "example": { "trace": "abc-123", "data": { "data_list": [ { "code": "BTCUSDT", "kline_type": 1, "kline_timestamp_end": 0, "query_kline_num": 2, "adjust_type": 0 }, { "code": "ETHUSDT", "kline_type": 8, "kline_timestamp_end": 0, "query_kline_num": 2, "adjust_type": 0 } ] } } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BatchKlineResponse" } } } } } } }, "/quote-stock-b-api/depth-tick": { "get": { "operationId": "getStockDepthTick", "summary": "Stock Order Book Query", "description": "Query latest order book (market depth) data for stock products. Supports batch querying multiple products.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "query", "in": "query", "required": true, "description": "URL-encoded JSON string containing trace and symbol_list.", "schema": { "type": "string", "default": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"700.HK\"},{\"code\":\"AAPL.US\"}]}}" }, "example": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"700.HK\"},{\"code\":\"AAPL.US\"}]}}" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DepthTickResponse" } } } } } } }, "/quote-b-api/depth-tick": { "get": { "operationId": "getForexDepthTick", "summary": "Forex/Crypto Order Book Query", "description": "Query latest order book data for forex, crypto, precious metals, and commodity products.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "query", "in": "query", "required": true, "description": "URL-encoded JSON string containing trace and symbol_list.", "schema": { "type": "string", "default": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"BTCUSDT\"},{\"code\":\"ETHUSDT\"}]}}" }, "example": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"BTCUSDT\"},{\"code\":\"ETHUSDT\"}]}}" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DepthTickResponse" } } } } } } }, "/quote-stock-b-api/trade-tick": { "get": { "operationId": "getStockTradeTick", "summary": "Stock Latest Trade Query", "description": "Query latest trade price (tick data) for stock products. Supports batch querying multiple products.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "query", "in": "query", "required": true, "description": "URL-encoded JSON string containing trace and symbol_list.", "schema": { "type": "string", "default": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"700.HK\"},{\"code\":\"AAPL.US\"}]}}" }, "example": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"700.HK\"},{\"code\":\"AAPL.US\"}]}}" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TradeTickResponse" } } } } } } }, "/quote-b-api/trade-tick": { "get": { "operationId": "getForexTradeTick", "summary": "Forex/Crypto Latest Trade Query", "description": "Query latest trade price for forex, crypto, precious metals, and commodity products.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "query", "in": "query", "required": true, "description": "URL-encoded JSON string containing trace and symbol_list.", "schema": { "type": "string", "default": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"BTCUSDT\"},{\"code\":\"ETHUSDT\"}]}}" }, "example": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"BTCUSDT\"},{\"code\":\"ETHUSDT\"}]}}" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TradeTickResponse" } } } } } } }, "/quote-stock-b-api/static_info": { "get": { "operationId": "getStockStaticInfo", "summary": "Stock Static Info Query", "description": "Batch query basic product information for US stocks, HK stocks, and A-shares.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "Your API authentication token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "query", "in": "query", "required": true, "description": "URL-encoded JSON string containing trace and symbol_list fields.", "schema": { "type": "string", "default": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"700.HK\"},{\"code\":\"AAPL.US\"}]}}" }, "example": "{\"trace\":\"abc-123\",\"data\":{\"symbol_list\":[{\"code\":\"700.HK\"},{\"code\":\"AAPL.US\"}]}}" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StaticInfoResponse" } } } } } } }, "/api/suspension/sse": { "get": { "operationId": "getSseSuspension", "summary": "SSE Suspension Query", "description": "Get all suspension and resumption information from the Shanghai Stock Exchange (SSE).", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "User subscription token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "page", "in": "query", "required": false, "description": "Query page number", "schema": { "type": "integer", "default": 1 }, "example": 1 }, { "name": "size", "in": "query", "required": false, "description": "Page size", "schema": { "type": "integer", "default": 10 }, "example": 10 } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object" } } } } } } }, "/api/suspension/nyse": { "get": { "operationId": "getNyseSuspension", "summary": "NYSE Suspension Query", "description": "Get all suspension and resumption information from the New York Stock Exchange (NYSE).", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "User subscription token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "page", "in": "query", "required": false, "description": "Query page number", "schema": { "type": "integer", "default": 1 }, "example": 1 }, { "name": "size", "in": "query", "required": false, "description": "Page size", "schema": { "type": "integer", "default": 10 }, "example": 10 } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object" } } } } } } }, "/api/suspension/nasdaq": { "get": { "operationId": "getNasdaqSuspension", "summary": "NASDAQ Suspension Query", "description": "Get all suspension and resumption information from NASDAQ.", "parameters": [ { "name": "token", "in": "query", "required": true, "description": "User subscription token", "schema": { "type": "string", "default": "YOUR_TOKEN_HERE" }, "example": "YOUR_TOKEN_HERE" }, { "name": "page", "in": "query", "required": false, "description": "Query page number", "schema": { "type": "integer", "default": 1 }, "example": 1 }, { "name": "size", "in": "query", "required": false, "description": "Page size", "schema": { "type": "integer", "default": 10 }, "example": 10 } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object" } } } } } } } }, "components": { "schemas": { "KlineResponse": { "type": "object", "properties": { "ret": { "type": "integer", "description": "Return code (200 = success)" }, "msg": { "type": "string", "description": "Response message" }, "trace": { "type": "string", "description": "Request trace ID" }, "data": { "type": "object", "properties": { "code": { "type": "string", "description": "Product code" }, "kline_type": { "type": "integer", "description": "K-line type (1=1min, 2=5min, 3=15min, 4=30min, 5=1hour, 6=2hour, 7=4hour, 8=daily, 9=weekly, 10=monthly)" }, "kline_list": { "type": "array", "items": { "type": "object", "properties": { "timestamp": { "type": "string", "description": "K-line timestamp" }, "open_price": { "type": "string", "description": "Open price" }, "close_price": { "type": "string", "description": "Close price" }, "high_price": { "type": "string", "description": "High price" }, "low_price": { "type": "string", "description": "Low price" }, "volume": { "type": "string", "description": "Volume" }, "turnover": { "type": "string", "description": "Turnover" } } } } } } } }, "BatchKlineRequest": { "type": "object", "required": [ "trace", "data" ], "properties": { "trace": { "type": "string", "description": "Unique trace ID for request tracking" }, "data": { "type": "object", "required": [ "data_list" ], "properties": { "data_list": { "type": "array", "items": { "type": "object", "required": [ "code", "kline_type", "kline_timestamp_end", "query_kline_num", "adjust_type" ], "properties": { "code": { "type": "string", "description": "Product code" }, "kline_type": { "type": "integer", "description": "K-line type (1=1min, 2=5min, 3=15min, 4=30min, 5=1hour, 6=2hour, 7=4hour, 8=daily, 9=weekly, 10=monthly)" }, "kline_timestamp_end": { "type": "integer", "description": "End timestamp (0 = latest)" }, "query_kline_num": { "type": "integer", "description": "Number of K-lines to query (max 2 for batch)" }, "adjust_type": { "type": "integer", "description": "Adjustment type (0=ex-rights, 1=forward-adjusted)" } } } } } } } }, "BatchKlineResponse": { "type": "object", "properties": { "ret": { "type": "integer" }, "msg": { "type": "string" }, "trace": { "type": "string" }, "data": { "type": "object", "properties": { "kline_list": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string" }, "kline_type": { "type": "integer" }, "kline_data": { "type": "array", "items": { "type": "object", "properties": { "timestamp": { "type": "string" }, "open_price": { "type": "string" }, "close_price": { "type": "string" }, "high_price": { "type": "string" }, "low_price": { "type": "string" }, "volume": { "type": "string" }, "turnover": { "type": "string" } } } } } } } } } } }, "DepthTickResponse": { "type": "object", "properties": { "ret": { "type": "integer" }, "msg": { "type": "string" }, "trace": { "type": "string" }, "data": { "type": "object", "properties": { "tick_list": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string", "description": "Product code" }, "seq": { "type": "string", "description": "Quote sequence number" }, "tick_time": { "type": "string", "description": "Quote timestamp (ms)" }, "bids": { "type": "array", "items": { "type": "object", "properties": { "price": { "type": "string" }, "volume": { "type": "string" } } } }, "asks": { "type": "array", "items": { "type": "object", "properties": { "price": { "type": "string" }, "volume": { "type": "string" } } } } } } } } } } }, "TradeTickResponse": { "type": "object", "properties": { "ret": { "type": "integer" }, "msg": { "type": "string" }, "trace": { "type": "string" }, "data": { "type": "object", "properties": { "tick_list": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string", "description": "Product code" }, "seq": { "type": "string", "description": "Sequence number" }, "tick_time": { "type": "string", "description": "Timestamp (ms)" }, "price": { "type": "string", "description": "Trade price" }, "volume": { "type": "string", "description": "Trade volume" }, "turnover": { "type": "string", "description": "Trade turnover" }, "trade_direction": { "type": "integer", "description": "Trade direction (0=neutral, 1=buy, 2=sell)" } } } } } } } }, "StaticInfoResponse": { "type": "object", "properties": { "ret": { "type": "integer", "description": "Return code (200 = success)" }, "msg": { "type": "string", "description": "Response message" }, "trace": { "type": "string", "description": "Request trace ID" }, "data": { "type": "object", "properties": { "static_info_list": { "type": "array", "items": { "type": "object", "properties": { "board": { "type": "string", "description": "Stock board" }, "bps": { "type": "string", "description": "Book value per share" }, "circulating_shares": { "type": "string", "description": "Circulating shares" }, "currency": { "type": "string", "description": "Trading currency" }, "dividend_yield": { "type": "string", "description": "Dividend yield" }, "eps": { "type": "string", "description": "Earnings per share" }, "eps_ttm": { "type": "string", "description": "Earnings per share (TTM)" }, "exchange": { "type": "string", "description": "Exchange to which the product belongs" }, "hk_shares": { "type": "string", "description": "Hong Kong stock shares (Hong Kong stocks only)" }, "lot_size": { "type": "string", "description": "Shares per lot" }, "name_cn": { "type": "string", "description": "Simplified Chinese product name" }, "name_en": { "type": "string", "description": "English product name" }, "name_hk": { "type": "string", "description": "Traditional Chinese product name" }, "symbol": { "type": "string", "description": "Product code" }, "total_shares": { "type": "string", "description": "Total shares" } } } } } } } }, "SuspensionResponse": { "type": "object", "properties": { "success": { "type": "boolean", "description": "Whether the request was successful" }, "timestamp": { "type": "string", "description": "Response timestamp" }, "totalCount": { "type": "integer", "description": "Total number of records" }, "totalPages": { "type": "integer", "description": "Total pages (returned for paginated queries)" }, "currentPage": { "type": "integer", "description": "Current page (returned for paginated queries)" }, "currentSize": { "type": "integer", "description": "Number of records on the current page (returned for paginated queries)" }, "data": { "type": "array", "description": "Suspension and resumption information list", "items": { "type": "object", "additionalProperties": true, "properties": { "symbol": { "type": "string", "description": "Stock code" }, "symbolName": { "type": "string", "description": "Stock name" }, "haltReason": { "type": "string", "description": "Suspension reason" }, "haltDate": { "type": "string", "description": "Suspension date" }, "haltTime": { "type": "string", "description": "Suspension time" }, "resumeDate": { "type": "string", "description": "Resumption date" }, "resumeTime": { "type": "string", "description": "Resumption time" }, "publishDate": { "type": "string", "description": "Announcement time" } } } } } } } } }