Financial Calculations & Valuation Beginner

Calculate Benjamin Graham Number & Growth Intrinsic Value Formula in Python

Compute defensive investor valuation ceilings using the classic Benjamin Graham Number and the bond-yield-adjusted Graham Growth Formula in Python.

#numpy#pandas

Problem Statement

Value investors need a fast, conservative sanity check against DCF models using EPS, Book Value Per Share (BVPS), and corporate AAA bond yields.

Formula / Core Logic

Graham_Number = sqrt(22.5 * EPS * BVPS) Growth_Formula = [EPS * (8.5 + 2*g) * 4.4] / AAA_Yield

Installation

pip install numpy pandas
benjamin-graham-intrinsic-value-number-calculator-python.py
import numpy as np

def graham_valuation(eps, bvps, growth_rate_pct, aaa_bond_yield=7.1, current_price=None):
    graham_num = np.sqrt(22.5 * eps * bvps) if (eps > 0 and bvps > 0) else 0.0
    intrinsic_growth = (eps * (8.5 + 2.0 * growth_rate_pct) * 4.4) / aaa_bond_yield
    mos_pct = ((intrinsic_growth - current_price) / intrinsic_growth * 100) if current_price else None
    return {'Graham_Number': round(graham_num, 2), 'Growth_Intrinsic_Value': round(intrinsic_growth, 2), 'Margin_of_Safety_Pct': round(mos_pct, 2) if mos_pct is not None else None}

Get the Complete 100+ Python Quant & Automation Bundle

Instant lifetime access to all production-ready scripts, valuation models, and trading bots ($19).

Buy Full Bundle on Gumroad ($19) →

Frequently Asked Questions

Q: Where does 22.5 come from in the Graham Number?

Graham stipulated a maximum P/E of 15 and a maximum P/B of 1.5 for defensive stocks (15 x 1.5 = 22.5).