Production-ready financial analysis toolkit providing ratio analysis, DCF valuation, budget variance analysis, and rolling forecast construction. Designed for financial modeling, forecasting & budgeting, management reporting, business performance analysis, and investment analysis.
scripts/ratio_calculator.py)Calculate and interpret financial ratios from financial statement data.
Ratio Categories:
python scripts/ratio_calculator.py sample_financial_data.json
python scripts/ratio_calculator.py sample_financial_data.json --format json
python scripts/ratio_calculator.py sample_financial_data.json --category profitability
scripts/dcf_valuation.py)Discounted Cash Flow enterprise and equity valuation with sensitivity analysis.
Features:
python scripts/dcf_valuation.py valuation_data.json
python scripts/dcf_valuation.py valuation_data.json --format json
python scripts/dcf_valuation.py valuation_data.json --projection-years 7
scripts/budget_variance_analyzer.py)Analyze actual vs budget vs prior year performance with materiality filtering.
Features:
python scripts/budget_variance_analyzer.py budget_data.json
python scripts/budget_variance_analyzer.py budget_data.json --format json
python scripts/budget_variance_analyzer.py budget_data.json --threshold-pct 5 --threshold-amt 25000
scripts/forecast_builder.py)Driver-based revenue forecasting with rolling cash flow projection and scenario modeling.
Features:
python scripts/forecast_builder.py forecast_data.json
python scripts/forecast_builder.py forecast_data.json --format json
python scripts/forecast_builder.py forecast_data.json --scenarios base,bull,bear
scripts/monte_carlo_simulator.py)Run N iterations (default 1000) with randomized assumptions to produce probability distributions for NPV, IRR, and payback period.
Features:
python scripts/monte_carlo_simulator.py simulation_data.json
python scripts/monte_carlo_simulator.py simulation_data.json --iterations 5000
python scripts/monte_carlo_simulator.py simulation_data.json --format json
python scripts/monte_carlo_simulator.py simulation_data.json --seed 42
scripts/project_payback.py)单项目投资回收分析——回答"投多少、多久回本、之后赚多少"。
Features:
python scripts/project_payback.py project_data.json
python scripts/project_payback.py project_data.json --format json
python scripts/project_payback.py project_data.json --months 60
Go/No-Go信号灯逻辑:
scripts/assumption_flip_test.py)假设翻转测试——逐一压力测试每个假设,找到"致命假设"(恶化≤30%就翻转结论的那个)。
Features:
python scripts/assumption_flip_test.py project_data.json
python scripts/assumption_flip_test.py project_data.json --format json
python scripts/assumption_flip_test.py project_data.json --stress 0.3
Input format:
{
"initial_investment": 2000000,
"projection_months": 36,
"assumptions": {
"monthly_revenue": {"min": 30000, "base": 50000, "max": 80000},
"monthly_cost": {"min": 15000, "base": 25000, "max": 40000},
"growth_rate_monthly": {"min": 0.01, "base": 0.03, "max": 0.06},
"churn_rate_monthly": {"min": 0.01, "base": 0.03, "max": 0.05}
},
"discount_rate_annual": 0.10
}
scripts/excel_exporter.py)Export any analysis result to a structured, McKinsey-styled Excel workbook (.xlsx) for investment committee review.
Features:
Dependency: openpyxl (optional — falls back to CSV if not available)
# Install openpyxl for full Excel support
pip install openpyxl
# Export DCF results
python scripts/excel_exporter.py dcf_results.json --output valuation_report.xlsx --type dcf
# Export Monte Carlo results
python scripts/excel_exporter.py mc_results.json --output risk_analysis.xlsx --type montecarlo
# Export forecast
python scripts/excel_exporter.py forecast_results.json --output forecast.xlsx --type forecast
# Fallback to CSV (no openpyxl needed)
python scripts/excel_exporter.py results.json --output report.csv --fallback-csv
| Reference | Purpose |
|---|---|
| ----------- | --------- |
references/financial-ratios-guide.md | Ratio formulas, interpretation, industry benchmarks |
references/valuation-methodology.md | DCF methodology, WACC, terminal value, comps |
references/forecasting-best-practices.md | Driver-based forecasting, rolling forecasts, accuracy |
references/industry-adaptations.md | Sector-specific metrics and considerations (SaaS, Retail, Manufacturing, Financial Services, Healthcare) |
references/china-market-guide.md | 中国市场默认参数、叙事层翻译规则、竞品对标速查表 |
当分析对象为中国企业/项目时,自动加载 references/china-market-guide.md,并应用以下默认行为:
| Template | Purpose |
|---|---|
| ---------- | --------- |
assets/variance_report_template.md | Budget variance report template |
assets/dcf_analysis_template.md | DCF valuation analysis template |
assets/forecast_report_template.md | Revenue forecast report template |
| Metric | Target |
|---|---|
| -------- | -------- |
| Forecast accuracy (revenue) | +/-5% |
| Forecast accuracy (expenses) | +/-3% |
| Report delivery | 100% on time |
| Model documentation | Complete for all assumptions |
| Variance explanation | 100% of material variances |
All scripts accept JSON input files. See assets/sample_financial_data.json for the complete input schema covering all four tools.
Core tools (Tools 1-5): Python standard library only (math, statistics, json, argparse, datetime, random). No numpy, pandas, or scipy required.
Excel Exporter (Tool 6): Requires openpyxl for .xlsx output. Falls back to CSV export if openpyxl is not installed.
# Optional: install for Excel export
pip install openpyxl
共 1 个版本