Skip to content

snlabs-tech/SN-Corporate-Rating-Model-V2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

220 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ 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)

SN Corporate Rating Model V2

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.


📌 Start Here


🚀 Quickstart (5 Minutes)

1. Clone this repository:

git clone https://github.com/snlabs-tech/SN-Corporate-Rating-Model-V2.git
cd SN-Corporate-Rating-Model-V2

2. Open the main notebook

Open 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

3. Run the script demo (optional)

From the repository root (the main folder with this README.md), run:

python rating_model_V2_demo.py

This script uses sample financials and qualitative factors to compute a full issuer rating and prints the key outputs to the console.


Code Walkthrough

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

Testing

This project uses pytest. To run the test suite:

pytest

Bugfixes and changes

Peer positioning for lower-is-better ratios

Earlier 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.

About

Corporate credit rating model (V2) — multi‑period, rule‑based engine with Altman Z, peer benchmarking, distress optional hardstops, and optional sovereign cap.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors