Skip to content

Conversation

bendikto
Copy link
Owner

New src/dcf_inputs.py collects and derives the inputs a future DCF (discounted cash flow) model will need, from the same cached raw data metrics_engine.py already uses — no new network calls. This is intentionally data collection only, not the DCF calculation itself (projection, terminal value, present value), which stays out of scope for a separate future issue.

  • compute_dcf_inputs(): capital structure (total debt, net debt, cost of debt), beta, effective tax rate (prefers yfinance's own "Tax Rate For Calcs" when present, falls back to tax provision / pretax income), and latest free cash flow (uses yfinance's own "Free Cash Flow" row when present, falls back to operating cash flow + capital expenditure)
  • build_dcf_inputs_table(): one row per company for a whole industry
  • build_fcf_trend(): chronological (oldest-first) multi-year free cash flow table per company, for future FCF projection

config.py: new FIELD_ALIASES entries for cash flow statement fields, verified against real cached yfinance payloads rather than guessed. Also added DCF_MARKET_ASSUMPTIONS documenting the two inputs yfinance can't provide at all (risk-free rate, equity risk premium) and that need to be set manually.

Verified compute_dcf_inputs() and build_fcf_trend() manually against real cached data (Mowi ASA) before writing tests, to confirm the numbers were sensible, not just that the code runs.

Full suite: 50 passed, 89% coverage on src/.

Closes #1

New src/dcf_inputs.py collects and derives the inputs a future DCF
(discounted cash flow) model will need, from the same cached raw data
metrics_engine.py already uses — no new network calls. This is
intentionally data collection only, not the DCF calculation itself
(projection, terminal value, present value), which stays out of scope
for a separate future issue.

- compute_dcf_inputs(): capital structure (total debt, net debt, cost
  of debt), beta, effective tax rate (prefers yfinance's own "Tax Rate
  For Calcs" when present, falls back to tax provision / pretax
  income), and latest free cash flow (uses yfinance's own "Free Cash
  Flow" row when present, falls back to operating cash flow +
  capital expenditure)
- build_dcf_inputs_table(): one row per company for a whole industry
- build_fcf_trend(): chronological (oldest-first) multi-year free cash
  flow table per company, for future FCF projection

config.py: new FIELD_ALIASES entries for cash flow statement fields,
verified against real cached yfinance payloads rather than guessed.
Also added DCF_MARKET_ASSUMPTIONS documenting the two inputs yfinance
can't provide at all (risk-free rate, equity risk premium) and that
need to be set manually.

Verified compute_dcf_inputs() and build_fcf_trend() manually against
real cached data (Mowi ASA) before writing tests, to confirm the
numbers were sensible, not just that the code runs.

Full suite: 50 passed, 89% coverage on src/.

Closes #1
@bendikto bendikto added Enhancement Optimizations, performance tweaks, or minor upgrades to existing features Src Core backend logic, algorithmic development, math engines, and internal system architecture changes /EPIC : High-level initiatives or large bodies of work Data-Ingestion Pipeline construction, web scraping, API integrations, and database scripts labels Oct 12, 2026
@bendikto bendikto self-assigned this Oct 12, 2026
@bendikto bendikto merged commit 9ba75ce into main Oct 12, 2026
@bendikto bendikto deleted the 1-Add-data-collection-pipeline-for-DCF-analysis branch October 12, 2026 17:15
Sign in to join this conversation on GitHub.
Labels
Data-Ingestion Pipeline construction, web scraping, API integrations, and database scripts Enhancement Optimizations, performance tweaks, or minor upgrades to existing features /EPIC : High-level initiatives or large bodies of work Src Core backend logic, algorithmic development, math engines, and internal system architecture changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add data collection pipeline for DCF (discounted cash flow) analysis
1 participant