fmp-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fmp_mcp-0.1.0/.gitignore +10 -0
- fmp_mcp-0.1.0/LICENSE +21 -0
- fmp_mcp-0.1.0/PKG-INFO +118 -0
- fmp_mcp-0.1.0/README.md +101 -0
- fmp_mcp-0.1.0/fmp/AGENT_PROMPTING_GUIDE.md +223 -0
- fmp_mcp-0.1.0/fmp/API_REFERENCE.json +792 -0
- fmp_mcp-0.1.0/fmp/README.md +581 -0
- fmp_mcp-0.1.0/fmp/__init__.py +100 -0
- fmp_mcp-0.1.0/fmp/cache.py +191 -0
- fmp_mcp-0.1.0/fmp/client.py +611 -0
- fmp_mcp-0.1.0/fmp/estimate_store.py +763 -0
- fmp_mcp-0.1.0/fmp/examples/README.md +198 -0
- fmp_mcp-0.1.0/fmp/examples/analyze_bank_balance_sheets.py +181 -0
- fmp_mcp-0.1.0/fmp/examples/analyze_chip_stocks.py +106 -0
- fmp_mcp-0.1.0/fmp/examples/balance_sheet_analysis.py +141 -0
- fmp_mcp-0.1.0/fmp/examples/dividend_analysis.py +240 -0
- fmp_mcp-0.1.0/fmp/examples/fcf_analysis.py +298 -0
- fmp_mcp-0.1.0/fmp/examples/reit_dividend_comparison.py +237 -0
- fmp_mcp-0.1.0/fmp/examples/test_fmp_search.py +65 -0
- fmp_mcp-0.1.0/fmp/examples/treasury_yield_analysis.py +215 -0
- fmp_mcp-0.1.0/fmp/exceptions.py +73 -0
- fmp_mcp-0.1.0/fmp/registry.py +1369 -0
- fmp_mcp-0.1.0/fmp/server.py +1063 -0
- fmp_mcp-0.1.0/fmp/tools/__init__.py +35 -0
- fmp_mcp-0.1.0/fmp/tools/_file_output.py +137 -0
- fmp_mcp-0.1.0/fmp/tools/aliases.py +26 -0
- fmp_mcp-0.1.0/fmp/tools/estimates.py +229 -0
- fmp_mcp-0.1.0/fmp/tools/etf_funds.py +406 -0
- fmp_mcp-0.1.0/fmp/tools/fmp_core.py +377 -0
- fmp_mcp-0.1.0/fmp/tools/insider.py +250 -0
- fmp_mcp-0.1.0/fmp/tools/institutional.py +258 -0
- fmp_mcp-0.1.0/fmp/tools/market.py +1388 -0
- fmp_mcp-0.1.0/fmp/tools/news_events.py +239 -0
- fmp_mcp-0.1.0/fmp/tools/peers.py +258 -0
- fmp_mcp-0.1.0/fmp/tools/screening.py +274 -0
- fmp_mcp-0.1.0/fmp/tools/technical.py +840 -0
- fmp_mcp-0.1.0/fmp/tools/transcripts.py +1074 -0
- fmp_mcp-0.1.0/pyproject.toml +33 -0
fmp_mcp-0.1.0/.gitignore
ADDED
fmp_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Henry Chien
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
fmp_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fmp-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for Financial Modeling Prep - 19 tools for market data via Claude
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: fastmcp
|
|
9
|
+
Requires-Dist: pandas
|
|
10
|
+
Requires-Dist: pyarrow
|
|
11
|
+
Requires-Dist: python-dotenv
|
|
12
|
+
Requires-Dist: requests
|
|
13
|
+
Requires-Dist: zstandard
|
|
14
|
+
Provides-Extra: estimates
|
|
15
|
+
Requires-Dist: psycopg2-binary; extra == 'estimates'
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# fmp-mcp
|
|
19
|
+
|
|
20
|
+
Financial intelligence for your AI agent — powered by live market data.
|
|
21
|
+
|
|
22
|
+
Give Claude (or any MCP-compatible AI) the ability to analyze stocks, screen markets, compare peers, read earnings calls, and track sector rotations — all grounded in real financial data from [Financial Modeling Prep](https://financialmodelingprep.com/).
|
|
23
|
+
|
|
24
|
+
This isn't a raw API wrapper. Each tool is purpose-built for a specific analytical task, composing multiple data sources into structured, analysis-ready outputs designed for AI consumption.
|
|
25
|
+
|
|
26
|
+
## What your AI can do
|
|
27
|
+
|
|
28
|
+
**Market Intelligence**
|
|
29
|
+
- `get_market_context` — One-call market snapshot: indices, sectors, gainers/losers, economic events
|
|
30
|
+
- `get_sector_overview` — Sector and industry performance with P/E valuations
|
|
31
|
+
- `get_news` — Stock-specific or broad market news
|
|
32
|
+
- `get_events_calendar` — Earnings, dividends, splits, and IPO calendars
|
|
33
|
+
- `get_economic_data` — Economic indicators and high-impact event tracking
|
|
34
|
+
|
|
35
|
+
**Fundamental Analysis**
|
|
36
|
+
- `fmp_fetch` — Direct access to 60+ financial data endpoints (income statements, balance sheets, cash flows, key metrics, and more)
|
|
37
|
+
- `compare_peers` — Side-by-side peer comparison across 12 financial ratios
|
|
38
|
+
- `get_earnings_transcript` — Parsed earnings calls with speaker attribution and Q&A sections
|
|
39
|
+
|
|
40
|
+
**Stock Screening & Discovery**
|
|
41
|
+
- `screen_stocks` — Screen by sector, market cap, beta, dividend, volume, and more
|
|
42
|
+
- `get_institutional_ownership` — Institutional holder analytics and ownership trends
|
|
43
|
+
- `get_insider_trades` — Insider transaction flow and statistics
|
|
44
|
+
- `get_etf_holdings` — ETF/fund holdings, sector and country allocation
|
|
45
|
+
|
|
46
|
+
**Technical Analysis**
|
|
47
|
+
- `get_technical_analysis` — Composite signals from 7 indicators (SMA, EMA, RSI, MACD, Bollinger, ADX, Williams %R) with buy/sell scoring
|
|
48
|
+
|
|
49
|
+
**Analyst Sentiment**
|
|
50
|
+
- `get_estimate_revisions` — Historical EPS/revenue estimate revision trends
|
|
51
|
+
- `screen_estimate_revisions` — Screen for estimate momentum across a universe of stocks
|
|
52
|
+
|
|
53
|
+
**Data Discovery**
|
|
54
|
+
- `fmp_list_endpoints` — Browse all 60+ available data endpoints by category
|
|
55
|
+
- `fmp_describe` — Get parameter documentation for any endpoint
|
|
56
|
+
- `fmp_search` — Search for companies by name or ticker
|
|
57
|
+
- `fmp_profile` — Company profile with sector, industry, and key stats
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install fmp-mcp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Optional estimate-revision tools (requires PostgreSQL):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install "fmp-mcp[estimates]"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
Set your API key:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export FMP_API_KEY="your_key"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Optional settings:
|
|
80
|
+
|
|
81
|
+
- `FMP_CACHE_DIR` — Custom cache directory (default: `~/.cache/fmp-mcp/`)
|
|
82
|
+
- `FMP_CACHE_MAXSIZE` — Max in-memory cache entries (default: 200)
|
|
83
|
+
|
|
84
|
+
## Run
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
fmp-mcp
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or use with Claude Code:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"fmp-mcp": {
|
|
96
|
+
"type": "stdio",
|
|
97
|
+
"command": "uvx",
|
|
98
|
+
"args": ["fmp-mcp"],
|
|
99
|
+
"env": { "FMP_API_KEY": "your_key" }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## How it's different
|
|
106
|
+
|
|
107
|
+
| | Raw API wrapper | fmp-mcp |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| **Approach** | Expose every endpoint 1:1 | Purpose-built analytical tools |
|
|
110
|
+
| **Output** | Raw JSON, dozens of fields | Structured, summarized, analysis-ready |
|
|
111
|
+
| **Composition** | One API call per tool | Multiple sources stitched together |
|
|
112
|
+
| **AI-optimized** | Generic descriptions | Tool descriptions and schemas designed for LLM tool selection |
|
|
113
|
+
| **Caching** | None | Per-endpoint disk caching with configurable refresh strategies |
|
|
114
|
+
|
|
115
|
+
## Requirements
|
|
116
|
+
|
|
117
|
+
- Python 3.11+
|
|
118
|
+
- FMP API key ([get one here](https://financialmodelingprep.com/developer/docs/))
|
fmp_mcp-0.1.0/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# fmp-mcp
|
|
2
|
+
|
|
3
|
+
Financial intelligence for your AI agent — powered by live market data.
|
|
4
|
+
|
|
5
|
+
Give Claude (or any MCP-compatible AI) the ability to analyze stocks, screen markets, compare peers, read earnings calls, and track sector rotations — all grounded in real financial data from [Financial Modeling Prep](https://financialmodelingprep.com/).
|
|
6
|
+
|
|
7
|
+
This isn't a raw API wrapper. Each tool is purpose-built for a specific analytical task, composing multiple data sources into structured, analysis-ready outputs designed for AI consumption.
|
|
8
|
+
|
|
9
|
+
## What your AI can do
|
|
10
|
+
|
|
11
|
+
**Market Intelligence**
|
|
12
|
+
- `get_market_context` — One-call market snapshot: indices, sectors, gainers/losers, economic events
|
|
13
|
+
- `get_sector_overview` — Sector and industry performance with P/E valuations
|
|
14
|
+
- `get_news` — Stock-specific or broad market news
|
|
15
|
+
- `get_events_calendar` — Earnings, dividends, splits, and IPO calendars
|
|
16
|
+
- `get_economic_data` — Economic indicators and high-impact event tracking
|
|
17
|
+
|
|
18
|
+
**Fundamental Analysis**
|
|
19
|
+
- `fmp_fetch` — Direct access to 60+ financial data endpoints (income statements, balance sheets, cash flows, key metrics, and more)
|
|
20
|
+
- `compare_peers` — Side-by-side peer comparison across 12 financial ratios
|
|
21
|
+
- `get_earnings_transcript` — Parsed earnings calls with speaker attribution and Q&A sections
|
|
22
|
+
|
|
23
|
+
**Stock Screening & Discovery**
|
|
24
|
+
- `screen_stocks` — Screen by sector, market cap, beta, dividend, volume, and more
|
|
25
|
+
- `get_institutional_ownership` — Institutional holder analytics and ownership trends
|
|
26
|
+
- `get_insider_trades` — Insider transaction flow and statistics
|
|
27
|
+
- `get_etf_holdings` — ETF/fund holdings, sector and country allocation
|
|
28
|
+
|
|
29
|
+
**Technical Analysis**
|
|
30
|
+
- `get_technical_analysis` — Composite signals from 7 indicators (SMA, EMA, RSI, MACD, Bollinger, ADX, Williams %R) with buy/sell scoring
|
|
31
|
+
|
|
32
|
+
**Analyst Sentiment**
|
|
33
|
+
- `get_estimate_revisions` — Historical EPS/revenue estimate revision trends
|
|
34
|
+
- `screen_estimate_revisions` — Screen for estimate momentum across a universe of stocks
|
|
35
|
+
|
|
36
|
+
**Data Discovery**
|
|
37
|
+
- `fmp_list_endpoints` — Browse all 60+ available data endpoints by category
|
|
38
|
+
- `fmp_describe` — Get parameter documentation for any endpoint
|
|
39
|
+
- `fmp_search` — Search for companies by name or ticker
|
|
40
|
+
- `fmp_profile` — Company profile with sector, industry, and key stats
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install fmp-mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Optional estimate-revision tools (requires PostgreSQL):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install "fmp-mcp[estimates]"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
Set your API key:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
export FMP_API_KEY="your_key"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Optional settings:
|
|
63
|
+
|
|
64
|
+
- `FMP_CACHE_DIR` — Custom cache directory (default: `~/.cache/fmp-mcp/`)
|
|
65
|
+
- `FMP_CACHE_MAXSIZE` — Max in-memory cache entries (default: 200)
|
|
66
|
+
|
|
67
|
+
## Run
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
fmp-mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or use with Claude Code:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"fmp-mcp": {
|
|
79
|
+
"type": "stdio",
|
|
80
|
+
"command": "uvx",
|
|
81
|
+
"args": ["fmp-mcp"],
|
|
82
|
+
"env": { "FMP_API_KEY": "your_key" }
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## How it's different
|
|
89
|
+
|
|
90
|
+
| | Raw API wrapper | fmp-mcp |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| **Approach** | Expose every endpoint 1:1 | Purpose-built analytical tools |
|
|
93
|
+
| **Output** | Raw JSON, dozens of fields | Structured, summarized, analysis-ready |
|
|
94
|
+
| **Composition** | One API call per tool | Multiple sources stitched together |
|
|
95
|
+
| **AI-optimized** | Generic descriptions | Tool descriptions and schemas designed for LLM tool selection |
|
|
96
|
+
| **Caching** | None | Per-endpoint disk caching with configurable refresh strategies |
|
|
97
|
+
|
|
98
|
+
## Requirements
|
|
99
|
+
|
|
100
|
+
- Python 3.11+
|
|
101
|
+
- FMP API key ([get one here](https://financialmodelingprep.com/developer/docs/))
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# FMP Agent Prompting Quick Reference
|
|
2
|
+
|
|
3
|
+
Use this guide when tasking Claude agents to perform financial analysis using the FMP package.
|
|
4
|
+
|
|
5
|
+
> **Full API Reference:** See `fmp/API_REFERENCE.json` for complete endpoint schemas and response columns.
|
|
6
|
+
|
|
7
|
+
## Basic Usage
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from fmp import FMPClient
|
|
11
|
+
from fmp.exceptions import FMPEmptyResponseError
|
|
12
|
+
|
|
13
|
+
fmp = FMPClient()
|
|
14
|
+
|
|
15
|
+
# All endpoints use fmp.fetch() - returns a pandas DataFrame
|
|
16
|
+
df = fmp.fetch("income_statement", symbol="AAPL", period="annual", limit=3)
|
|
17
|
+
|
|
18
|
+
# Check for empty results
|
|
19
|
+
if not df.empty:
|
|
20
|
+
for _, row in df.iterrows():
|
|
21
|
+
print(row['revenue'])
|
|
22
|
+
|
|
23
|
+
# Handle endpoints that may return no data (e.g., dividends for non-payers)
|
|
24
|
+
try:
|
|
25
|
+
dividends = fmp.fetch("dividends", symbol="GOOG")
|
|
26
|
+
except FMPEmptyResponseError:
|
|
27
|
+
print("No dividend history")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Prompt Template
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Use the FMP package at `fmp/` to [task].
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from fmp import FMPClient
|
|
37
|
+
from fmp.exceptions import FMPEmptyResponseError
|
|
38
|
+
fmp = FMPClient()
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use `fmp.fetch("[endpoint]", symbol="[SYMBOL]", ...)` to fetch [what].
|
|
42
|
+
|
|
43
|
+
Analyze:
|
|
44
|
+
1. [Question 1]
|
|
45
|
+
2. [Question 2]
|
|
46
|
+
|
|
47
|
+
Write and execute a Python script.
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Endpoint Quick Reference
|
|
51
|
+
|
|
52
|
+
| Endpoint | Use For | Key Params |
|
|
53
|
+
|----------|---------|------------|
|
|
54
|
+
| `historical_price_adjusted` | Stock returns, drawdowns | `symbol`, `from`, `to` |
|
|
55
|
+
| `historical_price_eod` | Raw OHLCV prices | `symbol`, `from`, `to` |
|
|
56
|
+
| `treasury_rates` | Yield curve, rates | `from`, `to` |
|
|
57
|
+
| `income_statement` | Revenue, earnings, margins | `symbol`, `period`, `limit` |
|
|
58
|
+
| `balance_sheet` | Assets, debt, equity | `symbol`, `period`, `limit` |
|
|
59
|
+
| `cash_flow` | FCF, capex, dividends paid | `symbol`, `period`, `limit` |
|
|
60
|
+
| `key_metrics` | ROE, P/E, ratios | `symbol`, `period`, `limit` |
|
|
61
|
+
| `dividends` | Dividend history | `symbol` |
|
|
62
|
+
| `analyst_estimates` | EPS/revenue forecasts | `symbol`, `period`, `limit` |
|
|
63
|
+
| `price_target` | Analyst price targets | `symbol` |
|
|
64
|
+
| `earnings_transcript` | Earnings call transcript text | `symbol`, `year`, `quarter` |
|
|
65
|
+
| `sec_filings` | SEC filing metadata with links | `symbol`, `type`, `limit` |
|
|
66
|
+
| `search` | Find companies | `query`, `limit` |
|
|
67
|
+
| `profile` | Company info | `symbol` |
|
|
68
|
+
|
|
69
|
+
## Ready-to-Use Prompts
|
|
70
|
+
|
|
71
|
+
### Stock Performance Comparison
|
|
72
|
+
```
|
|
73
|
+
Use the FMP package at `fmp/` to compare stock performance.
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from fmp import FMPClient
|
|
77
|
+
fmp = FMPClient()
|
|
78
|
+
# Example: fmp.fetch("historical_price_adjusted", symbol="AAPL", **{"from": "2024-01-01", "to": "2024-12-31"})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Use `historical_price_adjusted` to fetch prices for [TICKER1], [TICKER2], [TICKER3]
|
|
82
|
+
from [START_DATE] to [END_DATE].
|
|
83
|
+
|
|
84
|
+
Calculate: total return, max drawdown, and rank by performance.
|
|
85
|
+
|
|
86
|
+
Write and execute a Python script.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Company Financial Health
|
|
90
|
+
```
|
|
91
|
+
Use the FMP package at `fmp/` to analyze [COMPANY] financial health.
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from fmp import FMPClient
|
|
95
|
+
fmp = FMPClient()
|
|
96
|
+
# Example: fmp.fetch("income_statement", symbol="AAPL", period="annual", limit=3)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Fetch `income_statement`, `balance_sheet`, and `key_metrics` for [TICKER] (last 3 years).
|
|
100
|
+
Use `profile` first to confirm you have the correct company.
|
|
101
|
+
|
|
102
|
+
Summarize: revenue trend, profitability (margins, ROE), and balance sheet strength.
|
|
103
|
+
|
|
104
|
+
Write and execute a Python script.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Dividend Analysis
|
|
108
|
+
```
|
|
109
|
+
Use the FMP package at `fmp/` to compare dividends.
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from fmp import FMPClient
|
|
113
|
+
from fmp.exceptions import FMPEmptyResponseError
|
|
114
|
+
fmp = FMPClient()
|
|
115
|
+
# Note: dividends endpoint raises FMPEmptyResponseError for non-dividend payers
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Use `dividends` endpoint for [TICKER1], [TICKER2], [TICKER3].
|
|
119
|
+
Handle FMPEmptyResponseError for companies that don't pay dividends.
|
|
120
|
+
|
|
121
|
+
Analyze: payment frequency, recent amounts, dividend growth, and current yield.
|
|
122
|
+
|
|
123
|
+
Write and execute a Python script.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Analyst Expectations
|
|
127
|
+
```
|
|
128
|
+
Use the FMP package at `fmp/` to analyze analyst expectations for [TICKER].
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from fmp import FMPClient
|
|
132
|
+
fmp = FMPClient()
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Fetch `analyst_estimates` (annual, limit=5) and `price_target`.
|
|
136
|
+
|
|
137
|
+
Summarize: EPS trajectory, revenue growth expectations, and price target consensus.
|
|
138
|
+
|
|
139
|
+
Write and execute a Python script.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Sector/Industry Comparison
|
|
143
|
+
```
|
|
144
|
+
Use the FMP package at `fmp/` to compare companies in [SECTOR].
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from fmp import FMPClient
|
|
148
|
+
fmp = FMPClient()
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
For [TICKER1], [TICKER2], [TICKER3], fetch `key_metrics` and `income_statement`.
|
|
152
|
+
|
|
153
|
+
Compare: margins, ROE, growth rates, and valuation multiples.
|
|
154
|
+
|
|
155
|
+
Write and execute a Python script.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Treasury Yield Analysis
|
|
159
|
+
```
|
|
160
|
+
Use the FMP package at `fmp/` to analyze Treasury yields.
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from fmp import FMPClient
|
|
164
|
+
fmp = FMPClient()
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Use `treasury_rates` from [START_DATE] to [END_DATE].
|
|
168
|
+
|
|
169
|
+
Columns: month1, month3, month6, year1, year2, year5, year10, year30.
|
|
170
|
+
|
|
171
|
+
Analyze: yield curve shape, inversions, rate changes over period.
|
|
172
|
+
|
|
173
|
+
Write and execute a Python script.
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Common Column Names
|
|
177
|
+
|
|
178
|
+
**profile:** `companyName`, `sector`, `industry`, `currency`, `description`
|
|
179
|
+
|
|
180
|
+
**income_statement:** `date`, `calendarYear`, `revenue`, `netIncome`, `eps`, `grossProfit`, `operatingIncome`
|
|
181
|
+
|
|
182
|
+
**balance_sheet:** `date`, `totalAssets`, `totalStockholdersEquity`, `totalDebt`, `cashAndCashEquivalents`
|
|
183
|
+
|
|
184
|
+
**cash_flow:** `date`, `operatingCashFlow`, `freeCashFlow`, `capitalExpenditure`, `stockBasedCompensation`, `dividendsPaid`
|
|
185
|
+
|
|
186
|
+
**key_metrics:** `date`, `marketCap`, `enterpriseValue`, `peRatio`, `roe`, `roic`, `debtToEquity`, `evToSales`, `dividendYield`
|
|
187
|
+
|
|
188
|
+
**historical_price_adjusted:** `date`, `adjClose`, `volume`
|
|
189
|
+
|
|
190
|
+
**treasury_rates:** `date`, `month3`, `year2`, `year10`, `year30`
|
|
191
|
+
|
|
192
|
+
**dividends:** `date`, `adjDividend`
|
|
193
|
+
|
|
194
|
+
**analyst_estimates:** `date`, `revenueAvg`, `revenueLow`, `revenueHigh`, `epsAvg`, `epsLow`, `epsHigh`, `numAnalystsRevenue`, `numAnalystsEps`
|
|
195
|
+
|
|
196
|
+
**price_target:** `lastMonthCount`, `lastMonthAvgPriceTarget`, `lastQuarterCount`, `lastQuarterAvgPriceTarget`, `lastYearCount`, `lastYearAvgPriceTarget`
|
|
197
|
+
|
|
198
|
+
**price_target_consensus:** `targetHigh`, `targetLow`, `targetConsensus`, `targetMedian`
|
|
199
|
+
|
|
200
|
+
**earnings_transcript:** `symbol`, `quarter`, `year`, `date`, `content` (full transcript text)
|
|
201
|
+
|
|
202
|
+
**sec_filings:** `symbol`, `fillingDate`, `acceptedDate`, `cik`, `type`, `link`, `finalLink` (link to SEC.gov filing)
|
|
203
|
+
|
|
204
|
+
## Tips
|
|
205
|
+
|
|
206
|
+
1. **For sub-agents:** Start prompts with "First, read `fmp/AGENT_PROMPTING_GUIDE.md` and `fmp/API_REFERENCE.json`" — this gives the agent full context on available endpoints and usage patterns
|
|
207
|
+
2. Always use `fmp.fetch("endpoint_name", symbol="TICKER", ...)` syntax
|
|
208
|
+
2. Import `FMPEmptyResponseError` for endpoints that may return no data
|
|
209
|
+
3. All responses are **pandas DataFrames** — use `df.empty`, `df.iterrows()`, `df.iloc[0]`
|
|
210
|
+
4. Use `profile` first to confirm ticker maps to expected company
|
|
211
|
+
5. Specify exact endpoint names from the table
|
|
212
|
+
6. List symbols explicitly
|
|
213
|
+
7. Mention expected columns to reduce errors
|
|
214
|
+
8. Ask comparative questions ("which is best?")
|
|
215
|
+
9. Request tables/summaries for clean output
|
|
216
|
+
|
|
217
|
+
## Important Notes
|
|
218
|
+
|
|
219
|
+
- **Return type:** All `fmp.fetch()` calls return pandas DataFrames, not dicts or lists
|
|
220
|
+
- **Date params:** Use `**{"from": "2024-01-01", "to": "2024-12-31"}` for date range params (since `from` is a Python keyword)
|
|
221
|
+
- **Empty responses:** Some endpoints (like `dividends`) raise `FMPEmptyResponseError` when no data exists
|
|
222
|
+
- **Sorting:** DataFrames often come in reverse chronological order; use `df.sort_values('date')` if needed
|
|
223
|
+
- **SEC filing content:** The `sec_filings` endpoint returns links to SEC.gov. To fetch content, use `requests` with a User-Agent header: `headers = {'User-Agent': 'Name (email)'}`
|