Financial models as code. Banker-grade Excel as output.

Write the business in Python. boki books the double entries, solves circularity explicitly, verifies every check, and compiles a live-formula workbook analysts can audit cell by cell — built for engineers and AI agents.

Get started Read the docs
plan.pyimport boki as b from boki.lib import compound from boki.units import USD, year m = b.Model("Widget Co", start="2027-01", periods=5, step=year) co = m.entity("Widget Co", standard=b.USGAAP, currency=USD) co.bs.opening(cash=20e6 * USD) growth = m.input("Revenue growth", 0.25) sales = co.pl.revenue("Product sales", compound(40e6 * USD, growth)) co.pl.cogs("Cost of sales", 0.45 * sales) co.pl.sga("Operating expenses", 6e6 * USD + 0.15 * sales) co.bs.fixed_asset("Plant", 30e6 * USD, at=0, life=10 * year) co.bs.loan("Term loan", draw={0: 25e6 * USD}, rate=0.07, repay=5e6 * USD) co.pl.income_tax("Income taxes", rate=0.21, base=co.pl.pretax_income) m.render().to_excel("widget.xlsx", money="$mm")
widget.xlsx · Widget Co IS · style=b.styles.banker
Widget Co – Income Statement
($ in millions)
FY2027EFY2028EFY2029EFY2030EFY2031E
Revenue40.050.062.578.197.7
% growth25.0%25.0%25.0%25.0%
Cost of revenue(18.0)(22.5)(28.1)(35.2)(43.9)
Gross profit22.027.534.443.053.7
% margin55.0%55.0%55.0%55.0%55.0%
Operating expenses(12.0)(13.5)(15.4)(17.7)(20.6)
Plant depreciation–(3.0)(3.0)(3.0)(3.0)
Total operating expenses(12.0)(16.5)(18.4)(20.7)(23.6)
Operating income (EBIT)10.011.016.022.330.1
% margin25.0%22.0%25.6%28.5%30.8%
Interest expense–(1.8)(1.4)(1.1)(0.7)
Pre-tax income10.09.314.621.229.4
% margin25.0%18.5%23.4%27.1%30.1%
Income taxes(2.1)(1.9)(3.1)(4.5)(6.2)
% effective tax rate21.0%21.0%21.0%21.0%21.0%
Net income7.97.311.516.723.2
% margin19.8%14.6%18.5%21.4%23.8%
E20fx=Model!F57
Investment-banking grade

3-Statement, LBO and DCF workbooks — compiled to live Excel.

Not toy templates. boki builds full historical-to-forecast 3-statement models, multi-tranche LBO debt waterfalls, and WACC/UFCF DCF valuations — with live =INDEX scenario switchers, proof-carrying formula rewrites, and 2D sensitivity matrices whose axis headers recalculate directly inside Excel. Click any cell below to inspect the real formula boki emits.

