Python implementation of ISDA Standard Initial Margin Model (ISDA SIMM) v2.3-2.6 for calculating initial margin of uncleared OTC derivatives, with AADC integration for automatic sensitivity computation and gradient-based margin optimization.
Based on the official ISDA SIMM Methodology.
- SIMM Calculation: Full ISDA SIMM v2.6 aggregation (Delta, Vega, Curvature, BaseCorr)
- AADC Integration: 30-50x speedup via automatic adjoint differentiation
- Trade Allocation Optimization: Gradient-based netting set optimization (10-30% IM reduction)
- Stress Margin Analysis: 7 predefined stress scenarios
- Pre-Trade Analytics: Marginal IM, bilateral vs cleared comparison, counterparty routing
- What-If Analysis: Real-time margin impact for add/remove/hedge scenarios
- Multi-Asset: IR swaps, FX options, equity options, inflation swaps, cross-currency swaps
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtFor GPU benchmarks:
pip install -r requirements_gpu.txtPlace your CRIF file in the CRIF/ directory and run:
python -m model.simm_baseline --trades 100 --threads 4python -m model.simm_aadc --trades 1000 --threads 8python -m model.simm_portfolio_aadc \
--trades 100 --portfolios 5 --threads 8 \
--optimize --method gradient_descentpython benchmark_simm.py --trades 1000 --threads 8ISDA-SIMM/
├── model/ # Trade models and SIMM implementations
│ ├── simm_baseline.py # NumPy baseline (bump-and-revalue)
│ ├── simm_aadc.py # AADC-enabled implementation
│ ├── simm_common.py # Shared SIMM logic
│ ├── simm_portfolio_aadc.py # Portfolio-level AADC calculations
│ ├── simm_allocation_optimizer.py # Trade allocation optimization
│ └── trade_types.py # Trade definitions and pricing
├── src/ # Core SIMM calculation engine
│ ├── agg_margins.py # Top-level SIMM aggregation
│ ├── margin_risk_class.py # Risk class margin calculations
│ ├── agg_sensitivities.py # Sensitivity aggregation
│ └── wnc.py # Weights and correlations loader
├── common/ # Configuration, logging, utilities
├── benchmark/ # Benchmarking framework (CPU vs GPU)
├── tests/ # Test suite
├── scripts/ # Benchmark and utility scripts
├── Weights_and_Corr/ # SIMM calibration parameters (v2.3-v2.7)
├── CRIF/ # Input CRIF data
├── visualization/ # Interactive optimization demo
├── docs/ # Technical documentation
├── data/ # Output data (execution logs, CRIF samples)
└── benchmark_simm.py # Main benchmark runner
| Implementation | 1000 Trades | Speedup |
|---|---|---|
| Baseline (NumPy) | ~45s | 1.0x |
| AADC Python | ~2s | ~20x |
| SIMM Total | Product Class | Risk Class | Risk Measure | SIMM |
|---|---|---|---|---|
| 16,111,268,937 | RatesFX | Rates | Delta | 759,108,218 |
| Curvature | 1,947 | |||
| FX | Delta | 11,926,343 | ||
| Credit | CreditQ | Delta | 3,922,360,448 | |
| CreditNonQ | Delta | 11,472,297,989 | ||
| Equity | Equity | Delta | 158,843,566 | |
| Commodity | Commodity | Delta | 171,187,064 |
If you intend to implement this for any commercial purpose, reach out to ISDA SIMM to obtain a proper license. See ISDA SIMM Licensing FAQ.