corp-finance-core 1.1.0

Institutional-grade corporate finance calculations with 128-bit decimal precision — DCF, WACC, comps, LBO, credit metrics, derivatives, fixed income, options, and 60+ specialty modules. No f64 in financials. WASM-compatible.
Documentation

corp-finance-core

Institutional-grade corporate finance calculations as a Rust library. Decimal precision throughout — no f64 in financials. WASM-compatible.

What's in the box

  • Valuation: DCF, WACC (CAPM build-up, Hamada re-levering), trading comparables, sum-of-the-parts, multi-method target price.
  • Credit: leverage / coverage / DSCR metrics with synthetic rating; debt capacity; covenant compliance with breach scenarios; Altman Z-Score (original / Z' / Z''); Merton structural model + KMV-EDF; intensity model; PD calibration.
  • PE / M&A: full LBO with multi-tranche debt + cash sweep; sources & uses; debt schedules; GP/LP waterfall (European + American); merger accretion / dilution; IRR / MOIC / cash-on-cash.
  • Portfolio analytics: Sharpe / Sortino / Treynor / Information Ratio; VaR / CVaR (parametric, historical, Monte Carlo); Kelly sizing; mean-variance optimisation; Black-Litterman; risk parity; factor models; performance attribution (Brinson-Fachler, factor-based).
  • Fixed income: bond pricing (clean / dirty / accrued), YTM / BEY / effective yield, duration / convexity / DV01 / key-rate, Nelson-Siegel-Svensson curve fitting, spot-curve bootstrap, credit spreads (I / G / Z), CDS pricing, CVA.
  • Derivatives: Black-Scholes + binomial option pricing with Greeks; implied vol; forwards / futures with cost-of-carry; basis analysis; interest-rate + currency swaps; option strategies; SABR calibration; volatility surface.
  • Three-statement modelling: linked income statement, balance sheet, cash flow with circular-reference resolution for interest expense.
  • Specialty modules: jurisdiction (offshore / onshore fund structures, withholding tax, NAV, GP economics, UBTI), insurance (loss reserving, premium pricing, Solvency II SCR), bank analytics (NIM, CAMELS, CECL, deposit beta, loan book), regulatory (Basel III, LCR, NSFR, ALM), ESG (scoring, climate, green bonds, SLL), carbon markets (credit pricing, ETS, CBAM, offsets, shadow carbon price), macro economics (Taylor rule, Phillips curve, Okun's law, recession risk, PPP, IRP), private credit (unitranche, direct lending, syndication), private wealth (concentrated stock, philanthropic vehicles, wealth transfer, direct indexing, family governance), and 30+ more.

70+ Rust modules, 277 entry-point functions, all gated behind cargo features so you only compile what you need.

Quick start

[dependencies]
corp-finance-core = { version = "1", features = ["valuation", "credit"] }
use corp_finance_core::credit::metrics::{calculate_credit_metrics, CreditMetricsInput};
use rust_decimal_macros::dec;

let input = CreditMetricsInput {
    revenue: dec!(185_000_000),
    ebitda: dec!(59_000_000),
    ebit: dec!(55_000_000),
    interest_expense: dec!(8_000_000),
    depreciation_amortisation: dec!(4_000_000),
    total_debt: dec!(250_000_000),
    cash: dec!(20_000_000),
    total_assets: dec!(400_000_000),
    current_assets: dec!(85_000_000),
    current_liabilities: dec!(55_000_000),
    total_equity: dec!(120_000_000),
    retained_earnings: dec!(80_000_000),
    working_capital: dec!(30_000_000),
    operating_cash_flow: dec!(48_000_000),
    capex: dec!(10_000_000),
    funds_from_operations: None,
    lease_payments: None,
    market_cap: None,
    preferred_dividends: None,
};

let result = calculate_credit_metrics(&input).unwrap();
// result.implied_rating == CreditRating::BB
// result.net_debt_to_ebitda == dec!(3.8983050847457627118644067797)
// result.interest_coverage == dec!(7.375)

Cargo features

default = ["valuation", "credit"]. Other features (opt-in): pe, ma, portfolio, fixed_income, derivatives, three_statement, jurisdiction, quant_risk, restructuring, real_assets, fx_commodities, securitization, venture, esg, regulatory, insurance, private_credit, fpa, wealth, crypto, trade_finance, structured_products, municipal, credit_derivatives, convertibles, lease_accounting, pension, sovereign, real_options, equity_research, commodity_trading, quant_strategies, treasury, infrastructure, behavioral, performance_attribution, credit_portfolio, macro_economics, compliance, onshore_structures, offshore_structures, transfer_pricing, tax_treaty, fatca_crs, substance_requirements, regulatory_reporting, aml_compliance, volatility_surface, portfolio_optimization, risk_budgeting, market_microstructure, interest_rate_models, mortgage_analytics, inflation_linked, repo_financing, credit_scoring, capital_allocation, clo_analytics, fund_of_funds, earnings_quality, dividend_policy, carbon_markets, bank_analytics, private_wealth, emerging_markets, index_construction, financial_forensics, institutional_real_estate, monte_carlo, scenarios, managed_agent, memory, audit, cost, observability, security, multi_agent, federation, self_learning. Use full to enable everything.

Decimal precision

All financial math uses rust_decimal::Decimal (128-bit). The only f64 in the codebase is the documented exception inside the office xlsx writer (Excel cell boundary) and Monte Carlo simulators. Iterative solvers (Newton-Raphson YTM, IRR, Hamada re-levering) work in Decimal end-to-end.

License

MIT © 2026 Robert Fall.