⚠️ Deprecation notice
This repository is a legacy version of the SN-Rating-Model and is kept for historical and reference purposes only.
It is deprecated and not aligned with the latest model design, configuration or documentation.
For any new work, please use the repository:
(https://github.com/snlabs-tech/SN-Rating-Model)
This repository contains a rule-based corporate credit rating engine for non-financial corporates.
The model is built around:
- Multi-period financial statements
- Altman Z-score
- Peer benchmarking
- Optional distress hardstops
- Optional sovereign cap
It is designed as a transparent, documentation-heavy reference implementation, rather than a black-box machine learning model.
- High-level README: 00_README.md
- Methodology overview: 1_Methodology_Overview.md
- Quantitative factors and ratios: 2_Quantitative_Factors_and_Ratio_Definitions.md
- Qualitative factors and scales: 3_Qualitative_Factors_and_Scale_Definitions.md
- Hardstop workflow: 4_Hardstop_Rating_Workflow.md
- Sovereign cap workflow: 5_Sovereign_Cap_Workflow.md
- Outlook workflow: 6_Corporate_Rating_Outlook_Workflow.md
git clone https://github.com/snlabs-tech/SN-Corporate-Rating-Model-V2.git
cd SN-Corporate-Rating-Model-V2Open in Jupyter Notebook or VS Code:
7_corporate_rating_model_V2.ipynb
Then run:
- Menu: Kernel → Restart & Run All
Inspect the sample outputs:
- Intermediate scores
- Hardstops
- Sovereign cap
- Final rating
- Rating outlook
From the repository root (the main folder with this README.md), run:
python rating_model_V2_demo.pyThis script uses sample financials and qualitative factors to compute a full issuer rating and prints the key outputs to the console.
For a detailed explanation of the implementation, see:
- Notebook:
7_corporate_rating_model_V2.ipynb - Code walkthrough document:
8_rating_model_V2_code_walkthrough.docx
This project uses pytest. To run the test suite:
pytestEarlier versions of the model treated all ratios where the issuer was below the peer average as underperformance. For leverage ratios where lower values are better (e.g. debt_ebitda, net_debt_ebitda, debt_equity, debt_capital), this was incorrect.
The current implementation uses the LOWER_BETTER_RATIOS set in
sn_rating_v2/config.py together with the updated compute_peer_score in
sn_rating_v2/helpers.py to respect the direction of each ratio in peer
comparison. Only the peer positioning component is affected; the core ratio
grids and distress logic are unchanged.