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version: 4.0.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
tags:
|
| 12 |
+
- actuarial
|
| 13 |
+
- finance
|
| 14 |
+
- stochastic-models
|
| 15 |
+
- monte-carlo
|
| 16 |
+
- interest-rates
|
| 17 |
+
- quantitative-finance
|
| 18 |
+
- gradio
|
| 19 |
+
- dashboard
|
| 20 |
+
- hull-white
|
| 21 |
+
- risk-management
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# π Hull-White Interest Rate Model Dashboard
|
| 25 |
+
|
| 26 |
+
An interactive web dashboard for exploring the Hull-White short rate model, designed specifically for actuaries and financial professionals.
|
| 27 |
+
|
| 28 |
+
[](https://huggingface.co/spaces/alidenewade/hull-white-simulator)
|
| 29 |
+
|
| 30 |
+
## π― Overview
|
| 31 |
+
|
| 32 |
+
The Hull-White model is a widely-used short rate model in quantitative finance, particularly valuable for:
|
| 33 |
+
- **Interest rate derivatives pricing**
|
| 34 |
+
- **Risk management and ALM**
|
| 35 |
+
- **Solvency II capital calculations**
|
| 36 |
+
- **Insurance liability valuation**
|
| 37 |
+
|
| 38 |
+
This dashboard provides an intuitive interface to explore the model's behavior through Monte Carlo simulations.
|
| 39 |
+
|
| 40 |
+
## π Model Description
|
| 41 |
+
|
| 42 |
+
The Hull-White model follows the stochastic differential equation:
|
| 43 |
+
|
| 44 |
+
dr(t) = (ΞΈ(t) - ar(t))dt + ΟdW
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
Where:
|
| 48 |
+
- `r(t)` = instantaneous short rate at time t
|
| 49 |
+
- `a` = mean reversion speed parameter
|
| 50 |
+
- `Ο` = volatility parameter
|
| 51 |
+
- `ΞΈ(t)` = time-dependent drift function
|
| 52 |
+
- `dW` = Wiener process increment
|
| 53 |
+
|
| 54 |
+
## π Features
|
| 55 |
+
|
| 56 |
+
### Interactive Visualizations
|
| 57 |
+
- **π Short Rate Paths**: Visualize multiple simulated interest rate trajectories
|
| 58 |
+
- **π Mean Convergence**: Compare Monte Carlo means against theoretical expectations
|
| 59 |
+
- **π Variance Analysis**: Examine variance convergence properties
|
| 60 |
+
- **π° Discount Factors**: Analyze zero-coupon bond pricing convergence
|
| 61 |
+
- **π Parameter Sensitivity**: Study the critical Ο/a ratio effects
|
| 62 |
+
- **π Statistics Table**: Summary statistics at key time points
|
| 63 |
+
|
| 64 |
+
### Adjustable Parameters
|
| 65 |
+
| Parameter | Range | Description |
|
| 66 |
+
|-----------|-------|-------------|
|
| 67 |
+
| Scenarios | 100 - 10,000 | Number of Monte Carlo paths |
|
| 68 |
+
| Time Horizon | 5 - 50 years | Simulation time length |
|
| 69 |
+
| Time Steps | 100 - 500 | Discretization granularity |
|
| 70 |
+
| Mean Reversion (a) | 0.01 - 0.5 | Speed of mean reversion |
|
| 71 |
+
| Volatility (Ο) | 0.01 - 0.3 | Interest rate volatility |
|
| 72 |
+
| Initial Rate (rβ) | 0.01 - 0.15 | Starting interest rate |
|
| 73 |
+
|
| 74 |
+
## ποΈ How to Use
|
| 75 |
+
|
| 76 |
+
1. **Adjust Model Parameters**: Use the sliders in the left panel to modify Hull-White parameters
|
| 77 |
+
2. **Explore Visualizations**: Click through the tabs to see different aspects of the model
|
| 78 |
+
3. **Analyze Convergence**: Pay special attention to the Ο/a ratio - values > 1 show poor convergence
|
| 79 |
+
4. **Compare Theory vs Practice**: Observe how simulated results converge to theoretical expectations
|
| 80 |
+
5. **Generate Statistics**: Review the summary table for quantitative analysis
|
| 81 |
+
|
| 82 |
+
## π Key Insights
|
| 83 |
+
|
| 84 |
+
### Convergence Properties
|
| 85 |
+
- **Ο/a < 1**: Good Monte Carlo convergence
|
| 86 |
+
- **Ο/a β 1**: Moderate convergence issues
|
| 87 |
+
- **Ο/a > 1**: Poor convergence, especially for discount factors
|
| 88 |
+
|
| 89 |
+
### Practical Considerations
|
| 90 |
+
- **More scenarios** improve convergence but increase computation time
|
| 91 |
+
- **Higher volatility** requires more scenarios for stable results
|
| 92 |
+
- **Longer time horizons** show more pronounced convergence issues
|
| 93 |
+
|
| 94 |
+
## π§ Technical Implementation
|
| 95 |
+
|
| 96 |
+
### Model Features
|
| 97 |
+
- **Gaussian Process**: Exploits Hull-White's analytical properties
|
| 98 |
+
- **Conditional Moments**: Uses exact conditional mean and variance formulas
|
| 99 |
+
- **Vector Operations**: Efficient numpy-based simulations
|
| 100 |
+
- **Reproducible Results**: Fixed random seed for consistency
|
| 101 |
+
|
| 102 |
+
### Performance Optimized
|
| 103 |
+
- Real-time parameter updates
|
| 104 |
+
- Efficient matrix operations
|
| 105 |
+
- Responsive visualization updates
|
| 106 |
+
- Memory-efficient data handling
|
| 107 |
+
|
| 108 |
+
## π Educational Value
|
| 109 |
+
|
| 110 |
+
Perfect for:
|
| 111 |
+
- **University Finance Courses**: Teaching stochastic interest rate models
|
| 112 |
+
- **Actuarial Training**: Understanding ALM and risk management
|
| 113 |
+
- **Professional Development**: Exploring quantitative finance concepts
|
| 114 |
+
- **Model Validation**: Testing parameter sensitivity and convergence
|
| 115 |
+
|
| 116 |
+
## π Theoretical Background
|
| 117 |
+
|
| 118 |
+
The implementation follows established literature:
|
| 119 |
+
- **Brigo & Mercurio**: Interest Rate Models - Theory and Practice
|
| 120 |
+
- **Glasserman**: Monte Carlo Methods in Financial Engineering
|
| 121 |
+
- **Hull**: Options, Futures, and Other Derivatives
|
| 122 |
+
|
| 123 |
+
### Key Mathematical Properties
|
| 124 |
+
- **Mean**: E[r(t)|β±β] = r(s)e^(-a(t-s)) + Ξ±(t) - Ξ±(s)e^(-a(t-s))
|
| 125 |
+
- **Variance**: Var[r(t)|β±β] = (ΟΒ²/2a)(1 - e^(-2a(t-s)))
|
| 126 |
+
- **Alpha Function**: Ξ±(t) = f^M(0,t) + (ΟΒ²/2aΒ²)(1-e^(-at))Β²
|
| 127 |
+
|
| 128 |
+
## π οΈ Installation & Deployment
|
| 129 |
+
|
| 130 |
+
### Local Development
|
| 131 |
+
```bash
|
| 132 |
+
# Clone the repository
|
| 133 |
+
git clone https://github.com/YOUR-USERNAME/hull-white-dashboard.git
|
| 134 |
+
cd hull-white-dashboard
|
| 135 |
+
|
| 136 |
+
# Install dependencies
|
| 137 |
+
pip install -r requirements.txt
|
| 138 |
+
|
| 139 |
+
# Run the application
|
| 140 |
+
python app.py
|