This repository contains quantitative models and analysis tools developed during the Forage JPMorgan Chase Job Simulation. The project focuses on two primary financial domains: credit risk modeling for retail banking and commodity pricing for natural gas storage contracts.
This module predicts the probability of default for personal loan borrowers to estimate potential financial losses.
- Core Script:
credit_risk_model.pybuilds and evaluates multiple machine learning models, including Logistic Regression, Random Forest, and Gradient Boosting, to identify high risk profiles. - FICO Quantization:
fico_quantization.pyimplements optimal binning of FICO scores using Mean Squared Error (MSE) minimization and Log-Likelihood maximization through dynamic programming to maximize information about default probability. - Rating Assignment:
fico_rating_assignment.pyprovides a utility to map FICO scores to discrete credit ratings (1 to 5) and risk profiles, ranging from "Excellent" to "Very Poor" based on historical default rates. - Feature Engineering: Includes custom logic for Debt-to-Income (DTI) ratios, FICO score binning, and employment stability indicators.
- Calculator:
expected_loss_calculator.pyprovides a production-ready interface to calculate Expected Loss (EL) using the standard formula:EL = PD x EAD x LGD. - Analytics: Generates comprehensive risk distributions, feature importance plots, and ROC curves to compare model performance.
This module analyzes historical natural gas price trends and prices complex storage contracts using seasonal arbitrage strategies.
- Price Forecasting:
nat_gas_analysis.pyfits a seasonal model using linear trends and sinusoidal patterns to estimate prices for any future date. - Storage Valuation:
pricing-model.pycalculates the value of storage contracts by modeling the revenue from sales minus costs for storage rental, injection, withdrawal, and transportation. - Trading Interface:
quick_pricer.pyserves as a simplified script for a trading desk to evaluate specific contract scenarios and return a recommendation.
- Language: Python 3.x
- Data Science: Pandas, NumPy, Scikit-learn
- Optimization: SciPy (Curve Fitting)
- Visualization: Matplotlib, Seaborn
credit_risk_model.py: Main model training and evaluation script.fico_quantization.py: Module for finding optimal FICO score bucket boundaries.fico_rating_assignment.py: Helper script for assigning credit ratings to individual scores.expected_loss_calculator.py: Interface for individual and portfolio loss estimation.nat_gas_analysis.py: Historical price modeling and forecasting.pricing-model.py: Core logic for storage contract valuation.quick_pricer.py: Simplified tool for rapid contract pricing.
- Ensure
Loan_Data.csvandNat_Gas.csvare available in the project directory. - Run
credit_risk_model.pyto train the risk model and export the serialized calculator. - Run
fico_quantization.pyto determine optimal FICO score buckets for the portfolio. - Execute
nat_gas_analysis.pyto view price trends and seasonal extrapolations. - Use
quick_pricer.pyto value a sample natural gas storage contract with custom parameters.
The models generate automated charts to provide financial insights:
- Credit Analysis: Default rates segmented by FICO and income levels.
- Quantization Analysis: Comparison of MSE and Log-Likelihood binning methods for FICO scores.
- Commodity Trends: Historical prices versus fitted seasonal models with one year extrapolations.
Developed by Alex Lin as part of the Forage JPMorgan Chase Quantitative Research program.