FFD Python SDK
FinFlow Data 金融数据接口 Python SDK,提供 A 股日线、分钟线、实时行情、基本面、宏观经济等数据。
安装
pip install ffd-sdk
快速开始
from ffd_sdk import FFDClient
# 初始化(API Key 在 https://ffd.findesk.cn 面板获取)
client = FFDClient("你的API_KEY")
# 查询账户
info = client.account()
print(f"套餐: {info['plan_name']}, 余额: {info['balance']} 数据点")
# 日线数据
df = client.daily("600519.SH", "close,open,high,low,volume", "2026-01-01", "2026-04-01")
print(df)
数据查询
所有查询函数默认返回 pandas.DataFrame,传 as_df=False 返回原始 dict。
日线数据
df = client.daily(
codes="600519.SH,000858.SZ",
indicators="close,open,high,low,volume",
start_date="2026-01-01",
end_date="2026-04-01",
)
基本面截面
df = client.basic(
codes="600519.SH,000858.SZ",
indicators="pe_ttm,pb,roe",
date="2026-04-01",
)
实时行情
df = client.realtime("600519.SH", "latest,open,high,low,volume,amount")
分钟行情
df = client.minute("600519.SH", "close,volume", "2026-04-01", "2026-04-11")
宏观经济数据
df = client.macro("M001620305", "2024-01-01", "2026-04-01")
条件选股
df = client.screen("市盈率<20且营收增速>30%")
专题报表
df = client.report(report_id="报表ID", params="参数")
公告查询
df = client.announcement(codes="600519.SH", params="参数")
特色数据
df = client.special(data_type="类型", keyword="关键词")
交易日历
result = client.trade_dates("SSE", "2026-01-01", "2026-12-31")
日期偏移
result = client.date_offset("SSE", "2026-04-15")
额度查询
result = client.quota()
通用查询
高级用户可直接使用底层 query() 方法传入任意参数:
resp = client.query("daily_series",
codes="600519.SH",
indicators="close",
start_date="2026-01-01",
end_date="2026-04-01",
)
错误处理
from ffd_sdk import FFDClient, FFDError
client = FFDClient("你的API_KEY")
try:
df = client.daily("600519.SH", "close", "2026-01-01", "2026-04-01")
except FFDError as e:
if e.code == 401:
print("API Key 无效")
elif e.code == 402:
print("余额不足,请充值")
elif e.code == 503:
print("服务暂不可用,稍后重试")
else:
print(f"错误: {e}")
多通道支持
FFD 支持多个数据通道,通道由 API Key 绑定。切换通道只需更换 Key,代码完全不变:
# 智选F版
client_f = FFDClient("F版的API_KEY")
df = client_f.daily("600519.SH", "close", "2026-01-01", "2026-04-01")
# 旗舰W版
client_w = FFDClient("W版的API_KEY")
df = client_w.daily("600519.SH", "close", "2026-01-01", "2026-04-01")
获取 API Key
- 访问 https://ffd.findesk.cn
- 注册/登录后进入控制面板
- 在「API Key 管理」中创建 Key
- 选择数据通道并复制 Key
系统要求
- Python >= 3.8
- 依赖: requests, pandas
Metadata
Release files for ffd-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ffd_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for ffd_sdk-0.2.0-py3-none-any.whl |
Release files / ffd_sdk-0.2.0-py3-none-any.whl
| Download URL | ffd_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d8d5953d29bb9ee155be9d5572f7e7253b5f6981e0d43f831b904e5b58773e9
|
|
BLAKE2b-256 checksum How to use checksums |
2367cf7e1fae4a0a49bf41e804748877a3654b7e65f685950f4763dbbfedfaa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for ffd-sdk 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.