Xpersona
F

FP-DCF

CLAWHUB · Unverified

Estimate intrinsic value with a first-principles DCF from structured JSON or provider-backed ticker input, and return auditable FCFF, WACC, and per-share val...

62
Rank
84
Safety
1.1k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s176xyqmhrpkg8bb0ep2926cyh83n5gn:fp-dcf
  1. Install using `clawhub skill install s176xyqmhrpkg8bb0ep2926cyh83n5gn:fp-dcf` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/tiejiang8/fp-dcf before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-tiejiang8-fp-dcf/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

154,136 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: "fp-dcf"
description: "Estimate intrinsic value with a first-principles DCF from structured JSON or provider-backed ticker input, and return auditable FCFF, WACC, and per-share value output."
metadata: {"openclaw":{"emoji":"📉","homepage":"https://github.com/tiejiang8/FP-DCF","requires":{"anyBins":["python3","python"]}}}
user-invocable: true
---

# FP-DCF

Version: `v0.6.0`

## Repository Workflow Notice

- For this repository, GitHub submissions do not use a separate branch workflow.
- Do not create a feature branch for routine updates; commit and publish on the designated branch directly unless the user explicitly asks for a different flow.
- If a default workflow suggests opening a branch or PR, treat that as incorrect for this repository.

Use this skill when the task is to estimate intrinsic value from structured fundamentals and assumption inputs using a disciplined, auditable DCF workflow.

## Invocation Scope

Use this skill when the user asks for:

- intrinsic value
- DCF valuation
- `FCFF` / `WACC` based valuation
- market-implied growth
- what growth rate is implied by the current market price
- `WACC / terminal-growth` sensitivity
- auditable valuation JSON for a company

Do not use this skill as the only answer when the user asks:

- should I buy or sell this stock
- which stock is better
- build me a portfolio
- rank an industry
- backtest a strategy
- analyze a bank, insurer, broker, or financial-sector company

For investment-report tasks, FP-DCF may be used only as the valuation layer. The agent must still handle:

- industry structure
- competitive advantage
- business quality
- revenue / margin drivers
- balance-sheet risk
- management and capital allocation
- valuation conclusion

## Model Selection Rule

- Use `steady_state_single_stage` when the company is mature, normalized, or the user wants a conservative base case.
- Use `two_stage` when there is a defensible explicit high-growth period followed by stable growth.
- Use `three_stage` when high growth is expected to fade gradually before terminal growth.
- Use `market_implied_growth.enabled=true` when the user asks what the current price implies.
- Use sensitivity output by default unless the environment lacks `matplotlib` or the user asks for JSON-only output.

## Runtime Contract

This repository is executable when installed as a skill because it includes a concrete CLI entrypoint:

- Primary runner: `{baseDir}/scripts/run_dcf.py`
- Python module entrypoint: `python3 -m fp_dcf.cli`
- Sample input: `{baseDir}/examples/sample_input.json`
- Base Python dependencies for the default one-click path: `akshare`, `baostock`, `numpy`, `pandas`, `yfinance`, `matplotlib`

Preferred execution pattern:

