Skip to content
Back to skills

Financial Data Collector

ASecurity

Use when collecting financial data for a US public company, assembling DCF inputs, pulling market and filing facts, or grounding downstream analysis in structured yfinance and SEC data.

  • 75 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 12, 2026
ai-agentspythonbashapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 15 files and shows the line behind each finding

Scanned November 25, 2026

npx -y skills add seaworld008/Commonly-used-high-value-skills --skill financial-data-collector --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Financial Data Collector?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Financial Data Collector
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/seaworld008-financial-data-collector/badge)](https://www.skillsdirectory.com/skills/seaworld008-financial-data-collector)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: financial-data-collector
description: 'Use when collecting financial data for a US public company, assembling DCF inputs, pulling market and filing facts, or grounding downstream analysis in structured yfinance and SEC data.'
zh_description: "用于采集美股上市公司的 SEC 申报与 yfinance 市场数据,整理 DCF 输入并输出带来源标注的结构化数据。"
version: "1.0.2"
author: "seaworld008"
source: "in-house"
source_url: ""
tags: ["collector", "data", "finance", "financial"]
created_at: "2026-03-18"
updated_at: "2026-11-17"
quality: 4
complexity: "intermediate"
---

# Financial Data Collector

Collect and validate real financial data for US public companies using free data sources.
Output is a standardized JSON file ready for consumption by other financial skills.

## When to Use

Use this skill when the user wants to:

- collect filing and market data for a US public company
- prepare structured inputs for valuation work
- ground downstream analysis in sourced SEC and market data
- generate a machine-readable financial dataset instead of a narrative report

## Usage

Recommended flow:

```text
collect data
-> validate output
-> preserve source attribution
-> hand off standardized JSON to downstream analysis
```

For the most portable workflow, prefer the SEC helper first because it uses Python standard library only. Use the `yfinance` collector when you specifically need market data and analyst estimates.

## Critical Constraints

**NO FALLBACK values.** If a field cannot be retrieved, set it to `null` with `_source: "missing"`.
Never substitute defaults (e.g., `beta or 1.0`). Prefer disclosed totals; sum components only when all required components are known, distinguishing zero from missing. The collector retains disclosed totals and combines components only when complete, leaving incomplete totals/net debt null and identifying missing components. Independently verify the source disclosures before delivery. The downstream skill decides how to handle missing data.

**Data source attribution is mandatory.** Every data section must have a `_source` field.

**CapEx sign convention:** yfinance returns CapEx as negative (cash outflow). Preserve the original sign. Document the convention in output metadata. Do NOT flip signs.

**yfinance FCF ≠ Investment bank FCF.** yfinance FCF = Operating CF + CapEx (no SBC deduction). Flag this in output metadata so downstream DCF skills don't overstate FCF.

## Workflow

### Step 1: Collect Data

Run the collection script:

```bash
python scripts/collect_data.py TICKER [--years 5] [--output path/to/output.json]
python scripts/collect_data.py TICKER --engine yfinance
python scripts/collect_data.py TICKER --engine yahoo-web
```

The available paths are separate: `collect_data.py` collects via yfinance or the Yahoo web parser; `sec_api.py` is a separate filing helper, not an automatic SEC fallback. Choose the source required by the task, supplement missing years from filings or the user, and do not guess.

SEC parsing helper:

```bash
python scripts/sec_api.py AAPL --tickers assets/sample_sec_company_tickers.json --submissions assets/sample_sec_submissions.json --companyfacts assets/sample_sec_companyfacts.json
```

That path is dependency-light and easier to reuse across AI coding tools.

`collect_data.py` defaults to `--engine auto`, which now resolves to the `yfinance` path when the optional dependency is installed. If not installed, the script fails clearly instead of silently dropping to a weaker live path.

### Step 2: Validate Data

```bash
python scripts/validate_data.py path/to/output.json
```

Checks include required market fields, Market Cap = Price × Shares, beta range, income-year coverage, CapEx sign, net-debt arithmetic, missing-year metadata, and `_source` in the three annual statement sections. It checks the risk-free-rate input, not a computed WACC range; it does not prove source completeness or the correctness of partial component totals. `auto` behavior follows `resolve_engine`, even if CLI help suggests otherwise.

### Step 3: Deliver JSON

Single file: `{TICKER}_financial_data.json`. Schema in `references/output-schema.md`.

**Do NOT create**: README, CSV, summary reports, or any auxiliary files.

## Output Schema (Summary)

```json
{
  "ticker": "META",
  "company_name": "Meta Platforms, Inc.",
  "data_date": "2026-03-02",
  "currency": "USD",
  "unit": "millions_usd",
  "data_sources": { "market_data": "...", "2022_to_2024": "..." },
  "market_data": { "current_price": 648.18, "shares_outstanding_millions": 2187, "market_cap_millions": 1639607, "beta_5y_monthly": 1.284 },
  "income_statement": { "2024": { "revenue": 164501, "ebit": 69380, "tax_expense": ..., "net_income": ..., "_source": "yfinance" } },
  "cash_flow": { "2024": { "operating_cash_flow": ..., "capex": -37256, "depreciation_amortization": 15498, "free_cash_flow": ..., "change_in_nwc": ..., "_source": "yfinance" } },
  "balance_sheet": { "2024": { "total_debt": 30768, "cash_and_equivalents": 77815, "net_debt": -47047, "current_assets": ..., "current_liabilities": ..., "_source": "yfinance" } },
  "wacc_inputs": { "risk_free_rate": 0.0396, "beta": 1.284, "credit_rating": null, "_source": "yfinance + ^TNX" },
  "analyst_estimates": { "revenue_next_fy": 251113, "revenue_fy_after": 295558, "eps_next_fy": 29.59, "_source": "yfinance" },
  "metadata": { "_capex_convention": "negative = cash outflow", "_fcf_note": "yfinance FCF = OperatingCF + CapEx. Does NOT deduct SBC." }
}
```

Full schema with all field definitions: `references/output-schema.md`

<correct_patterns>

### Handling Missing Years

```python
if pd.isna(revenue):
    result[year] = {"revenue": None, "_source": "yfinance returned NaN — supplement from 10-K"}
# Report missing years to the user. Do NOT skip or fill with estimates.
```

### CapEx Sign Preservation

```python
capex = cash_flow.loc["Capital Expenditure", year_col]  # -37256.0
result["capex"] = float(capex)  # Preserve negative
```

### Datetime Column Indexing

```python
year_col = [c for c in financials.columns if c.year == target_year][0]
revenue = financials.loc["Total Revenue", year_col]
```

### Field Name Guards

```python
if "Total Revenue" in financials.index:
    revenue = financials.loc["Total Revenue", year_col]
elif "Revenue" in financials.index:
    revenue = financials.loc["Revenue", year_col]
else:
    revenue = None
```

</correct_patterns>

<common_mistakes>

### Mistake 1: Default Values for Missing Data

```python
# ❌ WRONG
beta = info.get("beta", 1.0)
growth = data.get("growth") or 0.02

# ✅ RIGHT
beta = info.get("beta")  # May be None — that's OK
```

### Mistake 2: Assuming All Years Have Data

```python
# ❌ WRONG — 2020-2021 may be NaN
revenue = float(financials.loc["Total Revenue", year_col])

# ✅ RIGHT
value = financials.loc["Total Revenue", year_col]
revenue = float(value) if pd.notna(value) else None
```

### Mistake 3: Using yfinance FCF in DCF Models Directly

yfinance FCF does NOT deduct SBC. For mega-caps like META, SBC can be $20-30B/yr, making yfinance FCF ~30% higher than investment-bank FCF. Always flag this in output.

### Mistake 4: Flipping CapEx Sign

```python
# ❌ WRONG — double-negation risk downstream
capex = abs(cash_flow.loc["Capital Expenditure", year_col])

# ✅ RIGHT — preserve original, document convention
capex = float(cash_flow.loc["Capital Expenditure", year_col])  # -37256.0
```

</common_mistakes>

## Known yfinance Pitfalls

See `references/yfinance-pitfalls.md` for detailed field mapping and workarounds.

## Official SEC Sources

See `references/sec-official-sources.md` for the official SEC endpoints and how to use them in a filing-grounded workflow.

Files in this skill

  • .gitignore161 B
  • SKILL.md7.1 KB
  • assets/sample_sec_company_tickers.json88 B
  • assets/sample_sec_companyfacts.json1.8 KB
  • assets/sample_sec_submissions.json375 B
  • assets/sample_yahoo_quote_summary.json3.1 KB
  • assets/sample_yahoo_tnx_chart.json215 B
  • references/output-schema.md4.1 KB
  • references/sec-official-sources.md719 B
  • references/yahoo-web-sources.md863 B
  • references/yfinance-pitfalls.md3.1 KB
  • scripts/collect_data.py17.9 KB
  • scripts/sec_api.py8.1 KB
  • scripts/validate_data.py5.8 KB
  • scripts/yahoo_web_api.py9.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.