Input Formula Link
Apex Precision LBO – Returns
($ in millions) · Exit Valuation & Sponsor Returns
FY2029E Exit Bridge$mmMetric
FY2029E EBITDA183.0
Exit EV / EBITDA Multiple9.0x
Implied Exit Enterprise Value1,647.49.0x
Less: FY2029E Ending Total Debt(224.2)(1.2x)
Plus: FY2029E Ending Cash25.00.1x
Implied Exit Sponsor Equity1,448.1
Initial Sponsor Equity Invested397.5
Sponsor MoIC3.6x
Sponsor IRR (5-Year Hold)29.5%
Sensitivity: Sponsor IRR (Entry × Exit Multiple)
Live axis headers ($A31:$A35, C$30:G$30) — edit any multiple in Excel to recalculate
Entry \ Exit Exit 8.0x Exit 8.5x Exit 9.0x Exit 9.5x Exit 10.0x
Entry 8.0x 33.8% 35.7%37.5%39.2%40.8%
Entry 8.5x 29.6%31.4%33.1%34.8%36.3%
Entry 9.0x 26.1% 27.8% 29.5% 31.1% 32.6%
Entry 9.5x 23.0%24.8%26.4%28.0%29.4%
Entry 10.0x 20.4%22.1%23.7%25.2%26.7%
E33fx=(((((($C$18*E$30)-G10)+$C$22)/(Transaction!$C$9+((Inputs!$C$7*($A33-Inputs!$C$8))*(1+Inputs!$C$9))))^0.2)-1)
Veridian MedTech DCF – Summary
($ in millions) · FY2024A Valuation Date
Valuation BridgePerpetuity GrowthExit Multiple
PV of Explicit UFCF (FY25E–FY29E)1,039.91,039.9
PV of Terminal Value3,297.84,576.1
Implied Enterprise Value ($mm)4,337.75,616.0
Terminal Value % of EV76.0%81.5%
Less: Valuation Date Total Debt(420.0)(420.0)
Plus: Valuation Date Cash240.0240.0
Implied Equity Value ($mm)4,157.75,436.0
Implied Share Price ($)$83.15$108.72
Implied Upside / (Downside)22.3%59.9%
Cross-Check: Implied Multiple / g9.7x4.7%
Sensitivity: Implied Share Price — WACC vs. g (PGM)
Row headers link live to CAPM WACC (=DCF!$C$33 ± 50 bps)
WACC \ g g = 2.0% g = 2.5% g = 3.0% g = 3.5% g = 4.0%
WACC 8.2%$86.07$92.44$100.04$109.25$120.67
WACC 8.7%$79.28$84.60$90.85$98.31$107.36
WACC 9.2%$73.43$77.93$83.15$89.29$96.62
WACC 9.7%$68.36$72.20$76.61$81.74$87.77
WACC 10.2%$63.90$67.22$70.99$75.32$80.36
C8fx=($C$6+$C$7)
Acme Industrial Corp. – Financial Highlights & Credit Profile
($ in millions) · Historical Actuals (2022A–2024A) | Explicit Forecast (2025E–2029E)
Financial Highlights FY2022AFY2023AFY2024A FY2025EFY2026EFY2027EFY2028EFY2029E
Revenue 400.0 440.0 485.0 523.8 565.7611.0659.8712.6
% growth–10.0%10.2% 8.0%8.0%8.0%8.0%8.0%
Gross profit 168.0187.0208.5 225.2 243.3262.7283.7306.4
EBITDA 74.085.097.0 104.8 113.1122.2132.0142.5
Net income 31.939.948.8 55.6 62.168.976.283.9
Free cash flow (FCF) ––– 42.8 47.051.957.162.7
Net debt 135.0119.898.7 69.838.33.7(34.4)(76.0)
F6fx=(E6*(1+Inputs!$C$6))
0 Model sheets (omit_unused_model=True) Base / Bull / Bear =INDEX switch 0 Excel formula mismatches
Source code: 3-Statement · LBO · DCF
How it works

Code where logic belongs. Excel where analysts work.

Spreadsheet models cannot be diffed, tested or reviewed, and their hardest parts — circular references, macro-pasted values, broken links — are the least visible. boki keeps the model in Python and compiles a workbook you can trust.

Every number is a live formula — traceable end to end.

Every assumption lives once on Inputs in blue, flows cleanly through statement formulas in black, and ties out automatically on Checks. No hardcoded overrides, no pasted macro outputs.

  • Live recalc in Excel & LibreOffice: change a growth rate, scenario index, or sensitivity header and the whole workbook updates.
  • Independent formula audit: every formula cell in boki's test suite is recalculated by an independent engine and compared against Python.
Inputs Active scenario 1 (Base) Revenue growth Inputs!$C$6 8.0% IS (FY2025E) Revenue 523.8 =(E6*(1+Inputs!$C$6)) COGS & OpEx (442.4) Operating income 81.4 =(F9+F11+F12+F13) Checks BS Balances OK CF = ΔCash OK Cash ≥ 0 OK Blue: hardcoded input Black: live formula Green: cross-sheet link
SOURCE Python Model Human or AI Agent plan.py 1. Units are types USD + kW fails immediately UnitError 2. Double-entry ledger BS balances & CF = ΔCash Always ties 3. Explicit circularity Named m.solve or hard stop CycleError 4. Proof-carrying rewrites Perturbation-verified Excel EquivalenceError VERIFIED Banker .xlsx 0 mismatches Checks: OK