1. Build a JSON payload that matches `{baseDir}/examples/sample_input.json`.
2. Write that payload to a temporary JSON file in the workspace.
3. Run one of:
   - `python3 {baseDir}/scripts/run_dcf.py --input /path/to/input.json --pretty`
   - `python {baseDir}/scripts/run_dcf

README.md

# FP-DCF

[English](./README.md) | [简体中文](./README.zh-CN.md)

A first-principles DCF engine for LLM agents and quantitative research workflows.

FP-DCF turns normalized public-company data into auditable `FCFF`, `WACC`, valuation, implied-growth, and sensitivity outputs without hiding accounting and valuation assumptions behind opaque shortcuts.

> Repository workflow note: GitHub submissions for this project do not use a separate feature-branch workflow. Commit and publish on the designated branch directly unless the maintainer explicitly says otherwise.

Representative market-implied sensitivity heatmaps:

| Apple two-stage | NVIDIA three-stage |
| --- | --- |
| ![Apple two-stage market-implied sensitivity heatmap](./examples/AAPL_two_stage_manual_fundamentals_market_implied.output.sensitivity.png) | ![NVIDIA three-stage market-implied sensitivity heatmap](./examples/NVDA_three_stage_manual_fundamentals_market_implied.output.sensitivity.png) |

## Quickstart

Install and run the sample in one go:

```bash
python3 -m pip install .
python3 scripts/run_dcf.py --input examples/sample_input.json --pretty
```

This returns structured JSON and, by default, auto-renders `png/svg` sensitivity heatmaps.

## Use Scope

FP-DCF is a valuation engine, not a stock-picking engine.

Use it when the task is to:

* estimate intrinsic value from explicit fundamentals and assumptions
* compare base-case value with market price
* reverse-engineer the growth rate implied by the current market price
* generate `WACC / terminal-growth` sensitivity outputs
* provide auditable valuation JSON for agents, research pipelines, dashboards, or downstream ranking systems

Do not use it as:

* a buy / sell recommendation system
* a portfolio optimizer
* a backtesting platform
* a factor-ranking engine unrelated to valuation
* a financial-sector valuation model for banks, insurers, brokers, or balance-sheet-driven companies unless a dedicated model is added
* a substitute for industry research, competitive analysis, or management-quality judgment

The correct mental model is:

* industry research decides whether the business deserves a DCF
* FP-DCF tests what valuation assumptions are required
* `market_implied_growth` checks whether the market price is already too demanding

## Who this is for

* agent / tool workflows that need machine-readable valuation output
* quantitative and discretionary research pipelines
* users who care about auditable `FCFF -> WACC -> DCF` logic
* downstream systems that need diagnostics, warnings, and source labels

## Not for

* portfolio optimization
* trade execution
* backtesting platforms
* black-box one-number valuation tools
* factor ranking systems unrelated to valuation

## Why FP-DCF

Unlike many open-source DCF scripts, FP-DCF:

* separates operating tax for `FCFF` from marginal tax for `WACC`
* uses an explicit `Delta NWC` hierarchy instead of hard-coding one noisy field
* supports traceable FCFF path selection (`EBIAT` vs `CFO`)
* suppor

_meta.json

{
  "ownerId": "kn792tpaedz40s0ev46s1zfmrs82hy6d",
  "slug": "fp-dcf",
  "version": "0.5.1",
  "publishedAt": 1778933712037
}

references/methodology.md

# FP-DCF Methodology

This document defines the intended public methodology for `FP-DCF`.

## Objective

`FP-DCF` is designed to compute intrinsic value from public-company statements using a disciplined `FCFF -> WACC -> DCF` pipeline that is robust to imperfect retail-market data providers.

## FCFF Policy

### Operating Tax

- Preferred source: reported statement-level effective tax rate.
- Fallback source: explicit market default or user-provided override.
- Requirement: the output must state which source was used.

### Delta NWC Hierarchy

Use the first reliable source in this order:

1. `delta_nwc`
2. `OpNWC_delta`
3. `NWC_delta`
4. derived operating NWC from current assets/current liabilities, excluding non-operating cash and short-term debt when possible
5. cash-flow fallback such as `ChangeInWorkingCapital`

This is intentionally more conservative than hard-coding a single balance-sheet formula.

### FCFF Construction

Preferred paths:

- `EBIAT + D&A - CapEx - DeltaNWC`
- `CFO + after-tax interest - CapEx`

Selection policy:

- if both paths are available, prefer the `CFO` path
- expose the selected path in structured output
- expose `reconciliation_gap` and `reconciliation_gap_pct` when both paths are available

Anchor-mode policy:

- default `fcff_anchor_mode` is `latest`
- `manual` requires an explicit `fcff_anchor`
- `three_period_average` uses the latest available three periods from the selected path
- `reconciled_average` uses the latest overlapping periods from both paths and averages the two path anchors

Interest policy:

- prefer reported cash-flow `interest_paid` when constructing the `CFO` path
- if `interest_paid` is unavailable but `interest_expense` is available, the engine may proxy it
- proxying `interest_expense` for `interest_paid` must emit a warning

## WACC Policy

The intended `WACC` contract contains:

- risk-free rate
- equity risk premium
- beta
- cost of equity
- pre-tax cost of debt
- marginal tax rate
- equity weight
- debt weight

Capital-structure policy:

- market-value equity should be paired with `total_debt` for debt weight when available
- if `total_debt` is unavailable, `net_debt` may be used only as a fallback proxy
- the chosen proxy must be recorded in `capital_structure_source`
- fallback to `net_debt` must emit a warning

The debt tax shield should use the marginal tax assumption, not the operating tax estimate used in `FCFF`.

## Valuation Models

### Steady-State Single-Stage DCF

Recommended when the business is mature or the user wants a normalized base-case valuation.

Policy:

- estimate a steady-state `FCFF` anchor
- grow one period forward
- compute terminal enterprise value from `FCFF_1 / (WACC - g)`
- avoid treating historical realized `FCFF` as a forward explicit forecast series

### Two-Stage DCF

Recommended when a higher-growth period is material and defendable.

Policy:

- explicit high-growth stage
- stable terminal stage
- `g_stable < WACC`

## Reliability Flags

The engine shoul

README.zh-CN.md

# FP-DCF

[English](./README.md) | [简体中文](./README.zh-CN.md)

面向 LLM Agent 与量化研究流程的第一性原理 DCF 估值引擎。

FP-DCF 专注做一件事:把公开财报与市场数据转成可审计的 `FCFF`、`WACC`、估值结果、隐含增长率与敏感性分析输出,而不是把会计口径与估值假设混在一起做成一个黑盒数字。

> 仓库工作流说明:本项目提交到 GitHub 时不走单独功能分支工作流。除非维护者明确说明,否则请直接在指定分支上提交和同步。

代表性的市场隐含敏感性热力图:

| Apple 两阶段 | NVIDIA 三阶段 |
| --- | --- |
| ![Apple two-stage market-implied sensitivity heatmap](./examples/AAPL_two_stage_manual_fundamentals_market_implied.output.sensitivity.png) | ![NVIDIA three-stage market-implied sensitivity heatmap](./examples/NVDA_three_stage_manual_fundamentals_market_implied.output.sensitivity.png) |

## 快速开始

安装并直接跑 sample:

```bash
python3 -m pip install .
python3 scripts/run_dcf.py --input examples/sample_input.json --pretty
```

这会返回结构化 JSON,并默认自动渲染 `png/svg` 敏感性热力图。

## 使用范围

FP-DCF 是估值内核,不是选股器。

适合用于:

* 基于明确财务数据和假设,计算公司内在价值
* 对比当前市价与基础情景估值
* 反推当前市价隐含了多高的增长率
* 生成 `WACC / 永续增长率` 敏感性分析
* 为 Agent、量化研究流程、估值看板、下游排序系统提供机器可读 JSON

不适合直接用于:

* 买入 / 卖出建议
* 组合优化
* 交易执行
* 回测平台
* 与估值无关的因子排序
* 银行、保险、券商等金融类公司,除非未来加入专用估值模型
* 代替行业研究、竞争格局判断、管理层判断

正确用法是:

* 行业研究决定“这家公司是否值得估值”
* FP-DCF 决定“什么假设下价格才合理”
* `market_implied_growth` 决定“当前市场价格隐含了多高预期”

## 适合谁

* 需要机器可读估值输出的 agent / tool workflow
* 量化与主观研究流程
* 在意 `FCFF -> WACC -> DCF` 可审计逻辑的用户
* 需要 diagnostics、warnings、source labels 的下游系统

## 不适合谁

* 组合优化
* 交易执行
* 回测平台
* 黑盒式“一键一个数字”的估值工具
* 与估值无关的因子排序系统

## 为什么是 FP-DCF

相比很多开源 DCF 脚本,FP-DCF 的重点是:

* 将 `FCFF` 的经营税率与 `WACC` 的边际税率明确分离
* 使用显式的 `Delta NWC` 层级,而不是硬编码一个噪声很大的字段
* 支持可追踪的 FCFF 路径选择(`EBIAT` vs `CFO`)
* 支持规范化 anchor 模式(`latest`、`manual`、`three_period_average`、`reconciled_average`)
* 输出结构化 diagnostics、warnings 与 source labels,而不是只给一个结论数

## 你会得到什么

* 支持 `steady_state_single_stage`、`two_stage`、`three_stage` 的结构化估值 JSON
* 统一的市场隐含增长能力 `market_implied_growth`
* `steady_state_single_stage` 反推市场隐含长期增长率;`two_stage` 和 `three_stage` 反推市场隐含 stage-1 增长率
* `WACC x Terminal Growth` 敏感性热力图
* provider-backed normalization,包含带本地缓存的 Yahoo 路径,以及面向 CN 的 AkShare + BaoStock fallback
* provider `data_freshness` 输出,包含 cache age、stale、unknown 与 user-supplied 分类
* 适合下游工具消费的 machine-readable diagnostics
* 显式输出 `requested_valuation_model` / `effective_valuation_model`,unknown `valuation_model` 不再 silent fallback

## 输出形状示意

```json
{
  "valuation_model": "three_stage",
  "contract_version": "fp-dcf.valuation_output.v1",
  "requested_valuation_model": "three_stage",
  "effective_valuation_model": "three_stage",
  "valuation": {
    "present_value_stage1": 514861452010.8,
    "present_value_stage2": 285871425709.47,
    "present_value_terminal": 1539144808713.01,
    "terminal_value": 3095373176764.22,
    "explicit_forecast_years": 8
  },
  "data_freshness": {
    "provider": "user_supplied",
    "freshness_class": "user_supplied",
    "requires_refresh": false
  },
  "diagnostics": ["valuation_model_three_stage"],
  "warnings": []
}
```

## 数据字典

`fp-dcf` 返回的标准 JSON 来自 `ValuationOutput`。当主 CLI 开启相应功能时,还会额外补充 `market_inputs`、`sensitivity` 和 `artifacts`。

## Contracts

机器可读合约位于 `contracts/`:

* 

Sponsored

Ads related to FP-DCF and adjacent AI workflows.