Expand description
§financial-api-rs
面向同花顺官方金融数据服务的异步 Rust 客户端,提供已上线 REST API 的类型化访问。
§安装
cargo add financial-api使用前设置 API Key:
export HITHINK_FINANCE_API_KEY='<your-api-key>'§快速开始
use financial_api::{Client, Error};
#[tokio::main]
async fn main() -> Result<(), Error> {
let client = Client::from_env()?;
let response = client
.index_constituents_ths_stock_list("000300.SH")
.await?;
println!("{:#?}", response.data());
Ok(())
}§支持范围
当前覆盖 59 个已上线端点,包括:
- 标的检索与列表
- A 股行情、财务、估值、竞价及特色数据
- 同花顺指数目录、成分股与行情
- 基金资料、持仓、业绩、经理、公司、资讯及行情
- 全市场日 K 与复权因子导出
上游标记为“敬请期待”的能力不在当前支持范围内。完整用法可查看
API 文档和仓库中的
examples/。
§项目说明
- 使用本项目需要同花顺金融数据服务的有效账号、API Key 和对应权限。
- 数据内容、更新频率与服务可用性由上游提供方决定。
- 本项目及其示例不构成投资建议。
- 源码与问题跟踪位于 Choi-Jungwoo/financial-api-rs。
§许可证
本项目使用 MIT License。该许可证不授予同花顺服务、数据、商标或其他上游 资产的权利。
Structs§
- AShare
Code - 限定在 A 股标的宇宙内的完整标的代码。
- Adjustment
Factor Item - Adjustment
Factors Data - 指定 A 股标的的复权事件。
- Anomaly
Item - ApiKey
- 以敏感 HTTP 请求头值保存的已校验 API Key。
- Auction
Benchmark Data - Auction
Benchmark Item - Auction
Snapshot Data - Auction
Snapshot Item - Balance
Sheet Item - Business
Error - 从响应信封中解码出的非零业务结果。
- Cash
Flow Statement Item - Client
- 可复用的异步 API 客户端。
- Client
Builder - 用于配置客户端级可选传输参数的构建器。
- Compact
Date - 在线路协议中编码为
YYYYMMDD的已校验公历自然日。 - Company
Id - 从基金资料数据中发现的不透明基金公司标识。
- Concept
Item - Cursor
- 游标分页端点返回的不透明分页游标。
- Dragon
Tiger Data - Dragon
Tiger Stock Item - Endpoint
Info - 一个已支持 REST 能力的稳定名称和路径。
- Financial
Ability - Financial
Indicator - Financial
Indicators Data - Financial
Range - “最近报告期”和“时间戳区间”互斥的财务查询。
- Financial
Report YYYY-[1-4]格式的财务报告期标识。- Financial
Statement Meta - 上市公司三类财务报表共用的字段。
- Fund
Asset Allocation Item - Fund
Balance Sheet Item - Fund
Category Code - 在诊断数据中观察到的不透明基金分类代码。
- Fund
Company Item - Fund
Diagnostics Item - Fund
Dividend Item - Fund
Dividends Data - Fund
Drawdowns Item - Fund
Financial Indicators Item - Fund
Holder Item - Fund
Holding Item - Fund
Holdings Data - Fund
Income Statement Item - Fund
Indicator History Item - Fund
Industry Allocation Item - Fund
Manager Detail Item - Fund
Manager Experience Item - Fund
Manager Performance Item - Fund
Manager Radar Comparison - 按类别和区间对齐的一项基金经理同类比较雷达节点。
- Fund
Manager Ref - Fund
Manager Style Item - Fund
Market Historical Data - Fund
Market Snapshot Data - Fund
Market Snapshot Item - Fund
NavItem - Fund
News Data - Fund
News Item - Fund
Offering Item - Fund
Portfolio History Item - Fund
Profile Item - Fund
Rate Info - Fund
Report Date Item - Fund
Returns Item - Fund
TopHolder Item - Fund
TopHolders Data - Fund
Trade Rule - Historical
Data - 历史日 K 线载荷。
- HotMoney
Item - HotStock
History Data - HotStock
History Item - HotStock
Item - HotStock
Trend Item - Income
Statement Item - Index
Catalog Item - Index
Constituent Item - Index
Historical Data - 指数历史行情包含固定为
null的复权字段。 - Ladder
Board Caps - Ladder
Boards - Ladder
Data - Ladder
Day - Ladder
Stock - Ladder
Window - Limit
Break Item - Limit
Down Item - Limit
UpItem - Manager
Id - 从基金资料数据中发现的不透明基金经理标识。
- Market
Dump Url - 短期有效的市场数据包下载授权。
- Natural
Date - 序列化为
YYYY-MM-DD的已校验公历自然日。 - Optional
Input - 可省略端点参数的转换目标。
- Page
- 特色数据池使用的已校验分页参数。
- Pagination
- Pool
Data - Precise
Decimal - 保留源数字且不转换为二进制浮点数的 JSON 十进制数。
- Price
BarItem - 一条日开高低收量 K 线。
- Price
Snapshot Data - A 股或指数的行情快照载荷。
- Price
Snapshot Item - 一条最新行情记录。
- Price
Snapshot Selection - 显式指定的标的,或完整 A 股标的宇宙中的一页。
- Report
Type - 从报告期端点中发现的基金披露报告类型。
- Response
- 通过通用业务信封校验后的成功响应。
- Secret
Url - 调试表示始终脱敏的短期预签名 URL。
- Shanghai
Date Millis - 以
Asia/Shanghai时区午夜 Unix 毫秒值表示的自然日。 - Thscode
- 包含市场后缀的完整标的代码。
- Ticker
Item - 一条规范化标的代码记录。
- Ticker
List Request - 用于浏览标的代码表的参数。
- Ticker
Search Request - 用于标的搜索和跨市场消歧的参数。
- Timestamped
Items - 将业务记录保存在
item中的带时间戳端点载荷。 - Trading
DayItem - Unix
Millis - 非负 Unix 毫秒时间戳。
- Validation
Error - 请求领域值或客户端配置值无效。
- Valuation
Item - Valuations
Data
Enums§
- Adjustment
- 历史行情复权口径。
- Anomaly
Tag - A 股异动标签。
- Asset
Type - 规范化的最细粒度资产类型。
- Auction
Phase - 集合竞价快照响应中的阶段。
- Auction
Stage - 集合竞价快照请求接受的阶段。
- Business
Error Kind - 上游非零业务结果对应的稳定恢复类别。
- Daily
Interval - 基金历史行情返回的固定日 K 线周期。
- Dragon
Tiger Board - 龙虎榜榜单筛选条件。
- Error
- 配置或调用 API 时产生的失败。
- Exchange
- 元数据 API 支持的交易所筛选条件。
- Financial
Ability Kind - 固定的财务分析能力分组。
- Financial
Indicator Id - 上游契约定义的财务指标标识。
- Financial
Period - 财务报表频率。
- Fiscal
Period - 上市公司财务报表返回的会计期间。
- Fund
NavType - 基金净值序列选择。
- Fund
Range - 基金历史净值区间。
- Fund
Type - 基金标的宇宙。
- Holder
Merge Scope - 持有人记录合并策略。
- Holder
Record Scope - 基金持有人记录返回的实际披露范围。
- HotList
Period - 排名聚合周期。
- Index
Tag - 同花顺指数目录标签。
- Json
Value - Represents any valid JSON value.
- Limit
Break Sort Field - 炸板池排序字段。
- Limit
Down Sort Field - 跌停池排序字段。
- Limit
UpSort Field - 涨停池排序字段。
- Manager
Performance Range - 基金经理业绩区间。
- Offering
Status - 新发基金认购状态。
- Portfolio
Asset Type - 基金持仓披露使用的资产类别。
- Rank
Trend - 热榜排名变化方向。
- Sort
Direction - 特色数据分页池使用的排序方向。
Constants§
- SUPPORTED_
ENDPOINTS - 上游契约中当前所有可用的 REST 端点。
Type Aliases§
- Anomaly
Data - Balance
Sheets Data - Cash
Flow Statements Data - Fund
Asset Allocation Data - Fund
Balance Sheets Data - Fund
Company Data - Fund
Diagnostics Data - Fund
Drawdowns Data - Fund
Financial Indicators Data - Fund
Holders Data - Fund
Income Statements Data - Fund
Indicator History Data - Fund
Industry Allocation Data - Fund
Manager Detail Data - Fund
Manager Experience Data - Fund
Manager Performance Data - Fund
Manager Style Data - Fund
NavData - Fund
Offerings Data - Fund
Portfolio History Data - Fund
Profile Data - Fund
Report Dates Data - Fund
Returns Data - HotStock
Data - HotStock
Trend Data - Income
Statements Data - Index
Catalog Data - Index
Constituents Data - Limit
Break Data - Limit
Down Data - Limit
UpData - Ticker
Data - Trading
Days Data