### GET /snapshot - 行情快照Snapshot Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 获取当前最新实时快照数据,包含最新价、开高低价、成交量额、买卖盘口、持仓量等完整信息。股票提供5档盘口,期货提供1档盘口。支持同时查询多个symbol和跨品种混合查询。 ```APIDOC ## GET /snapshot ### Description 获取当前最新实时快照数据,包含最新价、开高低价、成交量额、买卖盘口、持仓量等完整信息。股票提供5档盘口,期货提供1档盘口。支持同时查询多个symbol和跨品种混合查询。 ### Method GET ### Endpoint https://rest.vvtr.com/v1/snapshot ### Query Parameters - **symbols** (string) - Required - 证券代码,多个用分号分隔 (e.g., "600000;rb9999") - **type** (string) - Required - 品种类型代码,与symbols一一对应,多个用逗号分隔 (e.g., "11,14") - **apiKey** (string) - Required - 您的API密钥 ### Request Example ```bash # 获取期货主力合约快照 curl "https://rest.vvtr.com/v1/snapshot?symbols=rb9999&type=14&apiKey=your_api_key" # 获取多个A股快照(5档盘口) curl "https://rest.vvtr.com/v1/snapshot?symbols=600000,000001&type=11&apiKey=your_api_key" # 跨品种混合查询(A股和期货) curl "https://rest.vvtr.com/v1/snapshot?symbols=600000;rb9999&type=11,14&apiKey=your_api_key" ``` ### Response #### Success Response (200) - **code** (integer) - 响应状态码, 200表示成功 - **msg** (string) - 响应消息 - **data** (array) - 快照数据列表 - **symbol** (string) - 证券代码 - **open** (number) - 开盘价 - **high** (number) - 最高价 - **low** (number) - 最低价 - **price** (number) - 最新价 - **cumVolume** (number) - 累计成交量 - **cumAmount** (number) - 累计成交额 - **lastVolume** (number) - 本笔成交量 - **lastAmount** (number) - 本笔成交额 - **createdAt** (string) - 数据更新时间 - **cumPosition** (number) - 累计持仓量 (期货) - **tradeType** (integer) - 交易状态 - **quotes** (array) - 盘口数据 - **bidP** (number) - 买入价 - **bidV** (number) - 买入量 - **askP** (number) - 卖出价 - **askV** (number) - 卖出量 #### Response Example ```json { "code": 200, "msg": "ok", "data": [ { "symbol": "SA2511", "open": 1404, "high": 1405, "low": 1352, "price": 1399, "cumVolume": 0, "cumAmount": 0, "lastVolume": 0, "lastAmount": 0, "createdAt": "2025-04-09 11:30:00", "cumPosition": 0, "tradeType": 0, "quotes": [ { "bidP": 1397, "bidV": 1, "askP": 1400, "askV": 2 } ] } ] } ``` ``` -------------------------------- ### GET /kline/current - 最新K线Current Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 获取symbol当前各周期的最新K线(日K及以下),建议在每分钟第5秒后请求以获取准确的分钟K线数据。支持批量查询和多周期同时获取。 ```APIDOC ## GET /kline/current ### Description 获取symbol当前各周期的最新K线(日K及以下),建议在每分钟第5秒后请求以获取准确的分钟K线数据。5秒前的分钟K由tick合成可能存在误差。支持批量查询和多周期同时获取。 ### Method GET ### Endpoint https://rest.vvtr.com/v1/kline/current ### Query Parameters - **symbols** (string) - Required - 证券代码,多个用逗号分隔 (e.g., "600000,600004") - **type** (integer) - Required - 品种类型代码 - **interval** (string) - Required - K线周期 (e.g., "1m", "5m", "15m", "1h", "1d") - **apiKey** (string) - Required - 您的API密钥 ### Request Example ```bash # 获取A股最新1分钟K线 curl "https://rest.vvtr.com/v1/kline/current?symbols=600000,600004&type=11&interval=1m&apiKey=your_api_key" # 获取期货最新5分钟K线 curl "https://rest.vvtr.com/v1/kline/current?symbols=rb9999,hc9999&type=14&interval=5m&apiKey=your_api_key" # 获取美股最新日K线 curl "https://rest.vvtr.com/v1/kline/current?symbols=AAPL,TSLA&type=21&interval=1d&apiKey=your_api_key" ``` ### Response #### Success Response (200) - **code** (integer) - 响应状态码, 200表示成功 - **msg** (string) - 响应消息 - **data** (array) - 最新K线数据列表 - **symbol** (string) - 证券代码 - **interval** (string) - K线周期 - **frequency** (string) - K线频率 - **open** (number) - 开盘价 - **high** (number) - 最高价 - **close** (number) - 收盘价 - **low** (number) - 最低价 - **amount** (number) - 成交额 - **volume** (number) - 成交量 - **position** (number) - 持仓量 (期货) - **bob** (string) - 周期开始时间 - **eob** (string) - 周期结束时间 - **type** (integer) - 品种类型 - **sequence** (integer) - 序列号 #### Response Example ```json { "code": 200, "msg": "ok", "data": [ { "symbol": "600000", "interval": "1m", "frequency": "1m", "open": 12.15, "high": 12.17, "close": 12.17, "low": 12.14, "amount": 3275979, "volume": 269442, "position": 0, "bob": "2025-05-27 14:56:00", "eob": "2025-05-27 14:57:00", "type": 11, "sequence": 1 } ] } ``` ``` -------------------------------- ### GET /symbols - 获取symbol列表 Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 查询指定品种下所有活跃证券代码,每日盘前更新。支持A股、期货、美股、基金、债券、指数、加密货币等多种资产类别,返回证券代码、名称、交易所、上市退市日期等基础信息。 ```APIDOC ## GET /symbols ### Description 查询指定品种下所有活跃证券代码,每日盘前更新。支持A股、期货、美股、基金、债券、指数、加密货币等多种资产类别,返回证券代码、名称、交易所、上市退市日期等基础信息。 ### Method GET ### Endpoint https://rest.vvtr.com/v1/symbols ### Query Parameters - **type** (integer) - Required - 品种类型代码 (e.g., 11 for A-shares, 14 for Futures, 21 for US Stocks) - **apiKey** (string) - Required - 您的API密钥 ### Request Example ```bash curl "https://rest.vvtr.com/v1/symbols?type=11&apiKey=your_api_key" ``` ### Response #### Success Response (200) - **code** (integer) - 响应状态码, 200表示成功 - **msg** (string) - 响应消息 - **data** (array) - 证券代码列表 - **symbol** (string) - 证券代码 - **exchange** (string) - 交易所 - **name** (string) - 证券名称 - **listedDate** (string) - 上市日期 - **delistedDate** (string) - 退市日期 - **type** (integer) - 品种类型 #### Response Example ```json { "code": 200, "msg": "ok", "data": [ { "symbol": "600000", "exchange": "SHSE", "name": "浦发银行", "listedDate": "1999-11-10 00:00:00", "delistedDate": "2038-01-01 00:00:00", "type": 11 } ] } ``` ``` -------------------------------- ### GET /kline/history - 获取历史K线 Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 查询指定时间区间的历史K线数据,支持1分钟到月线的多种周期。数据自动分页,单页返回约2000条记录,支持复权计算。 ```APIDOC ## GET /kline/history ### Description 查询指定时间区间的历史K线数据,支持1分钟到月线的多种周期。15分钟以下粒度支持查询最近6个月,15分钟到日线支持查询近2年,日线及以上可查询全部历史。数据自动分页,单页返回约2000条记录,支持复权计算。 ### Method GET ### Endpoint https://rest.vvtr.com/v1/kline/history ### Query Parameters - **symbols** (string) - Required - 证券代码,多个用逗号分隔 (e.g., "600000,600004") - **type** (integer) - Required - 品种类型代码 - **interval** (string) - Required - K线周期 (e.g., "1m", "5m", "1d", "1w", "1M") - **from** (string) - Required - 开始时间 (格式: "YYYY-MM-DD HH:MM:SS") - **to** (string) - Required - 结束时间 (格式: "YYYY-MM-DD HH:MM:SS") - **adjust** (boolean) - Optional - 是否进行复权计算 (默认为 false) - **cursorToken** (string) - Optional - 分页游标,用于获取下一页数据 - **apiKey** (string) - Required - 您的API密钥 ### Request Example ```bash # 获取A股日K线数据 curl "https://rest.vvtr.com/v1/kline/history?symbols=600000,600004&type=11&interval=1d&from=2025-04-01&to=2025-04-03&apiKey=your_api_key" # 带复权的日K线查询 curl "https://rest.vvtr.com/v1/kline/history?symbols=600000&type=11&interval=1d&from=2025-01-01&to=2025-04-10&adjust=true&apiKey=your_api_key" # 分页查询(使用cursorToken获取下一页) curl "https://rest.vvtr.com/v1/kline/history?symbols=*&type=11&interval=1d&from=2025-04-01&to=2025-04-03&cursorToken=eyJpZCI6MTIzNDU2fQ==&apiKey=your_api_key" ``` ### Response #### Success Response (200) - **code** (integer) - 响应状态码, 200表示成功 - **msg** (string) - 响应消息 - **data** (object) - K线数据 - **records** (array) - K线记录列表 - **id** (integer) - 记录ID - **symbol** (string) - 证券代码 - **interval** (string) - K线周期 - **open** (number) - 开盘价 - **high** (number) - 最高价 - **close** (number) - 收盘价 - **low** (number) - 最低价 - **amount** (number) - 成交额 - **volume** (number) - 成交量 - **position** (number) - 持仓量 (期货) - **bob** (string) - 周期开始时间 - **eob** (string) - 周期结束时间 - **type** (integer) - 品种类型 - **sequence** (integer) - 序列号 - **frequency** (string) - K线频率 - **hasNext** (boolean) - 是否有下一页 - **nextCursorToken** (string) - 下一页的游标Token - **total** (integer) - 总记录数 - **size** (integer) - 每页大小 - **current** (integer) - 当前页码 - **pages** (integer) - 总页数 #### Response Example ```json { "code": 200, "msg": "ok", "data": { "records": [ { "id": 35697406, "symbol": "600000", "interval": "1d", "open": 10.43, "high": 10.46, "close": 10.35, "low": 10.22, "amount": 659250560, "volume": 63920348, "position": 0, "bob": "2025-04-01 08:00:00", "eob": "2025-04-01 08:00:00", "type": 11, "sequence": 1, "frequency": "1d" } ], "hasNext": false, "nextCursorToken": null, "total": 4, "size": 2000, "current": 1, "pages": 1 } } ``` ``` -------------------------------- ### A股财务及市场数据 Source: https://www.vvtr.com/v1/apidoc/index Comprehensive endpoints for A-share financial and market data, including basic information, index constituents, strong stocks, adjustment factors, sector data, funds flow, top/bottom gainers, and financial statements. ```APIDOC ## 股票基础信息 ### Description Retrieves basic information about A-share stocks. ### Method GET ### Endpoint /api/a_shares/basic_info ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. ### Response #### Success Response (200) - **name** (string) - Stock name. - **industry** (string) - Stock industry. #### Response Example ```json { "name": "Tencent Holdings", "industry": "Internet" } ``` ``` ```APIDOC ## 指数成分股 ### Description Retrieves the constituent stocks of an index. ### Method GET ### Endpoint /api/indices/{index_symbol}/constituents ### Parameters #### Path Parameters - **index_symbol** (string) - Required - The index symbol. ### Response #### Success Response (200) - **constituents** (array) - A list of constituent stock symbols. #### Response Example ```json { "constituents": ["000001.SZ", "600519.SH"] } ``` ``` ```APIDOC ## 强势股 ### Description Retrieves a list of strong performing A-share stocks. ### Method GET ### Endpoint /api/a_shares/strong_stocks ### Parameters #### Query Parameters - **date** (string) - Optional - The date for which to retrieve strong stocks (YYYY-MM-DD). ### Response #### Success Response (200) - **stocks** (array) - A list of strong stock symbols. #### Response Example ```json { "stocks": ["000001.SZ", "600519.SH"] } ``` ``` ```APIDOC ## 复权因子 ### Description Retrieves the adjustment factors for A-share stocks. ### Method GET ### Endpoint /api/a_shares/adjustment_factors ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **start_date** (string) - Optional - The start date for adjustment factors (YYYY-MM-DD). - **end_date** (string) - Optional - The end date for adjustment factors (YYYY-MM-DD). ### Response #### Success Response (200) - **factors** (object) - A map of dates to adjustment factors. #### Response Example ```json { "factors": { "2023-01-01": 1.0, "2023-01-02": 1.05 } } ``` ``` ```APIDOC ## 板块代码查询 ### Description Queries for A-share sector codes. ### Method GET ### Endpoint /api/sectors/codes ### Parameters #### Query Parameters - **name** (string) - Optional - The name of the sector to search for. ### Response #### Success Response (200) - **sectors** (array) - A list of sector objects, each with code and name. #### Response Example ```json { "sectors": [ {"code": "000001", "name": "Broad Market Index"} ] } ``` ``` ```APIDOC ## 板块成分股 ### Description Retrieves the constituent stocks of an A-share sector. ### Method GET ### Endpoint /api/sectors/{sector_code}/constituents ### Parameters #### Path Parameters - **sector_code** (string) - Required - The A-share sector code. ### Response #### Success Response (200) - **constituents** (array) - A list of constituent stock symbols. #### Response Example ```json { "constituents": ["000001.SZ", "600519.SH"] } ``` ``` ```APIDOC ## 资金流向 ### Description Retrieves fund flow data for A-share stocks. ### Method GET ### Endpoint /api/a_shares/fund_flow ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **date** (string) - Optional - The date for which to retrieve fund flow data (YYYY-MM-DD). ### Response #### Success Response (200) - **fund_flow** (object) - Fund flow data. #### Response Example ```json { "fund_flow": { "inflow": 10000000, "outflow": 5000000 } } ``` ``` ```APIDOC ## 涨停榜 ### Description Retrieves the list of A-share stocks that hit the upper price limit. ### Method GET ### Endpoint /api/a_shares/limit_up ### Parameters #### Query Parameters - **date** (string) - Optional - The date for which to retrieve the list (YYYY-MM-DD). ### Response #### Success Response (200) - **stocks** (array) - A list of stock symbols that hit the upper limit. #### Response Example ```json { "stocks": ["000001.SZ", "600519.SH"] } ``` ``` ```APIDOC ## 跌停榜 ### Description Retrieves the list of A-share stocks that hit the lower price limit. ### Method GET ### Endpoint /api/a_shares/limit_down ### Parameters #### Query Parameters - **date** (string) - Optional - The date for which to retrieve the list (YYYY-MM-DD). ### Response #### Success Response (200) - **stocks** (array) - A list of stock symbols that hit the lower limit. #### Response Example ```json { "stocks": ["000002.SZ", "600000.SH"] } ``` ``` ```APIDOC ## 报表-年报季报 ### Description Retrieves annual and quarterly financial reports for A-share stocks. ### Method GET ### Endpoint /api/a_shares/financial_reports/annual_quarterly ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **year** (integer) - Required - The reporting year. - **period** (string) - Required - The reporting period ('annual', 'Q1', 'Q2', 'Q3', 'Q4'). ### Response #### Success Response (200) - **report** (object) - The financial report data. #### Response Example ```json { "report": { "revenue": 1000000000, "net_profit": 200000000 } } ``` ``` ```APIDOC ## 报表-资产负债表 ### Description Retrieves the balance sheet for A-share stocks. ### Method GET ### Endpoint /api/a_shares/financial_reports/balance_sheet ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **year** (integer) - Required - The reporting year. - **period** (string) - Required - The reporting period ('annual', 'Q1', 'Q2', 'Q3', 'Q4'). ### Response #### Success Response (200) - **balance_sheet** (object) - The balance sheet data. #### Response Example ```json { "balance_sheet": { "total_assets": 5000000000, "total_liabilities": 2000000000 } } ``` ``` ```APIDOC ## 报表-现金流量表 ### Description Retrieves the cash flow statement for A-share stocks. ### Method GET ### Endpoint /api/a_shares/financial_reports/cash_flow_statement ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **year** (integer) - Required - The reporting year. - **period** (string) - Required - The reporting period ('annual', 'Q1', 'Q2', 'Q3', 'Q4'). ### Response #### Success Response (200) - **cash_flow_statement** (object) - The cash flow statement data. #### Response Example ```json { "cash_flow_statement": { "operating_cash_flow": 800000000, "investing_cash_flow": -300000000 } } ``` ``` ```APIDOC ## 报表-利润表 ### Description Retrieves the income statement for A-share stocks. ### Method GET ### Endpoint /api/a_shares/financial_reports/income_statement ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **year** (integer) - Required - The reporting year. - **period** (string) - Required - The reporting period ('annual', 'Q1', 'Q2', 'Q3', 'Q4'). ### Response #### Success Response (200) - **income_statement** (object) - The income statement data. #### Response Example ```json { "income_statement": { "revenue": 1000000000, "gross_profit": 400000000 } } ``` ``` ```APIDOC ## 财务-主要指标 ### Description Retrieves key financial metrics for A-share stocks. ### Method GET ### Endpoint /api/a_shares/financial_metrics/key ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **year** (integer) - Required - The reporting year. - **period** (string) - Required - The reporting period ('annual', 'Q1', 'Q2', 'Q3', 'Q4'). ### Response #### Success Response (200) - **key_metrics** (object) - Key financial metrics. #### Response Example ```json { "key_metrics": { "eps": 2.50, "roe": 0.15 } } ``` ``` ```APIDOC ## 财务-估值指标 ### Description Retrieves valuation metrics for A-share stocks. ### Method GET ### Endpoint /api/a_shares/financial_metrics/valuation ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. - **year** (integer) - Required - The reporting year. - **period** (string) - Required - The reporting period ('annual', 'Q1', 'Q2', 'Q3', 'Q4'). ### Response #### Success Response (200) - **valuation_metrics** (object) - Valuation metrics. #### Response Example ```json { "valuation_metrics": { "pe_ratio": 30.5, "pb_ratio": 5.2 } } ``` ``` ```APIDOC ## 财务-市值指标 ### Description Retrieves market capitalization metrics for A-share stocks. ### Method GET ### Endpoint /api/a_shares/financial_metrics/market_cap ### Parameters #### Query Parameters - **symbol** (string) - Required - The A-share stock symbol. ### Response #### Success Response (200) - **market_cap_metrics** (object) - Market capitalization metrics. #### Response Example ```json { "market_cap_metrics": { "market_cap": 100000000000, "circulating_market_cap": 80000000000 } } ``` ``` -------------------------------- ### 获取行情快照 (REST API) Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 获取当前最新实时快照数据,包含最新价、开高低价、成交量额、买卖盘口等信息。股票提供5档盘口,期货提供1档盘口。支持同时查询多个symbol和跨品种混合查询。 ```bash # 获取期货主力合约快照 curl "https://rest.vvtr.com/v1/snapshot?symbols=rb9999&type=14&apiKey=your_api_key" # 获取多个A股快照(5档盘口) curl "https://rest.vvtr.com/v1/snapshot?symbols=600000,000001&type=11&apiKey=your_api_key" # 跨品种混合查询(A股和期货) curl "https://rest.vvtr.com/v1/snapshot?symbols=600000;rb9999&type=11,14&apiKey=your_api_key" ``` -------------------------------- ### 获取历史K线数据 (REST API) Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 查询指定时间区间的历史K线数据,支持1分钟到月线的多种周期。数据自动分页,支持复权计算。不同粒度的K线数据支持查询的时间范围不同。 ```bash # 获取A股日K线数据 curl "https://rest.vvtr.com/v1/kline/history?symbols=600000,600004&type=11&interval=1d&from=2025-04-01&to=2025-04-03&apiKey=your_api_key" # 获取期货1分钟K线(盘中实时数据) curl "https://rest.vvtr.com/v1/kline/history?symbols=rb9999&type=14&interval=1m&from=2025-04-10%2009:00:00&to=2025-04-10%2015:00:00&apiKey=your_api_key" # 带复权的日K线查询 curl "https://rest.vvtr.com/v1/kline/history?symbols=600000&type=11&interval=1d&from=2025-01-01&to=2025-04-10&adjust=true&apiKey=your_api_key" # 分页查询(使用cursorToken获取下一页) curl "https://rest.vvtr.com/v1/kline/history?symbols=*&type=11&interval=1d&from=2025-04-01&to=2025-04-03&cursorToken=eyJpZCI6MTIzNDU2fQ==&apiKey=your_api_key" ``` -------------------------------- ### 获取最新K线 (REST API) Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 获取symbol当前各周期的最新K线(日K及以下)。建议在每分钟第5秒后请求以获取准确的分钟K线数据。支持批量查询和多周期同时获取。 ```bash # 获取A股最新1分钟K线 curl "https://rest.vvtr.com/v1/kline/current?symbols=600000,600004&type=11&interval=1m&apiKey=your_api_key" # 获取期货最新5分钟K线 curl "https://rest.vvtr.com/v1/kline/current?symbols=rb9999,hc9999&type=14&interval=5m&apiKey=your_api_key" # 获取美股最新日K线 curl "https://rest.vvtr.com/v1/kline/current?symbols=AAPL,TSLA&type=21&interval=1d&apiKey=your_api_key" ``` -------------------------------- ### 实时行情(L1)-http Source: https://www.vvtr.com/v1/apidoc/index Endpoints for retrieving real-time Level 1 market data via HTTP. ```APIDOC ## 行情快照Snapshot ### Description Retrieves a real-time market data snapshot for a symbol. ### Method GET ### Endpoint /api/realtime/snapshot ### Parameters #### Query Parameters - **symbol** (string) - Required - The symbol for which to retrieve data. ### Response #### Success Response (200) - **snapshot** (object) - Real-time market data. #### Response Example ```json { "snapshot": { "timestamp": 1678886400, "last_price": 102.5, "bid_price": 102.4, "ask_price": 102.6, "volume": 100000, "open": 100.0, "high": 105.0, "low": 98.0 } } ``` ``` ```APIDOC ## 最新K线Current ### Description Retrieves the latest K-line data point for a symbol. ### Method GET ### Endpoint /api/realtime/current_kline ### Parameters #### Query Parameters - **symbol** (string) - Required - The symbol for which to retrieve data. - **interval** (string) - Required - The K-line interval (e.g., '1min', '5min', '1day'). ### Response #### Success Response (200) - **kline** (object) - The latest K-line data. #### Response Example ```json { "kline": { "timestamp": 1678886400, "open": 102.0, "high": 103.0, "low": 101.5, "close": 102.5, "volume": 50000 } } ``` ``` -------------------------------- ### 实时行情(L1)-websocket Source: https://www.vvtr.com/v1/apidoc/index Provides real-time Level 1 market data via WebSocket. ```APIDOC ## WebSocket 订阅 ### Description Subscribes to real-time market data updates via WebSocket. ### Method WebSocket ### Endpoint /ws/realtime ### Parameters #### Query Parameters - **symbols** (string) - Required - Comma-separated list of symbols to subscribe to. - **intervals** (string) - Optional - Comma-separated list of K-line intervals to subscribe to. ### Request Example ```json { "action": "subscribe", "symbols": "000001.SZ,600519.SH", "intervals": "1min,5min" } ``` ### Response #### Data Message - **type** (string) - Message type (e.g., 'snapshot', 'kline'). - **data** (object) - Real-time market data. #### Response Example ```json { "type": "snapshot", "data": { "symbol": "000001.SZ", "timestamp": 1678886400, "last_price": 102.5, "bid_price": 102.4, "ask_price": 102.6, "volume": 100000 } } ``` ``` -------------------------------- ### 实时行情(深度) Source: https://www.vvtr.com/v1/apidoc/index Provides real-time deep market data (order book) via WebSocket for A-shares. ```APIDOC ## WebSocket(A股) ### Description Subscribes to real-time deep market data (order book) for A-shares via WebSocket. ### Method WebSocket ### Endpoint /ws/depth/a_shares ### Parameters #### Query Parameters - **symbols** (string) - Required - Comma-separated list of A-share symbols to subscribe to. ### Request Example ```json { "action": "subscribe", "symbols": "000001.SZ,600519.SH" } ``` ### Response #### Data Message - **type** (string) - Message type ('depth'). - **data** (object) - Real-time order book data. #### Response Example ```json { "type": "depth", "data": { "symbol": "000001.SZ", "timestamp": 1678886400, "bids": [ [102.4, 10000], [102.3, 15000] ], "asks": [ [102.6, 12000], [102.7, 18000] ] } } ``` ``` -------------------------------- ### 基础数据接口 Source: https://www.vvtr.com/v1/apidoc/index Provides endpoints for basic financial data, including futures symbol mapping and symbol list retrieval. ```APIDOC ## 期货主力对应真实合约(CN) ### Description Retrieves the actual contract for Chinese futures main contracts. ### Method GET ### Endpoint /api/futures/main_contract ### Parameters #### Query Parameters - **symbol** (string) - Required - The futures symbol. ### Response #### Success Response (200) - **actual_contract** (string) - The actual contract name. #### Response Example ```json { "actual_contract": "RB2310" } ``` ``` ```APIDOC ## 获取symbol列表 ### Description Retrieves a list of available symbols. ### Method GET ### Endpoint /api/symbols ### Parameters #### Query Parameters - **market** (string) - Optional - The market to filter symbols by (e.g., 'CN', 'US'). ### Response #### Success Response (200) - **symbols** (array) - A list of symbol strings. #### Response Example ```json { "symbols": ["RB2310", "BR2310", "000001.SZ"] } ``` ``` -------------------------------- ### Connect to WebSocket with wscat (Shell) Source: https://www.vvtr.com/v1/apidoc/6467006m0 使用wscat工具连接WebSocket服务器进行数据订阅。此示例展示了如何构建包含API Key、类型和品种信息的连接URL。 ```shell # Shell 示例(使用wscat工具) wscat -c "wss://rest.vvtr.com/v1/connect?apiKey=abcdefg&type=11&symbol=*" ``` -------------------------------- ### 获取Symbol列表 (REST API) Source: https://context7.com/context7/vvtr_v1_apidoc/llms.txt 查询指定品种下所有活跃证券代码的基础信息。支持A股、期货、美股、基金等多种资产类别。响应包含证券代码、名称、交易所、上市退市日期等。 ```bash # 获取A股全部symbol列表 curl "https://rest.vvtr.com/v1/symbols?type=11&apiKey=your_api_key" # 获取国内期货列表 curl "https://rest.vvtr.com/v1/symbols?type=14&apiKey=your_api_key" # 获取美股列表 curl "https://rest.vvtr.com/v1/symbols?type=21&apiKey=your_api_key" ``` -------------------------------- ### WebSocket Subscription API Source: https://www.vvtr.com/v1/apidoc/6467006m0 Connect to the WebSocket server to receive real-time market data. Authentication is done via API Key. Ensure to implement a heartbeat mechanism to keep the connection alive. ```APIDOC ## WebSocket Subscription API ### Description Connect to the WebSocket server to receive real-time market data. Authentication is done via API Key. Ensure to implement a heartbeat mechanism to keep the connection alive. ### Method WebSocket ### Endpoint `wss://rest.vvtr.com/v1/connect` ### Parameters #### Query Parameters - **apiKey** (string) - Required - Your API key for authentication. - **type** (string) - Required - Product type code. Multiple product types can be separated by commas. - **symbol** (string) - Required - Symbol for the security. Symbols can be separated by commas. `*` denotes all symbols. For different product types, symbols should be separated by `;` and maintain the order with the `type` parameter. - **exchange** (int) - Optional - Exchange ID. Required when `type` is `31`. - **fields** (string) - Optional - Data types to subscribe to. Required when `type` is `31`. Examples: `quotes,trades`. ### Request Example ``` wss://rest.vvtr.com/v1/connect?apiKey=abcdefg&type=11&symbol=* ``` ### Response #### Success Response (200) Data is streamed in real-time. The structure of the received data is as follows: #### Response Example ```json [ { "s": "WH", "p": 0.0, "h": 0.0, "l": 0.0, "p": 3198.0, "cV": 0, "cA": 0.0, "cP": 0, "tt": 0, "lV": 0, "lA": 0.0, "cA": 1744009200000, "iopv": 0.0, "quotes": [ { "bP": 0.0, "bV": 0, "aP": 0.0, "aV": 0 } ] } ] ``` ### Error Handling - Connection Limit: Each API Key is limited to 1 active connection. - Heartbeat: Send `ping` string every minute to maintain the connection. - Subscription Limit: A single connection can subscribe to a maximum of 100 contracts or all symbols for a product (if authorized). - Data Push: Real-time data is pushed only during trading hours; pre-market auctions are excluded. - Overwriting Subscriptions: Each subscription request overwrites the previous list. ```