Skip to main content

FinFlow Data (FFD) Python SDK - 金融数据统一接口

Project description

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

  1. 访问 https://ffd.findesk.cn
  2. 注册/登录后进入控制面板
  3. 在「API Key 管理」中创建 Key
  4. 选择数据通道并复制 Key

系统要求

  • Python >= 3.8
  • 依赖: requests, pandas

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finflowdata-0.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

finflowdata-0.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file finflowdata-0.2.0.tar.gz.

File metadata

  • Download URL: finflowdata-0.2.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for finflowdata-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8e271079b1b6ea75c7a37a6d734db0f038f71cf8b365e87ead566f954699e483
MD5 8cf076dd640fcab7bf6bc490c8393e38
BLAKE2b-256 5f3a6b3bd733dbe61e69f89dda12ae7d05c59877ea2126e1ae4197f20380cbbd

See more details on using hashes here.

File details

Details for the file finflowdata-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: finflowdata-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for finflowdata-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3494402468c60f71f6ec176bfe1778bfd3ccd997774d22903b92b1e0d4b1ac04
MD5 ee86af576b3a3ad2adbf71e15b226f1d
BLAKE2b-256 c5c46056388506476610165af42f32b8a4da6f4d25ba4cbafa760e0942ffc5b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page