# FMP Package Examples

These scripts were generated by Claude agents using the FMP package. Each section shows the prompt used and the resulting script.

## How to Use These Examples

1. **Run directly**: Each script is standalone and can be executed
2. **Adapt the prompts**: Use similar prompts for your own analyses
3. **Formalize into code**: These can serve as templates for production features

---

## Free Cash Flow Analysis

**Prompt:**
```
Use the FMP package at `fmp/` to analyze free cash flow generation.

from fmp import FMPClient
fmp = FMPClient()

Use the `cash_flow` endpoint to fetch cash flow statements for GOOGL, META,
and AMZN (last 3 years, annual).

Analyze:
1. Free cash flow trend for each company
2. FCF margin (FCF / Revenue - use income_statement for revenue)
3. Capital expenditure intensity
4. Which company generates the most FCF per dollar of revenue?

Write and execute a Python script.
```

**Generated:** `fcf_analysis.py`

---

## Treasury Yield Curve Analysis

**Prompt:**
```
Use the FMP package at `fmp/` to analyze Treasury yield curve changes.

from fmp import FMPClient
fmp = FMPClient()

Use the `treasury_rates` endpoint to fetch Treasury rates from 2023-01-01
to 2024-12-31.

The data includes columns: 'date', 'month1', 'month3', 'month6', 'year1',
'year2', 'year5', 'year10', 'year30'.

Analyze:
1. How did the 2Y-10Y spread change? (Was the curve inverted?)
2. What was the peak short-term rate (month3)?
3. Show yield curve shape at start vs end of period

Write and execute a Python script.
```

**Generated:** `treasury_yield_analysis.py`

---

## Dividend Analysis

**Prompt:**
```
Use the FMP package at `fmp/` to analyze dividend history.

from fmp import FMPClient
fmp = FMPClient()

Use the `dividends` endpoint to fetch dividend history for JNJ, PG, and KO.

Analyze:
1. Current dividend amount for each
2. Payment frequency (monthly vs quarterly)
3. Has the dividend been growing?
4. Which has the highest current yield? (use `profile` for price)

Write and execute a Python script.
```

**Generated:** `dividend_analysis.py`

---

## Chip Stock Price Analysis

**Prompt:**
```
Use the FMP package at `fmp/` to analyze price performance.

from fmp import FMPClient
fmp = FMPClient()

Use the `historical_price_adjusted` endpoint to fetch dividend-adjusted prices
for NVDA, AMD, and INTC from 2023-01-01 to 2024-12-31.

Calculate and compare:
1. Total return for each stock over the period
2. Max drawdown for each
3. Which performed best?

Write and execute a Python script. The endpoint returns columns like
'date', 'adjClose', etc.
```

**Generated:** `analyze_chip_stocks.py`

---

## Bank Balance Sheet Analysis

**Prompt:**
```
Use the FMP package at `fmp/` to analyze bank balance sheets.

from fmp import FMPClient
fmp = FMPClient()

Use the `balance_sheet` endpoint to fetch balance sheet data for JPM, BAC,
and WFC (last 3 years, annual).

Analyze:
1. Total assets trend
2. Loan-to-deposit ratios
3. Equity ratios
4. Which bank has the strongest balance sheet?

Write and execute a Python script.
```

**Generated:** `analyze_bank_balance_sheets.py`, `balance_sheet_analysis.py`

---

## REIT Dividend Comparison

**Prompt:**
```
Use the FMP package at `fmp/` to compare REIT dividends.

from fmp import FMPClient
fmp = FMPClient()

Compare dividend yields and payout history for O (Realty Income),
VNQ (Vanguard REIT ETF), and SPG (Simon Property Group).

Use the `dividends` and `profile` endpoints.

Analyze:
1. Current dividend yield for each
2. Dividend payment frequency
3. Dividend growth over last 3 years
4. Which offers the best income opportunity?

Write and execute a Python script.
```

**Generated:** `reit_dividend_comparison.py`

---

## Company Search

**Prompt:**
```
Use the FMP package at `fmp/` to search for companies.

from fmp import FMPClient
fmp = FMPClient()

1. Use the `search` endpoint to search for "artificial intelligence"
   companies (query="artificial intelligence", limit=10)

2. For the top 3 results, use the `profile` endpoint to get company details

3. Summarize: company name, sector, industry, market cap, description

Write and execute a Python script.
```

**Generated:** `test_fmp_search.py`

---

## Tips for Prompting Agents

1. **Always include the import snippet** - Agents need to know how to initialize
2. **Specify the endpoint name** - Use exact names from `fmp/README.md`
3. **List the symbols/tickers** - Be explicit about what to fetch
4. **Mention relevant columns** - Helps agent know what data to expect
5. **Ask specific questions** - Structured questions get structured answers
6. **Say "Write and execute"** - Ensures the agent actually runs the code

See `fmp/README.md` for the complete endpoint reference and more prompt templates.