Built for AI agents. Mistakes cannot get through.

Writing spreadsheets directly via cell coordinates is brittle for humans and catastrophic for LLMs. With boki, an agent writes concise Python and gets immediate, actionable diagnostics whenever accounting or units break.

  • Perturbation-verified rewrites: b.block(..., verify="perturb") checks Base, every scenario, and random input perturbations before emitting concise banker =SUM(...) formulas.
  • Code reviewable in Git: diff assumptions, run pytest in CI, and pin board-approved numbers with b.expect.

The accounting is done for you

Write revenue, payment terms, fixed assets and loans. boki books the double entries, depreciation, interest and indirect cash flow.

co.pl.revenue("Sales", 120 * USD, settle=b.delay(1))
co.bs.fixed_asset("Oven", 60 * USD, at=0, life=3 * year)
print(m.render().cf(co, method="indirect"))

Explicit solving, zero hidden loops

Debt sculpting, interest during construction and goal seeks are solved explicitly with m.solve. Unintended loops stop immediately.

debt = m.unknown("Debt", unit=USD.dims)
idc  = m.series("IDC", 0.08 * debt)
m.solve(debt, debt == 1_000 * USD + idc)  # 1,086.96

Proof-carrying Excel blocks

Emit clean banker subtotals without sacrificing auditability — boki proves your Excel override equals the ledger before writing.

b.block(co.cf.operating, [
    co.pl.net_income, depreciation, change_in_nwc,
], label="Cash flow from operations", verify="perturb")

Diff, test, and pin board numbers

Stamp out one model per site or vintage, sweep scenarios in a loop, and fail CI if a change moves signed-off numbers.

b.expect(m.render(), {
    co.pl.net_income: [7.9e6, 7.3e6, 11.5e6, 16.7e6, 23.2e6]
}, rel=0.01)
Proof

Battle-tested on 228 real-world financial models.

boki was built by rewriting published analyst, university, and government spreadsheets line by line and comparing every output cell against the original workbook — uncovering 102 silent inconsistencies in the source files along the way.

228public models rewritten in boki
211reproduce their source workbooks
102inconsistencies found in 50 originals
0formula mismatches in exported Excel
Multi-standard & presentation

One model. Any accounting standard or house style.

Need the same underlying business in US GAAP, IFRS, or J-GAAP — or formatted for a banker deck versus an SEC 10-K? Swap the standard or style preset without rewriting a single line of business logic.

US GAAPb.styles.banker

Current-first balance sheet, parentheses for expenses, blue/black/green color coding, and automatic % growth & margin rows.

Revenue40.050.0
Cost of revenue(18.0)(22.5)
Net income7.97.3
IFRSb.styles.sec

Statement of Profit or Loss and non-current-first Statement of Financial Position, Times New Roman, monochrome filing format.

Consolidated P&L ($mm)20272028
Revenue$40.0$50.0
Cost of sales(18.0)(22.5)
Profit for the year$7.9$7.3
J-GAAPb.styles.japanese

Ordinary income (経常利益), goodwill amortization in consolidated books, positive expenses subtracted, and △ negative marks.

損益計算書 (百万円)20272028
売上高4,0005,000
売上原価1,8002,250
当期純利益790731
Get started

Your first three-statement model in five minutes.

  1. Install boki[excel] (zero required dependencies for core Python modeling).
  2. Declare a timeline, an entity, and your business drivers.
  3. Render statements, assert checks, and export a live-formula .xlsx workbook.
$ uv add "boki[excel]"
$ python examples/ib_lbo/plan.py out/
$ open out/apex_lbo.xlsx

  Inputs · Transaction · Debt · IS · BS · CF
  Returns (Exit Bridge + Live 2D Sensitivities) · Checks
Documentation

Docs