Skip to main content

finosdk_fiona_data 使用说明

概览

finosdk_fiona_data 是 Finoview 数据服务的 Python SDK,用于在 Python 环境中访问 Finoview 的金融数据产品。

SDK 只保留产品化入口:

数据产品 推荐入口 说明
市场数据 finosdk.marketdata 交易日历、合约信息、行情、持仓、仓单、价差、波动率等标准市场数据
因子数据 finosdk.factor 商品因子、国债因子、因子回测与测试数据
研究数据 finosdk.research 市场预期研判、机构观点统计等研究数据

顶层 finosdk 只暴露初始化、版本、异常、产品清单和三大产品模块,不再平铺导出 get_xxx 函数。

环境要求

项目 要求
Python 版本 >=3.9,推荐 3.103.11
操作系统 Windows / macOS / Linux
主要依赖 requests>=2.25.1pandas>=1.5,<3

安装

pip install -U finosdk_fiona_data -i https://pypi.org/simple

如需安装指定版本:

pip install finosdk_fiona_data==1.0.2 -i https://pypi.org/simple

配置 API Key

推荐使用环境变量配置 token。

Windows PowerShell:

$env:FINO_API_KEY="your_api_key"

Windows CMD:

set FINO_API_KEY=your_api_key

Linux / macOS:

export FINO_API_KEY="your_api_key"

也可以在代码中显式传入:

import finosdk as fino

fino.init(api_key="your_api_key")

初始化

import finosdk as fino

fino.init()

如需指定服务地址或超时时间:

fino.init(
    api_key="your_api_key",
    base_url="https://track.finoview.com.cn/data_api/",
    timeout=30,
)

产品清单

import finosdk as fino

print(fino.get_products())

返回格式

大多数接口默认返回 pandas.DataFrame。如需获取服务端原始 data,传入 as_df=False

df = fino.marketdata.quotes.get_dominant_quotes(
    start_date="20250102",
    end_date="20250130",
    symbol="RB",
)

rows = fino.marketdata.quotes.get_dominant_quotes(
    start_date="20250102",
    end_date="20250130",
    symbol="RB",
    as_df=False,
)

市场数据

市场数据按数据类型拆分:

模块 入口 常用函数
基础信息 fino.marketdata.basic_info get_trading_calendarget_futures_product_infoget_previous_trade_day
行情数据 fino.marketdata.quotes get_dominant_quotesget_intraday_ticksget_latest_minute_bars
持仓统计 fino.marketdata.positions get_member_positionsget_fund_flowget_section_statistics
仓单库存 fino.marketdata.warehouse get_warehouse_quantityget_warehouse_distribution
价差数据 fino.marketdata.spread get_basisget_monthly_spreadget_realtime_index_basis
期权数据 fino.marketdata.options get_option_contract_selectionget_option_risk_metrics
波动率数据 fino.marketdata.volatility get_historical_volatilityget_implied_volatility

示例:

import finosdk as fino

fino.init()

df = fino.marketdata.quotes.get_dominant_quotes(
    start_date="20250102",
    end_date="20250130",
    symbol="RB",
)

因子数据

因子数据按产品拆分:

数据产品 入口 说明
商品因子 fino.factor.commodity carry、trend、position、futurespot、value、warrant、volatility
国债因子 fino.factor.treasury basis、intradaytech、l2、position、riskyassets
因子回测/测试 fino.factor.csft get_csft_bkt_*get_csft_test_*

商品因子示例:

df = fino.factor.commodity.get_trend(
    start_date="20250102",
    end_date="20250130",
    code_list=["JD"],
    factor=["T_overnight_k240"],
    section=["农产品"],
)

国债因子示例:

df = fino.factor.treasury.get_basis(
    start_date="20250102",
    end_date="20250130",
    code_list=["T"],
)

因子回测示例:

df = fino.factor.csft.get_csft_bkt_perf(
    start_date="20250102",
    end_date="20250130",
    factor=["T_overnight_k240"],
)

研究数据

当前已提供市场预期研判相关接口:

df = fino.research.rating.get_overview(
    report_type="daily",
    start_date="20250102",
    end_date="20250130",
)

异常说明

SDK 会把请求错误和服务端错误包装为统一异常:

异常 说明
FinoHTTPError HTTP 请求失败或服务端返回非 200 状态码
FinoAPIError 服务端返回业务错误,例如 code != 200
FinoValidationError SDK 侧参数校验错误,预留给后续扩展

常见问题:

问题 可能原因
401 Unauthorized API Key 无效、过期或未配置
403 Forbidden 当前 token 没有该数据产品权限
429 Too Many Requests 调用频率超限
请求超时 查询区间过大、网络异常或服务端处理时间较长
返回空表 查询条件下没有数据,或过滤条件过窄

版本查看

pip show finosdk_fiona_data
import finosdk as fino

print(fino.__version__)

Release files for finosdk-fiona-data 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for finosdk-fiona-data 1.0.3
File Size Uploaded
finosdk_fiona_data-1.0.3.tar.gz 23.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for finosdk-fiona-data 1.0.3
File Interpreter ABI Platform
finosdk_fiona_data-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 46.1 kB

Release files / finosdk_fiona_data-1.0.3.tar.gz

Download URL finosdk_fiona_data-1.0.3.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
192c9f97625a839c08389e5668036e8827cab14599fd3ca2c907de887c02d8b3
BLAKE2b-256 checksum
How to use checksums
6588f5dbf9ef3a4c270ffd970537f2e7d570259f16ad7e21a09b37d5affdb1ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / finosdk_fiona_data-1.0.3-py3-none-any.whl

Download URL finosdk_fiona_data-1.0.3-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ad2a43030210228e1e0dc27db1857fbdefaf165ae8ec35996d191fe59f3a5a4
BLAKE2b-256 checksum
How to use checksums
fd20027ade9b18f7604b124398c96708f98602cc9561699aa77eaa5994d6e340
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page