Skip to main content

FMP Ultimate API 中文接口文档(附开箱即用 SDK)

fmpquote 是面向中文量化与金融投研开发者的 Financial Modeling Prep(FMP Ultimate API)轻量级 Python 客户端,底层基于 Python 标准库实现零依赖开箱即用,并支持一键转换为 pandas.DataFrame。


一、 安装与快速上手

pip install fmpquote
# 如需使用 as_df=True 直接返回 pandas.DataFrame:
pip install "fmpquote[pandas]"

包内已预置公共测试 Key(以及备用测试 Key RcTN8ECyEECLFEXK),安装后无需配置即可直接调通跨市场示范标的:

  • 美股:AAPL、NVDA、TSLA、MSFT、AMZN、META、GOOGL、AMD、AVGO
  • 港股与 A 股:00700.HK / 0700.HK、600519.SS、300750.SZ
  • ETF、指数、外汇、加密与商品:SPY、^GSPC、EURUSD、BTCUSD、GCUSD 及 /stable/treasury-rates。

二、 SDK 核心方法参考

from fmpquote import FMPClient, format_cik, normalize_hk_symbol

# 优先级:显式传入 api_key > 环境变量 FMP_API_KEY > 内置默认测试 Key
client = FMPClient()

# 1. 获取实时报价(支持 as_df=True 转为 DataFrame)
quote_list = client.quote("NVDA")

# 2. 获取三大财务报表(支持 period="annual" 或 "quarter")
inc = client.income_statement("AAPL", period="annual", limit=5)
bal = client.balance_sheet("AAPL", period="annual", limit=5)
cf  = client.cash_flow("AAPL", period="annual", limit=5)

# 3. 获取 TTM 财务比率、关键估值指标与 DCF 测算
ratios  = client.ratios_ttm("MSFT")
metrics = client.key_metrics_ttm("MSFT")
dcf_res = client.dcf("AAPL")

# 4. 历史日线、财报电话会议纪要与美债收益率曲线
eod = client.eod_chart("AAPL", from_date="2025-01-01", to_date="2025-10-01")
transcript = client.earnings_transcript("NVDA", year=2025, quarter=4)
treasury = client.treasury_rates()

# 5. 通用 GET 方法:可调用 /stable/ 下全部 283 个端点
holders = client.get(
    "institutional-ownership/extract",
    params={"cik": format_cik(1067983), "year": 2025, "quarter": 2},
)
方法签名 对应 /stable/ 端点 返回字段与文档说明
client.quote(symbol) /stable/quote 股票实时报价文档
client.income_statement(symbol, period, limit) /stable/income-statement 利润表文档
client.balance_sheet(symbol, period, limit) /stable/balance-sheet-statement totalAssets, totalDebt, totalStockholdersEquity
client.cash_flow(symbol, period, limit) /stable/cash-flow-statement operatingCashFlow, capitalExpenditure, freeCashFlow
client.ratios_ttm(symbol) /stable/ratios-ttm TTM 财务比率文档
client.key_metrics_ttm(symbol) /stable/key-metrics-ttm evToEbitdaTTM, roicTTM, freeCashFlowYieldTTM
client.dcf(symbol) /stable/discounted-cash-flow DCF 估值文档
client.eod_chart(symbol, from_date, to_date) /stable/historical-price-eod/full date, open, high, low, close, volume, vwap
client.earnings_transcript(symbol, year, quarter) /stable/earning-call-transcript 电话会纪要文档
client.treasury_rates(from_date, to_date) /stable/treasury-rates date, month3, year2, year10, year30

三、 异常处理

当 API 返回非 200 状态码(如 403 权限限制或 429 频率超限)时,SDK 会抛出 FMPAPIError(status_code, message, endpoint)。查询全市场标的或了解完整接口说明请访问 FMP 中文接口文档站。

Metadata

Release files for fmpquote 0.2.1.post1

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

Source distribution (sdist)

Source distribution for fmpquote 0.2.1.post1
File Size Uploaded Provenance Actions
fmpquote-0.2.1.post1.tar.gz 10.5 kB Without provenance Details for fmpquote-0.2.1.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fmpquote 0.2.1.post1
File Interpreter ABI Platform Actions
fmpquote-0.2.1.post1-py3-none-any.whl Python 3 none any Details for fmpquote-0.2.1.post1-py3-none-any.whl

Total release size: 19.4 kB

Release files / fmpquote-0.2.1.post1.tar.gz

Download URL fmpquote-0.2.1.post1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ea4a784a59e9f4a3ae07986a425e01f9acd805aba8f90d541dc7ff3bd74385ee
BLAKE2b-256 checksum
How to use checksums
3f02ebb01ad91fb0ac3f32391214bf848f70eb9c29a7601a568e057f089dcc34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1

Release files / fmpquote-0.2.1.post1-py3-none-any.whl

Download URL fmpquote-0.2.1.post1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62c22a26ec1b18278191a2480ae6be73bc6b9a06ed2c46a6979e79645ad2fe49
BLAKE2b-256 checksum
How to use checksums
ddf44d50f91680ef199ce532979fe42b05c534b2e185b4774d6599cb26250231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1

Security for fmpquote 0.2.1.post1

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.

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