Math Errors Hide Behind Pretty Dashboards
In fintech learning projects, UI polish often advances faster than model correctness. That inversion creates misleading confidence and bad decision habits.
Step 1: Lock formula definitions in plain language
metrics:
roe:
formula: net_income / shareholder_equity
pvgo:
formula: market_price - (earnings_per_share / required_return)
Step 2: Build calculator functions with explicit units
def calc_roe(net_income: float, equity: float) -> float:
if equity == 0:
raise ValueError("equity cannot be zero")
return net_income / equity
Step 3: Add boundary tests before charting
def test_calc_roe_boundary():
assert round(calc_roe(120, 400), 4) == 0.3
Pitfalls
- Mixing percentages and decimal ratios silently.
- Plotting metrics from unvalidated data tables.
- No tests for zero or negative denominator conditions.
Verification
- Formula outputs match hand calculations on sample data.
- Unit tests run before dashboard generation.
- Metric labels clearly state units and precision.