# Three-Scenario Valuation Methodology in AI Berkshire: Implementation and Calculation Guide

> Learn the three-scenario valuation methodology to calculate Bull, Base, and Bear case target prices. This guide details implementation and exact calculation for AI Berkshire.

- Repository: [Xbt Lin/ai-berkshire](https://github.com/xbtlin/ai-berkshire)
- Tags: how-to-guide
- Published: 2026-07-26

---

**The three-scenario valuation methodology calculates Bull, Base, and Bear case target prices by compounding current EPS at scenario-specific growth rates and multiplying the result by scenario-specific PE multiples, using exact decimal arithmetic to eliminate floating-point drift.**

The AI Berkshire repository implements this deterministic valuation model to estimate future share prices under varying market conditions throughout its research workflow. Unlike conventional spreadsheet analysis, the methodology—embedded in the `investment-team` and `portfolio-review` skills—guarantees reproducible, audit-friendly results by relying exclusively on Python's `decimal` module.

## Core Implementation in tools/financial_rigor.py

The `three_scenario_valuation` function is defined in [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) (lines 20-63) and serves as the computational engine for the entire methodology.

```python

# Function signature based on the implementation

def three_scenario_valuation(
    current_price,
    current_eps,
    shares_billion,
    growth_optimistic,
    growth_neutral,
    growth_pessimistic,
    pe_optimistic,
    pe_neutral,
    pe_pessimistic,
    years=3,
    currency=""
):

```

The function accepts the current market price, current EPS, share count (in billions), three yearly growth rates, three target PE ratios, a projection horizon, and an optional currency label. The CLI exposes this logic via the `three-scenario` subcommand defined at lines 13-15 of the same file.

## Step-by-Step Calculation Logic

### Input Conversion with Exact Decimal Arithmetic

All numeric inputs are cast to exact `Decimal` objects via the helper `exact()` to prevent floating-point rounding errors from compounding over multi-year projections:

```python

# From tools/financial_rigor.py lines 29-32

p = exact(current_price)
eps = exact(current_eps)
shares = exact(shares_billion)

```

### Scenario Definition

The model constructs three tuples representing **Bull** (optimistic), **Base** (base-case), and **Bear** (pessimistic) scenarios. Each tuple contains the scenario name, annual EPS growth rate, and target PE ratio.

### Future EPS Projection

For each scenario, the algorithm projects EPS forward using annual compounding:

```python

# From tools/financial_rigor.py lines 50-53

future_eps = eps
for _ in range(years):
    future_eps = _CTX.multiply(future_eps, (1 + growth))

```

The calculation uses the decimal context `_CTX` to maintain exact precision throughout the projection period.

### Target Price and Percentage Change Calculation

The projected EPS is multiplied by the scenario-specific PE multiple to derive the target share price, then compared to the current price:

```python

# From tools/financial_rigor.py lines 53-55

target_price = _CTX.multiply(future_eps, target_pe)
change = float(target_price - p) / float(p) * 100

```

The final output displays the scenario name, annual growth, target PE, projected EPS, target price, and percentage price change in a formatted table.

## Command-Line Usage Examples

### High-Growth Technology Stock

```bash
python3 tools/financial_rigor.py three-scenario \
    --price 210 \
    --eps 5.2 \
    --shares 12 \
    --growth 0.25 0.12 0.00 \
    --pe 30 22 15 \
    --years 3 \
    --currency USD

```

This yields three targets: approximately **$383** (+82%) for the Bull case (25% growth, PE 30), **$306** (+46%) for the Base case (12% growth, PE 22), and **$78** (-63%) for the Bear case (0% growth, PE 15).

### Stable Consumer Goods Company

```bash
python3 tools/financial_rigor.py three-scenario \
    --price 45 \
    --eps 2.1 \
    --shares 8 \
    --growth 0.08 0.04 -0.02 \
    --pe 18 16 12 \
    --years 3 \
    --currency HKD

```

The model outputs three target prices (approximately HK$68, HK$58, and HK$44) reflecting modest upside and downside scenarios for defensive equities.

### Programmatic Integration

```python
from tools.financial_rigor import three_scenario_valuation

three_scenario_valuation(
    current_price=75,
    current_eps=3.5,
    shares_billion=5,
    growth_optimistic=0.20,
    growth_neutral=0.07,
    growth_pessimistic=-0.05,
    pe_optimistic=28,
    pe_neutral=22,
    pe_pessimistic=15,
    years=3,
    currency="EUR"
)

```

When called programmatically, the function prints the same formatted table as the CLI version and returns `None`, serving research automation pipelines through side effects.

## Integration in Research Workflows

The three-scenario valuation methodology is embedded throughout AI Berkshire's research pipeline to ensure valuation consistency. According to the source code, the `investment-team` skill references this model at line 83 of [`skills/investment-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-team.md), while the `portfolio-review` skill invokes it at line 106 of [`skills/portfolio-review.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/portfolio-review.md) for portfolio-level return forecasting. This integration guarantees that every analyst follows the same rigorous, reproducible valuation process when generating investment reports.

## Summary

- The three-scenario valuation methodology calculates Bull, Base, and Bear target prices by compounding EPS growth and applying scenario-specific PE multiples over a defined projection horizon.
- Implemented in [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) using Python's `decimal` module via the `exact()` helper to guarantee exact arithmetic and eliminate floating-point drift.
- Accepts current market data, three annual growth rates, three target PE ratios, and an optional currency label, defaulting to a 3-year projection period.
- Exposed as both the `three_scenario_valuation` function for scripting and the `three-scenario` CLI subcommand for interactive analysis.
- Powers critical research skills including `investment-team` and `portfolio-review` to maintain institutional-grade valuation standards across the AI Berkshire ecosystem.

## Frequently Asked Questions

### What inputs does the three-scenario valuation methodology require?

The model requires the current stock price, current EPS, share count in billions, three annual EPS growth rates (optimistic, neutral, pessimistic), three target PE ratios, a projection horizon in years (default 3), and an optional currency label for display purposes.

### Why does AI Berkshire use the decimal module instead of standard floats?

The `three_scenario_valuation` function relies on Python's `decimal` module to prevent floating-point drift during iterative calculations. By converting inputs via the `exact()` helper and using the `_CTX` decimal context for all arithmetic operations, the methodology ensures that multi-year EPS compounding remains deterministic and audit-friendly, matching the precision standards required for institutional investment research.

### How is the target price calculated in each scenario?

For each scenario (Bull, Base, Bear), the algorithm compounds the current EPS at the specified annual growth rate for the projection years using exact decimal multiplication. It then multiplies the resulting future EPS by the scenario-specific PE multiple to derive the target share price. Finally, it calculates the percentage change from the current market price to quantify upside or downside potential.

### Can I use the valuation methodology programmatically outside the CLI?

Yes. Import `three_scenario_valuation` from `tools.financial_rigor` and invoke it with the required parameters. The function prints a formatted table of results showing projected EPS, target price, and percentage change for all three scenarios. While it returns `None`, the printed output serves automated reporting needs within Jupyter notebooks, CI pipelines, or other Python scripts in the AI Berkshire ecosystem.