### Install Infoway SDK Source: https://docs.infoway.io/sdk-and-tools/python-sdk.md Use pip to install the official Infoway Python package. ```bash pip install infoway-sdk ``` -------------------------------- ### Install Infoway SDK Source: https://docs.infoway.io/sdk-and-tools/nodejs-sdk.md Commands to install the SDK using common package managers. ```bash npm install infoway-sdk # 或 yarn add infoway-sdk # 或 pnpm add infoway-sdk ``` -------------------------------- ### Install Infoway MCP Server Source: https://docs.infoway.io/sdk-and-tools/mcp-server.md Installation commands for the MCP server using uvx or pip. ```bash # 使用 uvx(推荐) uvx infoway-mcp-server # 使用 pip pip install infoway-mcp-server ``` -------------------------------- ### Symbol Basic Info Response Example Source: https://docs.infoway.io/rest-api/basic-info/get-symbol-basic-info.md Example JSON response containing a list of symbol basic information objects. ```json { "ret": 200, "msg": "success", "traceId": "52327ed3-e96a-4e9a-a591-e910a0fcc563", "data": [ { "symbol": "000001.SZ", "market": "CN", "name_cn": "平安银行", "name_en": "PAB", "name_hk": "平安銀行", "exchange": "SZSE", "currency": "CNY", "lot_size": 100, "total_shares": 19405918198, "circulating_shares": 19405762053, "hk_shares": 0, "eps": "2.2935271367158012", "eps_ttm": "2.2504474951615995", "bps": "22.4755662447835698", "dividend_yield": "0.9649999999963929", "stock_derivatives": "", "board": "SZMainConnect" }, { "symbol": "000002.SZ", "market": "CN", "name_cn": "万科A", "name_en": "Vanke", "name_hk": "萬科A", "exchange": "SZSE", "currency": "CNY", "lot_size": 100, "total_shares": 11930709471, "circulating_shares": 9724196533, "hk_shares": 0, "eps": "-4.147148946357911", "eps_ttm": "-4.6403502137102706", "bps": "16.4892858366243256", "dividend_yield": "0", "stock_derivatives": "", "board": "SZMainConnect" } ] } ``` -------------------------------- ### Query documentation via HTTP GET Source: https://docs.infoway.io/llms.txt Perform an HTTP GET request to the documentation index with 'ask' and 'goal' parameters to receive a direct answer and relevant excerpts. ```http GET https://docs.infoway.io/getting-started/api-limitation.md?ask=&goal= ``` -------------------------------- ### Field Example Values Source: https://docs.infoway.io/rest-api/basic-info/get-market-trading-hours.md Individual example values for specific fields within the trade schedule data. ```text 04:00:00 ``` ```text 09:30:00 ``` ```text PreTrade:盘前 ``` -------------------------------- ### GET /common/v2/basic/market/temperature Source: https://docs.infoway.io/rest-api/basic-info/get-market-overview.md 获取市场估值温度和情绪温度(0-100),可用于判断市场冷热。 ```APIDOC ## GET /common/v2/basic/market/temperature ### Description 获取市场估值温度和情绪温度(0-100),可用于判断市场冷热。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/market/temperature ### Parameters #### Query Parameters - **market** (String) - Optional - 市场代码,逗号分隔,默认HK,US,CN ### Response #### Success Response (200) - **markets** (Array) - 市场代码列表 - **data** (Object) - 市场温度数据对象 #### Response Example { "markets": ["HK", "US"], "data": { "list": [ { "market": "HK", "temp": "69", "temp_intro": "温度适宜并逐渐上升中", "valuation": "80", "sentiment": "58" } ] } } ``` -------------------------------- ### Product List Response Example Source: https://docs.infoway.io/rest-api/basic-info/get-symbol-list.md The JSON response structure returned by the /common/basic/symbols endpoint. ```json { "ret": 200, "msg": "success", "traceId": "ed8a84d9-4575-4077-bc1c-31b17d0c8977", "data": [ { "symbol": ".DJI.US", "name_cn": "道琼斯指数", "name_hk": "道瓊斯指數", "name_en": "Dow Jones Industrial Average", "index": true }, { "symbol": ".IXIC.US", "name_cn": "纳斯达克综合指数", "name_hk": "納斯達克綜合指數", "name_en": "NASDAQ Composite Index", "index": true } ] } ``` -------------------------------- ### GET /common/basic/markets Source: https://docs.infoway.io/rest-api/basic-info/get-market-trading-hours.md 获取不同市场的基本交易时间。 ```APIDOC ## GET /common/basic/markets ### Description 该接口用于获取不同市场的基本交易时间。 ### Method GET ### Endpoint https://data.infoway.io/common/basic/markets ### Parameters #### Request Headers - **apiKey** (String) - Required - 您套餐中的API Key ### Response #### Success Response (200) - **ret** (Number) - 状态码 - **msg** (String) - 响应消息 - **traceId** (String) - 追踪ID - **data** (Array) - 市场交易时间列表 - **market** (String) - 市场代码 - **remark** (String) - 市场备注 - **trade_schedules** (Array) - 交易时间集合 - **begin_time** (String) - 开始时间 - **end_time** (String) - 结束时间 - **type** (String) - 时间类型 (PreTrade:盘前, NormalTrade:正常交易, PostTrade:盘后) #### Response Example { "ret": 200, "msg": "success", "traceId": "7b32f9db-852b-4234-aafb-5766f9ba385e", "data": [ { "market": "CN", "remark": "A 股市场", "trade_schedules": [ { "begin_time": "09:30:00", "end_time": "11:30:00", "type": "NormalTrade" } ] } ] } ``` -------------------------------- ### Install SDK via Build Tools Source: https://docs.infoway.io/sdk-and-tools/java-sdk.md Add the Infoway SDK dependency to your project using Maven or Gradle. ```xml io.infoway infoway-sdk 0.1.0 ``` ```groovy implementation 'io.infoway:infoway-sdk:0.1.0' ``` -------------------------------- ### GET /common/v2/basic/stock/panorama/{symbol} Source: https://docs.infoway.io/rest-api/basic-info/get-stock-fundamental.md 获取个股所属行业及行业内排名、所属概念板块列表。 ```APIDOC ## GET /common/v2/basic/stock/panorama/{symbol} ### Description 获取个股所属行业及行业内排名、所属概念板块列表。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/stock/panorama/{symbol} ### Parameters #### Path Parameters - **symbol** (String) - Required - 标的代码 ### Response #### Success Response (200) - **symbol** (String) - 标的代码 - **data** (Object) - 全景数据 #### Response Example { "symbol": "700.HK", "data": { "belonged_industry": { "counter_id": "BK/HK/IN20232", "name": "互联网内容与信息", "rank": 1, "stock_num": 24 }, "concepts": { "list": [ {"counter_id": "BK/HK/CP20064", "name": "北水核心资产", "stock_num": 56} ] } } } ``` -------------------------------- ### GET /common/v2/basic/market/breadth/{market} Source: https://docs.infoway.io/rest-api/basic-info/get-market-overview.md 获取市场涨跌家数分布统计。 ```APIDOC ## GET /common/v2/basic/market/breadth/{market} ### Description 获取市场涨跌家数分布统计。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/market/breadth/{market} ### Parameters #### Path Parameters - **market** (String) - Required - 市场代码 ### Response #### Success Response (200) - **market** (String) - 市场代码 - **data** (Object) - 涨跌家数分布统计数据 #### Response Example { "market": "HK", "data": { "flatline": 928, "rise_less_than_three": 816, "rise_three_to_five": 200, "rise_five_to_seven": 110, "rise_more_than_seven": 128, "fall_less_than_three": 686, "fall_three_to_five": 154, "fall_five_to_seven": 69, "fall_more_than_seven": 88 } } ``` -------------------------------- ### GET /common/basic/symbols Source: https://docs.infoway.io/rest-api/basic-info/get-symbol-list.md Retrieves a list of products for a specified market type. ```APIDOC ## GET /common/basic/symbols ### Description Retrieves a list of products for a specified market type to confirm availability of required data. ### Method GET ### Endpoint /common/basic/symbols ### Request Headers - **apiKey** (String) - Required - Your API Key from your subscription plan. ### Parameters #### Query Parameters - **type** (String) - Required - The target type (e.g., STOCK_US, STOCK_CN, STOCK_HK, FUTURES, FOREX, ENERGY, METAL, CRYPTO, STOCK_IN, STOCK_JP, STOCK_KS, INDICES). - **symbols** (String) - Optional - A comma-separated list of symbols. ### Response #### Success Response (200) - **ret** (Integer) - Status code. - **msg** (String) - Success message. - **traceId** (String) - Unique trace identifier. - **data** (Array) - List of product objects. #### Response Example { "ret": 200, "msg": "success", "traceId": "ed8a84d9-4575-4077-bc1c-31b17d0c8977", "data": [ { "symbol": ".DJI.US", "name_cn": "道琼斯指数", "name_hk": "道瓊斯指數", "name_en": "Dow Jones Industrial Average", "index": true } ] } ``` -------------------------------- ### GET /common/v2/basic/market/leaders/{market} Source: https://docs.infoway.io/rest-api/basic-info/get-market-overview.md 获取当日领涨行业及龙头股。 ```APIDOC ## GET /common/v2/basic/market/leaders/{market} ### Description 获取当日领涨行业及龙头股。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/market/leaders/{market} ### Parameters #### Path Parameters - **market** (String) - Required - 市场代码 #### Query Parameters - **limit** (Integer) - Optional - 返回行业数,1-50,默认10 ### Response #### Success Response (200) - **market** (String) - 市场代码 - **data** (Object) - 领涨行业列表 #### Response Example { "market": "HK", "data": { "lists": [ { "counter_id": "BK/HK/IN20351", "name": "保险经纪公司", "chg": "0.1535", "leading_name": "众淼控股", "leading_last_done": "40.400", "leading_chg": "0.1717", "rise_num": 2, "fall_num": 0 } ] } } ``` -------------------------------- ### GET /common/v2/basic/plate/concept/{market} Source: https://docs.infoway.io/rest-api/basic-info/get-plate-data.md 获取指定市场的概念/热门板块(暂不支持A股)。 ```APIDOC ## GET /common/v2/basic/plate/concept/{market} ### Description 获取指定市场的概念/热门板块(暂不支持A股)。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/plate/concept/{market} ### Parameters #### Path Parameters - **market** (String) - Required - 市场代码 #### Query Parameters - **limit** (Integer) - Optional - 返回数量,1-100,默认100 ### Response #### Success Response (200) - **market** (String) - 市场代码 - **count** (Integer) - 板块数量 - **data** (Array) - 概念板块列表 #### Response Example { "market": "HK", "count": 3, "data": [ { "symbol": "CP20027.HK", "counter_id": "BK/HK/CP20027", "name": "生物医药 B 类股", "chg": "0.0736", "intro": "符合港交所B类股上市规则的生物科技企业" } ] } ``` -------------------------------- ### GET /common/basic/symbols/info Source: https://docs.infoway.io/rest-api/basic-info/get-symbol-basic-info.md Retrieves basic information for a list of symbols based on the specified product type. ```APIDOC ## GET /common/basic/symbols/info ### Description This endpoint retrieves basic information for different products, including name, exchange, currency, and share count. ### Method GET ### Endpoint https://data.infoway.io/common/basic/symbols/info ### Request Headers - **apiKey** (String) - Required - Your API Key from your subscription plan. ### Parameters #### Query Parameters - **type** (String) - Required - The type of target asset (e.g., STOCK_US, STOCK_CN, STOCK_HK, FUTURES, FOREX, ENERGY, METAL, CRYPTO, STOCK_IN, STOCK_JP, STOCK_KS, INDEX). - **symbols** (String) - Required - A comma-separated list of symbols, supporting up to 500 symbols. ``` -------------------------------- ### Quick Start with InfowayClient Source: https://docs.infoway.io/sdk-and-tools/nodejs-sdk.md Initialize the client and fetch various market data points including trades, depth, and K-lines. ```typescript import { InfowayClient, KlineType } from "infoway-sdk"; const client = new InfowayClient({ apiKey: "YOUR_API_KEY" }); // 股票实时行情 const trades = await client.stock.getTrade("AAPL.US"); // 多个标的同时查询 const multiTrades = await client.stock.getTrade("AAPL.US,TSLA.US,GOOGL.US"); // 买卖盘口 const depth = await client.stock.getDepth("AAPL.US"); // K线数据 const klines = await client.stock.getKline("AAPL.US", KlineType.DAY, 100); // 加密货币 const btc = await client.crypto.getTrade("BTCUSDT"); // 市场温度 const temp = await client.market.getTemperature("HK,US"); // 个股基本面 const valuation = await client.stockInfo.getValuation("AAPL.US"); // 板块数据 const industries = await client.plate.getIndustry("HK"); ``` -------------------------------- ### Initialize and Use InfowayClient Source: https://docs.infoway.io/sdk-and-tools/java-sdk.md Create a client instance using the builder pattern and perform basic market data queries. ```java import io.infoway.sdk.InfowayClient; import io.infoway.sdk.KlineType; import com.google.gson.JsonElement; // 创建客户端 InfowayClient client = InfowayClient.builder() .apiKey("YOUR_API_KEY") .build(); // 实时行情 JsonElement trades = client.stock().getTrade("AAPL.US"); // 加密货币K线 JsonElement klines = client.crypto().getKline("BTCUSDT", KlineType.DAY, 100); // 市场温度 JsonElement temp = client.market().getTemperature("HK,US"); // 行业板块 JsonElement industry = client.plate().getIndustry("HK", 10); // 公司概览 JsonElement company = client.stockInfo().getCompany("AAPL.US"); // 关闭客户端 client.close(); ``` -------------------------------- ### Initialize and Use Infoway Client Source: https://docs.infoway.io/sdk-and-tools/python-sdk.md Basic usage example for fetching real-time trades, crypto klines, market temperature, and industry rankings. ```python from infoway import InfowayClient, KlineType client = InfowayClient(api_key="YOUR_API_KEY") # 实时行情 trades = client.stock.get_trade("AAPL.US") # 加密货币日K线 klines = client.crypto.get_kline("BTCUSDT", kline_type=KlineType.DAY, count=30) # 市场温度 temp = client.market.get_temperature(market="HK,US") # 行业板块排名 plates = client.plate.get_industry("HK", limit=10) ``` -------------------------------- ### Get Earnings Financial Data Request Source: https://docs.infoway.io/rest-api/basic-info/get-stock-financial-data.md Perform a GET request to retrieve earnings data for a specific stock symbol. ```http GET https://data.infoway.io/common/basic/financial/earnings?symbol=AAPL.US&type=STOCK_US&period_type=fq ``` -------------------------------- ### Customize Client Options Source: https://docs.infoway.io/sdk-and-tools/python-sdk.md Configure connection parameters such as base URL, timeout, and retry logic during client initialization. ```python client = InfowayClient( api_key="YOUR_API_KEY", base_url="https://data.infoway.io", # 默认值 timeout=15.0, # 请求超时(秒) max_retries=3, # 失败重试次数 ) ``` -------------------------------- ### GET /rest-api/http-endpoints/get-depth.md Source: https://docs.infoway.io/rest-api/http-endpoints.md 获取股票、加密货币、外汇、能源、商品等所有产品的实时买卖盘口。 ```APIDOC ## GET /rest-api/http-endpoints/get-depth.md ### Description 获取股票、加密货币、外汇、能源、商品等所有产品的实时买卖盘口。 ``` -------------------------------- ### InfowayClient Initialization Source: https://docs.infoway.io/sdk-and-tools/python-sdk.md Initializes the Infoway client with an API key and optional configuration settings. ```APIDOC ## InfowayClient(api_key, base_url, timeout, max_retries) ### Description Initializes the client to interact with Infoway services. You can provide an API key directly or rely on the `INFOWAY_API_KEY` environment variable. ### Parameters - **api_key** (string) - Optional - API key for authentication. - **base_url** (string) - Optional - Base URL for the API (default: https://data.infoway.io). - **timeout** (float) - Optional - Request timeout in seconds (default: 15.0). - **max_retries** (int) - Optional - Number of retries for failed requests (default: 3). ``` -------------------------------- ### GET /rest-api/http-endpoints/get-trade.md Source: https://docs.infoway.io/rest-api/http-endpoints.md 获取股票、加密货币、外汇、能源、商品等所有产品的实时成交明细。 ```APIDOC ## GET /rest-api/http-endpoints/get-trade.md ### Description 获取股票、加密货币、外汇、能源、商品等所有产品的实时成交明细。 ``` -------------------------------- ### GET /common/v2/basic/market/indexes Source: https://docs.infoway.io/rest-api/basic-info/get-market-overview.md 获取全球主要指数列表。 ```APIDOC ## GET /common/v2/basic/market/indexes ### Description 获取全球主要指数列表。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/market/indexes ### Response #### Success Response (200) - **data** (Object) - 指数列表数据 #### Response Example { "data": { "indexes": [ {"counter_id": "IX/US/.DJI", "name": "道琼斯", "market": "US"} ] } } ``` -------------------------------- ### 启动 Jupyter Notebook 交互教程 Source: https://docs.infoway.io/sdk-and-tools/quant-starter.md 启动交互式 Notebook 以学习 SDK 基础操作与数据分析。 ```bash jupyter notebook notebooks/getting_started.ipynb ``` -------------------------------- ### Configure API Key Source: https://docs.infoway.io/sdk-and-tools/nodejs-sdk.md Set the API key via environment variables or direct client initialization. ```bash export INFOWAY_API_KEY="YOUR_API_KEY" ``` ```typescript // 自动读取环境变量 INFOWAY_API_KEY const client = new InfowayClient(); ``` -------------------------------- ### GET /common/basic/symbols/adjustment_factors Source: https://docs.infoway.io/rest-api/basic-info/get-adjustment-factor.md 获取产品的复权因子数据。 ```APIDOC ## GET /common/basic/symbols/adjustment_factors ### Description 获取指定产品的复权因子数据。 ### Method GET ### Endpoint https://data.infoway.io/common/basic/symbols/adjustment_factors ### Parameters #### Request Headers - **apiKey** (String) - Required - 您套餐中的API Key #### Query Parameters - **symbol** (String) - Required - 标的代码 - **market** (String) - Required - 市场: US, CN, JP, IN, HK, KS - **beginDay** (String) - Required - 开始时间,格式YYYYMMDD - **endDay** (String) - Required - 结束时间,格式YYYYMMDD ### Response #### Success Response (200) - **symbol** (String) - 标的代码 - **market** (String) - 市场 - **trade_date** (String) - 交易日期,格式YYYYMMDD - **forward_factor** (BigDecimal) - 前复权因子 #### Response Example { "ret": 200, "msg": "success", "traceId": "a50ecfd7-decf-4c80-8ee0-798ede935794", "data": [ { "symbol": "000001.SZ", "market": "CN", "trade_date": "19910102", "forward_factor": 0.6399030867 }, { "symbol": "000001.SZ", "market": "CN", "trade_date": "19910103", "forward_factor": 0.6399029351 } ] } ``` -------------------------------- ### 运行板块数据服务 (Python) Source: https://docs.infoway.io/sdk-and-tools/exchange-toolkit.md 启动带内存缓存和自动刷新的板块数据查询服务。 ```bash python examples/plate_data_service/service.py ``` -------------------------------- ### 查询资产负债表数据 Source: https://docs.infoway.io/rest-api/basic-info/get-stock-financial-data.md 通过 GET 请求获取指定标的的资产负债表信息,支持按季度或年度筛选。 ```http GET https://data.infoway.io/common/basic/financial/balance_sheet?symbol=000001.SZ&type=STOCK_CN&period_type=fy ``` -------------------------------- ### 查询现金流量表数据 Source: https://docs.infoway.io/rest-api/basic-info/get-stock-financial-data.md 通过 GET 请求获取指定标的的现金流量表信息,支持按季度或年度筛选。 ```http GET https://data.infoway.io/common/basic/financial/cash_flow?symbol=000001.SZ&type=STOCK_CN&period_type=fq ``` -------------------------------- ### 运行 K线数据仓库 (Python) Source: https://docs.infoway.io/sdk-and-tools/exchange-toolkit.md 启动基于 SQLite 的本地 K 线数据仓库,支持增量同步。 ```bash python examples/kline_data_warehouse/warehouse.py ``` -------------------------------- ### 查询收入明细数据请求示例 Source: https://docs.infoway.io/rest-api/basic-info/get-stock-financial-data.md 通过 GET 请求获取指定股票的收入拆分明细。 ```http GET https://data.infoway.io/common/basic/financial/revenue?symbol=AAPL.US&type=STOCK_US ``` -------------------------------- ### 订阅请求发送逻辑 Source: https://docs.infoway.io/websocket-api/code-examples.md 按顺序发送成交明细、盘口和K线订阅请求,并在请求间加入延时。 ```go func (c *CryptoWebsocketClient) sendAllSubscribeRequests(ctx context.Context) { if !c.isConnected || c.conn == nil { log.Println("连接未建立,无法发送订阅请求") return } if err := c.sendTradeSubscribe(); err != nil { log.Printf("发送成交明细订阅失败: %v", err) return } if !wait(ctx, 5*time.Second) { return } if err := c.sendDepthSubscribe(); err != nil { log.Printf("发送盘口订阅失败: %v", err) return } if !wait(ctx, 5*time.Second) { return } if err := c.sendKlineSubscribe(); err != nil { log.Printf("发送K线订阅失败: %v", err) } } ``` -------------------------------- ### 查询损益表数据请求示例 Source: https://docs.infoway.io/rest-api/basic-info/get-stock-financial-data.md 通过 GET 请求获取指定股票的损益表数据。 ```http GET https://data.infoway.io/common/basic/financial/income_statement?symbol=000001.SZ&type=STOCK_CN&period_type=fq ``` -------------------------------- ### 辅助等待函数 Source: https://docs.infoway.io/websocket-api/code-examples.md 用于在订阅请求之间进行带上下文取消支持的延时等待。 ```go func wait(ctx context.Context, d time.Duration) bool { timer := time.NewTimer(d) defer timer.Stop() select { case <-ctx.Done(): return false case <-timer.C: return true } } ``` -------------------------------- ### 获取财报发布状态请求示例 Source: https://docs.infoway.io/rest-api/basic-info/get-stock-financial-data.md 通过 GET 请求查询指定股票的最新财报发布状态及预期数据。 ```http GET https://data.infoway.io/common/basic/financial/earning_status?symbol=AAPL.US&type=STOCK_US ``` -------------------------------- ### 启动 Web UI Source: https://docs.infoway.io/sdk-and-tools/ai-advisor.md 运行 Streamlit 应用程序以启动可视化交互界面。 ```bash streamlit run web/app.py ``` -------------------------------- ### 运行行情数据服务 (Java) Source: https://docs.infoway.io/sdk-and-tools/exchange-toolkit.md 编译并运行基于 Infoway Java SDK 的 REST 行情数据查询服务。 ```bash cd java-examples mvn compile exec:java -Dexec.mainClass="MarketDataService" ``` -------------------------------- ### GET /common/v2/basic/stock/company/{symbol} Source: https://docs.infoway.io/rest-api/basic-info/get-stock-fundamental.md 获取公司简介、高管信息、行业分类等基础信息。 ```APIDOC ## GET /common/v2/basic/stock/company/{symbol} ### Description 获取公司简介、高管信息、行业分类等基础信息。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/stock/company/{symbol} ### Parameters #### Path Parameters - **symbol** (String) - Required - 标的代码 ### Response #### Success Response (200) - **symbol** (String) - 标的代码 - **data** (Object) - 公司基础信息 #### Response Example { "symbol": "700.HK", "data": { "company_name": "腾讯控股", "industry": "互联网内容与信息", "description": "腾讯控股有限公司是一家主要从事增值服务及网络广告业务的投资控股公司..." } } ``` -------------------------------- ### GET /common/v2/basic/stock/ratings/{symbol} Source: https://docs.infoway.io/rest-api/basic-info/get-stock-fundamental.md 获取机构买入/增持/持有/减持/卖出评级家数统计趋势。 ```APIDOC ## GET /common/v2/basic/stock/ratings/{symbol} ### Description 获取机构买入/增持/持有/减持/卖出评级家数统计趋势。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/stock/ratings/{symbol} ### Parameters #### Path Parameters - **symbol** (String) - Required - 标的代码,例如 700.HK ### Response #### Success Response (200) - **symbol** (String) - 标的代码 - **data** (Object) - 评级数据 - **elist** (Array) - 评级数据列表 #### Response Example { "symbol": "700.HK", "data": { "elist": [ { "buy": "33", "over": "11", "hold": "3", "under": "0", "sell": "0", "total": "49", "date": "1517328000" } ] } } ``` -------------------------------- ### 运行 CLI 示例 Source: https://docs.infoway.io/sdk-and-tools/ai-advisor.md 通过命令行执行预设的分析脚本。 ```bash python examples/daily_briefing.py ``` ```bash python examples/stock_diagnosis.py AAPL.US ``` ```bash python examples/sector_rotation.py HK ``` -------------------------------- ### GET /common/v2/basic/stock/valuation/{symbol} Source: https://docs.infoway.io/rest-api/basic-info/get-stock-fundamental.md 获取标的PE/PB历史数据,可用于画估值走势图。 ```APIDOC ## GET /common/v2/basic/stock/valuation/{symbol} ### Description 获取标的PE/PB历史数据,可用于画估值走势图。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/stock/valuation/{symbol} ### Parameters #### Path Parameters - **symbol** (String) - Required - 标的代码,例如 AAPL.US ### Response #### Success Response (200) - **symbol** (String) - 标的代码 - **data** (Object) - 估值数据 - **kline_type** (String) - K线类型 - **pe_list** (Array) - PE历史数据列表 - **pb_list** (Array) - PB历史数据列表 #### Response Example { "symbol": "AAPL.US", "data": { "kline_type": "day", "pe_list": [ {"timestamp": "1743177600", "pe": "34.04", "eps": "", "last_done": ""} ], "pb_list": [ {"timestamp": "1743177600", "pb": "51.20", "bps": "", "last_done": ""} ] } } ``` -------------------------------- ### Configure API Key via Environment Variable Source: https://docs.infoway.io/sdk-and-tools/python-sdk.md Set the API key as an environment variable to allow the client to initialize without explicit arguments. ```bash export INFOWAY_API_KEY="YOUR_API_KEY" ``` ```python # 自动读取环境变量 INFOWAY_API_KEY client = InfowayClient() ``` -------------------------------- ### GET /common/v2/basic/plate/members/{plate_symbol} Source: https://docs.infoway.io/rest-api/basic-info/get-plate-data.md 获取指定行业或概念板块下的所有成分股,支持分页。 ```APIDOC ## GET /common/v2/basic/plate/members/{plate_symbol} ### Description 获取指定行业或概念板块下的所有成分股,支持分页。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/plate/members/{plate_symbol} ### Parameters #### Path Parameters - **plate_symbol** (String) - Required - 板块代码 #### Query Parameters - **offset** (Integer) - Optional - 分页偏移,默认0 - **limit** (Integer) - Optional - 每页数量,1-50,默认50 ### Response #### Success Response (200) - **plate** (String) - 板块代码 - **data** (Object) - 成分股数据对象 #### Response Example { "plate": "IN20293.HK", "counter_id": "BK/HK/IN20293", "data": { "total": 18, "offset": 0, "limit": 50, "members": [ {"symbol": "1988.HK", "name": "民生银行", "last_done": "3.870", "chg": "0.0104"} ] } } ``` -------------------------------- ### Analyze Market Overview Source: https://docs.infoway.io/sdk-and-tools/java-sdk.md Access market temperature, breadth statistics, and global index data. ```java client.market().getTemperature("HK,US"); // 市场温度 client.market().getBreadth("US"); // 涨跌统计 client.market().getIndexes(); // 全球指数 client.market().getLeaders("US", 10); // 领涨行业 client.market().getRankConfig("US"); // 排行榜配置 ``` -------------------------------- ### Market Depth Response Example Source: https://docs.infoway.io/rest-api/http-endpoints/get-depth.md A sample JSON response showing the structure of the market depth data, including ask (a) and bid (b) arrays. ```json { "ret": 200, "msg": "success", "traceId": "81688452-dd7c-4de7-b423-b5e39d18e298", "data": [ { "s": "01810.HK", "t": 1769760489943, "a": [ [ "35.520", "35.540", "35.560", "35.580", "35.600", "35.620", "35.640", "35.660", "35.680", "35.700" ], [ "3031600", "134600", "475600", "754400", "1225600", "946800", "1173800", "689000", "805200", "2437200" ] ], "b": [ [ "35.500", "35.480", "35.460", "35.440", "35.420", "35.400", "35.380", "35.360", "35.340", "35.320" ], [ "433800", "858400", "784400", "1018200", "1118600", "1969200", "1167200", "883200", "1298400", "420800" ] ] } ] } ``` -------------------------------- ### GET /common/v2/basic/plate/industry/{market} Source: https://docs.infoway.io/rest-api/basic-info/get-plate-data.md 获取指定市场的所有行业板块。 ```APIDOC ## GET /common/v2/basic/plate/industry/{market} ### Description 获取指定市场的所有行业板块。 ### Method GET ### Endpoint https://data.infoway.io/common/v2/basic/plate/industry/{market} ### Parameters #### Path Parameters - **market** (String) - Required - 市场代码 (HK, US, CN) #### Query Parameters - **limit** (Integer) - Optional - 返回数量,1-300,默认200 ### Response #### Success Response (200) - **market** (String) - 市场代码 - **count** (Integer) - 板块数量 - **data** (Array) - 板块列表 #### Response Example { "market": "HK", "count": 5, "data": [ { "symbol": "IN20335.HK", "counter_id": "BK/HK/IN20335", "name": "安防与报警服务", "type": "industry", "chg": "0.0615", "last_done": "490.292", "change": "28.417", "rise": "1", "fall": "0", "total_amount": "3740100", "market_cap": "715513802" } ] } ``` -------------------------------- ### 运行加密货币套利扫描示例 Source: https://docs.infoway.io/sdk-and-tools/quant-starter.md 执行跨品种价差扫描脚本以检测套利机会。 ```bash python examples/04_crypto_arbitrage.py ``` -------------------------------- ### 运行 WebSocket 网关 (Java) Source: https://docs.infoway.io/sdk-and-tools/exchange-toolkit.md 编译并运行 Java 版多市场 WebSocket 网关。 ```bash cd java-examples mvn compile exec:java -Dexec.mainClass="WebSocketGateway" ``` -------------------------------- ### Configure MCP Server for AI Clients Source: https://docs.infoway.io/sdk-and-tools/mcp-server.md Configuration snippets for Claude Desktop, Cursor, and Claude Code to enable the Infoway MCP server. ```json { "mcpServers": { "infoway": { "command": "uvx", "args": ["infoway-mcp-server"], "env": { "INFOWAY_API_KEY": "你的API密钥" } } } } ``` -------------------------------- ### 重连与启动逻辑 Source: https://docs.infoway.io/websocket-api/code-examples.md 实现自动重连循环及客户端的启动与优雅关闭。 ```go func (c *CryptoWebsocketClient) startReconnectLoop() { for { select { case <-c.done: return default: if !c.isConnected { log.Printf("尝试重连WebSocket(间隔%v)...", c.reconnectInterval) time.Sleep(time.Duration(rand.Intn(3)) * time.Second) if err := c.connect(); err != nil { log.Printf("重连失败: %v", err) time.Sleep(c.reconnectInterval) continue } } time.Sleep(1 * time.Second) } } } func (c *CryptoWebsocketClient) Start() { go c.startReconnectLoop() if err := c.connect(); err != nil { log.Printf("首次连接失败: %v", err) } sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) <-sigChan log.Println("收到退出信号,关闭客户端...") close(c.done) c.stopConnectionTasks() if c.conn != nil { c.conn.Close() } c.isConnected = false } func main() { apiKey := "yourApikey" business := "crypto" ``` -------------------------------- ### Connect to WebSocket Real-time Streams Source: https://docs.infoway.io/sdk-and-tools/java-sdk.md Use InfowayWebSocket to subscribe to live trade, depth, and K-line updates. ```java import io.infoway.sdk.InfowayWebSocket; InfowayWebSocket ws = InfowayWebSocket.builder() .apiKey("YOUR_API_KEY") .business("stock") .onTrade(msg -> System.out.println("成交: " + msg)) .onDepth(msg -> System.out.println("盘口: " + msg)) .onKline(msg -> System.out.println("K线: " + msg)) .onError(err -> System.err.println("错误: " + err.getMessage())) .onReconnect(() -> System.out.println("已重连")) .build(); ws.connect(); ws.subscribeTrade("AAPL.US,TSLA.US"); ws.subscribeDepth("AAPL.US"); // 取消订阅 ws.unsubscribeTrade("TSLA.US"); // 关闭连接 ws.close(); ``` -------------------------------- ### 使用Go发起HTTP GET请求 Source: https://docs.infoway.io/rest-api/http-code-example.md 使用net/http标准库发送请求,需手动设置请求头并读取响应体。 ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { apiUrl := "https://data.infoway.io/stock/batch_kline/1/10/002594.SZ%2C00285.HK%2CTSLA.US" // 创建HTTP客户端 client := &http.Client{} // 创建GET请求 req, err := http.NewRequest("GET", apiUrl, nil) if err != nil { fmt.Println("Error creating request:", err) return } // 设置请求头 req.Header.Set("User-Agent", "Mozilla/5.0") req.Header.Set("Accept", "application/json") req.Header.Set("apiKey", "yourApikey") // 发送请求 resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() // 读取响应内容 body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response:", err) return } // 输出结果 fmt.Printf("HTTP code:", resp.StatusCode) fmt.Printf("message:", string(body)) } ``` -------------------------------- ### Get Dividend Metrics Source: https://docs.infoway.io/rest-api/basic-info/get-stock-financial-data.md Retrieves dividend yield, payout ratios, and other dividend-related metrics. ```http GET https://data.infoway.io/common/basic/financial/dividend?symbol=00700.HK&type=STOCK_HK ``` ```json { "ret": 200, "msg": "success", "traceId": "xxx", "data": [ { "symbol": "00700.HK", "periodType": "fy", "periodDate": "2025-12-31", "itemId": "dividend_yield", "itemName": "Dividend_yield", "itemGroup": "Dividend", "itemValue": 1.25, "ttmStr": "1.30", "currentValue": 1.28 } ] } ```