Memo·Conceptual outline · implementation in progress
Investment·Case Study 02
Case Study 02 · Credit Analysis · Random Forest · ETL · PostgreSQL
The Systematic Credit Risk Screener
Traditional debt advisory relies on analysts manually reading balance sheets to assess whether a company is approaching a . This project automates that process: an ETL pipeline feeds corporate fundamentals into Postgres, and a classifier estimates the 12-month probability of downgrade from ratios alone.
The Travel Industry Connection
No sector better illustrates credit risk than travel. Hotels, airlines, cruise lines, and tour operators carry structural leverage: aircraft, ships, and long-term leases are capital-intensive. In 2020, Carnival Corporation's fell below 0.2× as revenues collapsed. S&P cut it from BBB to BB+ (junk) in March 2020, triggering forced selling across institutional bond portfolios.
A systematic screener applied to this universe would have flagged the deteriorating Net Debt/EBITDA trend across cruise lines as early as Q4 2019, two quarters before the downgrade cascade. The analysis universe below reflects the issuers most relevant to the travel and hospitality sector.
Analysis Universe · Travel & Hospitality Issuers
CCL
Carnival Corporation
Cruise Lines
RCL
Royal Caribbean Group
Cruise Lines
MAR
Marriott International
Hotels
HLT
Hilton Worldwide
Hotels
DAL
Delta Air Lines
Airlines
IAG
Intl Airlines Group
Airlines
TUI
TUI AG
Tour Operators
BKNG
Booking Holdings
OTAs
The Method
Classification
The model is a supervised binary classifier. Each observation is a company × quarter snapshot: a vector of ratios at time t, paired with a binary label: did this company receive a downgrade in the following four quarters?
A of 500 trees is trained on the historical feature matrix. Model quality is evaluated using , which is threshold-agnostic and robust to class imbalance, critical since only ~8% of company-quarters end in a downgrade event.
P(downgrade) = (1/T) Σ hₜ(x)
T = 500 trees; hₜ(x) = individual tree probability for company x
Temporal CV: train[Q1…Qₙ] → test[Qₙ₊₁…Qₙ₊₄]
future quarters never enter the training window
ETL Pipeline
Ingest
Python · psycopg2
Pull quarterly fundamentals from Compustat/Simfin API. Load into Postgres with a company × quarter schema.
Feature Engineering
pandas · SQLAlchemy
Compute ratios: Net Debt/EBITDA, Interest Coverage, Current Ratio, FCF Yield, YoY revenue delta. Lag by one quarter to avoid look-ahead bias.
Label Generation
S&P / Moody's history
Binary target: did this issuer receive a rating downgrade within the next four quarters? Source: historical rating change files.
Train / Test Split
scikit-learn · TimeSeriesSplit
Temporal cross-validation: future quarters are never in the training window. Prevents the model from learning from the future.
Random Forest
scikit-learn · SHAP
500-tree ensemble with class-weight balancing (downgrades are rare ~8% of observations). SHAP values explain each prediction.
Output
Postgres · REST API
Predicted downgrade probability per issuer per quarter. Exposed via FastAPI endpoint for dashboard consumption.
Feature Set
| Feature | Formula | SHAP Importance |
|---|---|---|
| Interest Coverage Ratio | EBIT / Interest Expense | High |
| Net Debt / EBITDA | Net Debt / EBITDA | High |
| Current Ratio | Current Assets / Current Liab. | Medium |
| FCF Yield | FCF / Market Cap | Medium |
| Revenue YoY Delta | (Revₜ − Revₜ₋₄) / Revₜ₋₄ | Medium |
| Debt / Equity | Total Debt / Shareholders Equity | Low |
Planned Model Metrics
~0.81
vs. 0.5 for random baseline
72%
Precision at p > 0.6
72% of flagged companies actually downgraded
68%
Recall at p > 0.6
68% of true downgrades captured
8%
Base rate (downgrades)
class imbalance addressed via weighting
Conclusion
Balance sheets are structured data. Downgrades are a classification problem.
Rating agencies are slow; they lag the market by design. A systematic screener built on quarterly fundamentals can identify deteriorating one to two quarters before the formal downgrade, providing an actionable lead time for credit investors to reduce exposure or hedge.
For travel-sector debt in particular, where cash flows are violently cyclical and leverage ratios swing from prudent to distressed across a single quarter, the systematic approach removes analyst subjectivity from the decision entirely.
The signal is in the ratios. The edge is in reading them before the agencies do.