FMP Earnings Calendar API
Python Example & WorkflowFMP 财报日历 API
Python 示例与生产工作流
Fetch earnings events with Python, preserve revisions, normalize sessions and fiscal periods, and validate every alert before production use.
使用 Python 获取财报事件,保留修订历史,统一发布时段与财务期间,并在生产使用前验证每条提醒。
TL;DR
Use FMP's stable /stable/earnings-calendar endpoint with an API key and explicit from/to dates. FMP specifically recommends a date window when requesting future events.
Dates, BMO/AMC timing, EPS estimates, revenue estimates, and event availability may change. Keep snapshots and compare revisions instead of overwriting the only record.
Map provider symbols to stable security identity, separate event date from fiscal period, preserve the provider session label, and attach retrieval time and validation status.
The calendar tells you what is scheduled or reported; it does not prove an exchange-local timestamp, filing publication time, or final company confirmation unless those are validated separately.
使用 FMP Stable API 的 /stable/earnings-calendar,携带 API Key 和明确的 from/to 日期。FMP 特别说明,查询未来事件时应提供日期窗口。
日期、盘前/盘后时段、EPS 预估、营收预估和事件可用性都可能变化。应保存快照并比较修订,而不是覆盖唯一记录。
把服务商股票代码映射到稳定证券身份,分离事件日期和财务期间,保留服务商时段标签,并附加获取时间与验证状态。
日历说明计划或已披露事件,但不能自动证明交易所本地精确时间、文件发布时间或公司最终确认状态,这些需要单独验证。
Recommended pattern: fetch a bounded window, store the raw payload, normalize each record into your own event schema, diff it against the prior snapshot, and emit alerts only from accepted changes.
推荐模式:获取有限日期窗口,保存原始响应,把记录转换为自己的事件 Schema,与上一版快照比较,只根据通过验证的变化发送提醒。
Prerequisites and architecture boundary准备工作与架构边界
This implementation is for research dashboards, portfolio calendars, earnings-monitoring agents, and pre/post-event workflows. You need an FMP API key, an allowed plan, a date-window policy, secure secret storage, and a destination such as a database or queue.
本实施方案适用于研究看板、投资组合日历、财报监控 Agent,以及财报前后工作流。需要准备 FMP API Key、允许访问该接口的套餐、日期窗口策略、安全密钥存储,以及数据库或队列等输出位置。
Store FMP_API_KEY in a secret manager or environment variable. Never embed it in browser JavaScript, source control, screenshots, logs, or agent prompts.
Choose a bounded UTC date range, for example today through the next seven days. Smaller repeatable windows simplify retries and revision detection.
Maintain a security master that maps symbol, exchange, issuer, security, and identifier history. A ticker alone is not a durable key.
Use a scheduler for repeat retrieval and persist the previous snapshot or hash. Without state, the system cannot distinguish a new event from a revised event.
把 FMP_API_KEY 存入密钥管理器或环境变量,不能放进浏览器 JavaScript、代码仓库、截图、日志或 Agent Prompt。
使用有限的 UTC 日期范围,例如今天到未来七天。较小且可重复的窗口更便于重试和识别修订。
维护证券主数据,映射股票代码、交易所、发行人、证券及标识符历史。股票代码本身不是持久主键。
通过调度器重复获取,并保存上一版快照或哈希。没有状态,就无法区分新增事件与修订事件。
FMP Earnings Calendar API Python exampleFMP 财报日历 API Python 示例
The official stable endpoint is https://financialmodelingprep.com/stable/earnings-calendar. The example below supplies an API key and explicit date window, raises on HTTP errors, validates the JSON shape, and never logs the credential.
官方 Stable API 路径是 https://financialmodelingprep.com/stable/earnings-calendar。下面的示例携带 API Key 和明确日期窗口,对 HTTP 错误直接失败,验证 JSON 结构,并且不记录密钥。
import os
from datetime import date, timedelta
import requests
API_URL = "https://financialmodelingprep.com/stable/earnings-calendar"
API_KEY = os.environ["FMP_API_KEY"]
start = date.today()
end = start + timedelta(days=7)
response = requests.get(
API_URL,
params={
"from": start.isoformat(),
"to": end.isoformat(),
"apikey": API_KEY,
},
timeout=(3.05, 20),
)
response.raise_for_status()
events = response.json()
if not isinstance(events, list):
raise ValueError("Expected the FMP earnings calendar to return a list")
print(f"received {len(events)} earnings events")
Understand the response before writing business logic编写业务逻辑前先理解返回字段
FMP documents announcement date, estimated EPS, and actual EPS as core earnings-calendar data. Its related earnings documentation also describes release-session labels such as before market open (BMO) and after market close (AMC), while the changelog records fields including fiscalDateEnding and updatedFromDate. Inspect the live payload available to your plan before relying on any field.
FMP 官方文档把公告日期、预估 EPS 和实际 EPS 作为财报日历核心数据;相关财报文档还说明了盘前(BMO)和盘后(AMC)等发布时段,Changelog 则记录了 fiscalDateEnding 与 updatedFromDate 等字段。依赖任何字段前,都要检查当前套餐实际返回的数据。
| Field concept字段概念 | Use用途 | Do not assume不能默认 |
|---|---|---|
| symbol | Provider-facing security lookup服务商侧证券查询 | A permanent global identity永久的全球身份 |
| date | Scheduled or reported calendar date计划或已报告日历日期 | An exchange-local exact timestamp交易所本地精确时间戳 |
| time / session | BMO, AMC, or other provider timing labelBMO、AMC 或其他服务商时段标签 | A precise clock time精确时钟时间 |
| epsEstimated / eps | Expected and actual EPS when available可用时的预估与实际 EPS | That missing actual EPS means zero实际 EPS 缺失等于零 |
| revenueEstimated / revenue | Expected and actual revenue when returned返回时的预估与实际营收 | Consistent currency and scale without validation无需验证即可确定币种与尺度一致 |
| fiscalDateEnding | The fiscal period associated with the event事件对应的财务期末 | The same thing as announcement date与公告日期相同 |
| updatedFromDate | Provider update context when present存在时表示服务商更新上下文 | A complete revision audit trail by itself它本身就是完整修订审计记录 |
Normalize event date, fiscal period, session, and estimates统一事件日期、财务期间、发布时段与预估值
Keep the raw FMP record unchanged, then create a separate canonical event. A normalized record should make uncertainty visible instead of turning a date or BMO/AMC label into a false exact timestamp.
原始 FMP 记录应保持不变,再单独生成统一事件。标准化记录应该显式表达不确定性,而不是把日期或 BMO/AMC 标签伪装成精确时间戳。
{
"event_id": "earnings:security-123:2026-08-06",
"issuer_id": "issuer-123",
"security_id": "security-123",
"symbol_as_reported": "EXAMPLE",
"event_date": "2026-08-06",
"release_session": "after_market_close",
"release_time_precision": "session_only",
"exchange_timezone": "America/New_York",
"fiscal_period_end": "2026-06-30",
"eps_estimate": 1.23,
"eps_actual": null,
"revenue_estimate": null,
"revenue_actual": null,
"provider": "financial_modeling_prep",
"retrieved_at": "2026-08-03T08:00:00Z",
"validation_status": "accepted_with_unknowns",
"raw_record_hash": "sha256:..."
}
Step-by-step earnings monitoring implementation分步构建财报监控工作流
Retrieve a small overlap around the target period—for example yesterday through the next seven days—so delayed jobs do not create silent gaps.
Before transformation, store request parameters, HTTP status, retrieval time, response hash, and the raw record or an immutable object reference.
Resolve the symbol, map BMO/AMC to controlled session values, attach exchange timezone, and keep fiscal period distinct from event date.
Use security identity plus event date and fiscal period. Do not deduplicate only on symbol or only on date.
Classify new, removed, rescheduled, session-changed, estimate-revised, and actual-reported events. Preserve both old and new values.
Generate one event key per accepted change so retries do not send duplicate notifications or trigger the same downstream job twice.
在目标期间前后保留少量重叠,例如昨天到未来七天,避免调度延迟造成静默缺口。
转换前保存请求参数、HTTP 状态、获取时间、响应哈希,以及原始记录或不可变对象引用。
解析股票代码,把 BMO/AMC 映射为受控时段值,附加交易所时区,并把财务期间与事件日期分开。
使用证券身份、事件日期与财务期间组合去重,不能只看股票代码或日期。
分类新增、移除、改期、时段变化、预估修订和实际值发布事件,并保留变化前后的值。
为每个通过验证的变化生成唯一事件 Key,避免重试造成重复提醒或重复运行下游任务。
Validate each event before it reaches an alert or agent事件进入提醒或 Agent 前必须逐项验证
Control API keys, rate limits, caching, and alert load控制 API Key、限流、缓存与提醒负载
| Control控制项 | Recommended implementation推荐实现 | Failure prevented避免的问题 |
|---|---|---|
| Secret handling密钥管理 | Server-side secret store, rotation, least privilege, redacted logs服务端密钥库、轮换、最小权限和日志脱敏 | Credential leakage and uncontrolled use凭证泄露与失控调用 |
| Bounded windows有限窗口 | Small rolling range with intentional overlap带少量重叠的滚动日期范围 | Wasteful requests and missed events请求浪费与遗漏事件 |
| Cache policy缓存策略 | Cache raw window responses; invalidate by schedule and revision needs缓存原始窗口响应;按调度与修订需求失效 | Duplicate calls and inconsistent readers重复调用与读取不一致 |
| Backoff退避 | Jittered bounded retry for transient errors; respect 429 guidance临时错误采用带抖动的有限重试;遵循 429 指引 | Retry storms and quota exhaustion重试风暴与配额耗尽 |
| Alert fan-out提醒扩散 | Queue accepted changes and deduplicate by event version把已接受变化放入队列,并按事件版本去重 | Duplicate messages and downstream spikes重复消息与下游流量峰值 |
Do not hardcode plan quotas in application logic or this guide. Verify current endpoint access, call limits, commercial rights, and pricing in FMP's official plan documentation before deployment.
不要在应用逻辑或本指南中写死套餐配额。部署前应在 FMP 官方套餐文档中核对当前接口访问权、调用限制、商业使用权和价格。
Common FMP earnings calendar failure modesFMP 财报日历常见失败模式
Supply both from and to, verify ISO dates and API-key access, and test a wider known earnings window. FMP's help content specifically calls out the need for a date range.
Check multiple listings, duplicate provider records, rescheduled events, and fiscal-period differences. Resolve security identity before deduplication.
Treat this as a revision, not delete-plus-new noise. Link old and new versions, record detection time, and withdraw obsolete scheduled alerts.
A session label is not an exact time. Keep session-only precision and apply the listing exchange's timezone and calendar only when scheduling a local operational window.
Null means unavailable at that retrieval time, not zero. Schedule post-release refreshes and record when the actual first appears.
Separate authentication, subscription access, and rate-limit handling. Do not hide these conditions behind an empty calendar result.
同时提供 from 和 to,验证 ISO 日期和 API Key 权限,并测试一个已知包含财报的更宽窗口。FMP 帮助内容明确指出查询未来事件需要日期范围。
检查多地上市、服务商重复记录、事件改期和财务期间差异,去重前先解析证券身份。
把它视为修订,而不是无意义的删除加新增。关联新旧版本,记录发现时间,并撤销旧提醒。
时段标签不是精确时间。保留 session-only 精度,只在安排本地操作窗口时应用上市交易所的时区与日历。
null 表示本次获取时不可用,不是零。安排财报发布后的再次获取,并记录实际值首次出现时间。
分别处理认证、套餐权限和限流,不能把这些错误伪装成空日历。
Where QVeris fits in an earnings workflowQVeris 在财报工作流中的位置
FMP is the data provider for this calendar endpoint. QVeris can help an agent discover and inspect related financial, transcript, filing, news, and notification capabilities before calling them. Your application still owns credentials, the normalized event store, licensing checks, revision logic, validation, and alert policy.
FMP 是该日历接口的数据服务商。QVeris 可以帮助 Agent 在调用前发现并检查相关金融、电话会、申报文件、新闻和通知能力;凭证、统一事件库、许可检查、修订逻辑、验证和提醒策略仍由应用负责。
Find calendar, transcript, filing, press-release, quote, and notification capabilities based on the workflow goal.
Review schema, provider, cost, latency, date coverage, and required parameters before execution.
Execute the selected capability and retain request parameters, provider trace, retrieval time, status, and raw evidence.
Normalize into the event contract, compare revisions, then trigger watchlists, post-release retrieval, variance checks, or human review.
根据工作流目标查找日历、电话会、申报文件、新闻稿、行情和通知能力。
执行前检查 Schema、服务商、成本、延迟、日期覆盖与必填参数。
执行所选能力,保留请求参数、服务商追踪、获取时间、状态和原始证据。
转换到统一事件契约,比较修订,再触发观察列表、财报后获取、差异检查或人工复核。
FMP Earnings Calendar API FAQFMP 财报日历 API 常见问题
FMP documents the stable endpoint as https://financialmodelingprep.com/stable/earnings-calendar. Supply an API key and an explicit from/to date window, especially for future events.
FMP states that future events require both from and to parameters. Also verify date formatting, API-key access, subscription coverage, and whether the window contains scheduled reports.
No. Dates, sessions, EPS estimates, and revenue estimates can change. Store retrieval time and a version or hash, then compare snapshots rather than overwriting the only copy.
Treat them as sessions, not precise timestamps. Preserve the provider value, map it to a controlled enum, and use the exchange calendar and timezone when scheduling alerts.
Yes, but it should consume validated normalized records rather than unchecked raw data. Preserve source, retrieval time, event status, estimates, fiscal period, and revision history.
FMP 官方 Stable API 路径是 https://financialmodelingprep.com/stable/earnings-calendar。应携带 API Key 和明确的 from/to 日期窗口,特别是查询未来事件时。
FMP 说明查询未来事件需要同时提供 from 和 to。还要检查日期格式、API Key 权限、套餐覆盖,以及窗口内是否确有计划财报。
不是。日期、发布时段、EPS 预估和营收预估都可能变化。应保存获取时间与版本或哈希,并比较快照,而不是覆盖唯一记录。
把它们视为时段,而不是精确时间戳。保留服务商原始值,映射到受控枚举,并在安排提醒时结合交易所日历与时区。
可以,但应读取经过验证和标准化的记录,而不是未经检查的原始数据。需要保留来源、获取时间、事件状态、预估值、财务期间与修订历史。
Verify the endpoint, changes, timing, and access核对接口、变更、更新时间与访问权限
FMP documentation is the source of truth for current parameters, fields, cycle times, access tiers, and commercial terms. Re-run contract tests when FMP changes the stable endpoint or response schema.
当前参数、字段、更新周期、访问套餐与商业条款应以 FMP 官方文档为准。Stable API 或返回 Schema 发生变化时,应重新运行契约测试。
