A comprehensive FRTB (Fundamental Review of the Trading Book) Calculator built for MP Capital's risk management operations. This application calculates market risk capital requirements for banks and financial institutions according to the Basel III FRTB framework using the Simplified Standardized Approach.
This professional-grade financial risk management tool helps calculate regulatory capital requirements across multiple asset classes with comprehensive derivative product coverage:
- Equities - Cash equities, indices, ETFs, equity options, futures, and swaps
 - Fixed Income - Government bonds, corporate bonds, MBS, interest rate derivatives, bond futures
 - Foreign Exchange - Spot FX, forwards, options, futures, and exotic derivatives
 - Commodities - Energy, metals, agricultural products, and commodity derivatives
 
- Credit Derivatives - Credit default swaps, credit indices, structured credit products
 - Alternative Investments - Real estate, private equity, hedge funds, infrastructure
 - Volatility Derivatives - VIX products, variance swaps, volatility indices
 - Structured Products - Equity-linked, interest rate-linked, currency-linked notes
 
- Delta Risk: Linear price risk from underlying asset movements
 - Vega Risk: Risk from volatility changes
 - Curvature Risk: Non-linear price risk (gamma effects)
 - Basel III Compliance: Uses official risk weights and correlation factors
 
- MP Capital Branding: Custom styling with company colors and fonts
 - Results Dashboard: Comprehensive risk visualization
 - Input Methods: Manual forms, Excel upload, sample data
 - Historical Risk Tracking: Date-stamped uploads with trend analysis and statistical significance testing
 - Excel Upload & Validation: Professional-grade file processing with:
- Drag-and-drop interface
 - Comprehensive data validation and reconciliation
 - Detailed error and warning reporting
 - Format examples for all asset classes
 - Excel template download with sample data
 - Step-by-step processing workflow
 
 - Responsive Design: Works on desktop and mobile devices
 
/: Results dashboard with pre-calculated sample data/input: Data input interface with multiple input methods/excel-upload: Professional Excel upload with validation and reconciliation/counterparty: Counterparty risk aggregation analysis/architecture: System architecture and UML diagrams/regulatory: Basel III FRTB regulatory factors and risk weights/instruments: Comprehensive instrument hierarchy management with derivative products/reports: Historical risk analysis and trend monitoring with statistical significance testing
POST /api/calculate: Performs FRTB calculationsGET /api/sample-data: Returns sample trading book dataPOST /api/counterparty-aggregation: Calculates counterparty risk aggregationPOST /api/validate-excel: Validates uploaded Excel data with comprehensive error reporting
├── backend/
│   └── index.ts              # Hono API server with HTTP trigger
├── frontend/
│   ├── index.html            # Results dashboard
│   └── input.html            # Data input interface
├── shared/
│   └── frtb-calculator.ts    # Core calculation engine
└── README.md
With pre-loaded sample data:
- Total Capital Requirement: ~$4.35 million
 - Risk-Weighted Assets: ~$54.3 million
 - Asset Class Breakdown:
- Fixed Income: $2.9M (largest risk component)
 - FX: $518K
 - Commodities: $475K
 - Equities: $455K
 
 
- Primary: 
#1a365d(Deep Navy) - Secondary: 
#2d5a87(Medium Blue) - Accent: 
#4a90b8(Light Blue) 
- Font: Inter (Google Fonts)
 - Weights: 300, 400, 500, 600, 700
 
- Backend: Hono.js framework
 - Frontend: Vanilla HTML/CSS/JavaScript
 - Styling: TailwindCSS + Custom MP Capital theme
 - File Handling: SheetJS for Excel processing
 - Deployment: Val Town serverless platform
 
This calculator implements:
- Basel III FRTB Simplified Standardized Approach
 - Official risk weights for all asset classes
 - Correlation adjustments and stress scenarios
 - Proper risk aggregation methodologies
 - Transparent calculations with detailed explanations
 
- Access the Application: Navigate to the main URL
 - View Results: See pre-calculated sample results on the dashboard
 - Input Data: Use 
/inputto enter your own trading book positions - Excel Upload: Use 
/excel-uploadfor professional file processing with:- Template Download: Get pre-configured Excel template
 - Format Validation: Comprehensive data quality checks
 - Error Reconciliation: Detailed reporting of data issues
 - Step-by-step Process: Upload → Validate → Calculate workflow
 
 - Multiple Input Methods:
- Manual form entry
 - Excel file upload (with template)
 - Load sample data for testing
 
 
The application features comprehensive historical risk tracking and statistical analysis:
- Date-Stamped Uploads: Each Excel upload includes trading date and optional description
 - Historical Data Storage: Automatic storage of all FRTB calculations with timestamps
 - Trend Visualization: Interactive charts showing risk evolution over time
 - Statistical Significance Testing: Advanced statistical methods to detect significant risk jumps
 - Asset Class Breakdown: Separate trend analysis for each asset class
 - Alert System: Automated detection of unusual risk movements
 
The system uses a sophisticated statistical approach to identify significant risk changes:
- Rolling Window: 30-day rolling mean and standard deviation calculation
 - Z-Score Calculation: Z = (Current Value - Rolling Mean) / Rolling Std Dev
 - Significance Thresholds:
- High Alert: |Z| > 2.5 (99.4% confidence)
 - Medium Alert: |Z| > 2.0 (95.4% confidence)
 - Low Alert: |Z| > 1.5 (86.6% confidence)
 
 - Jump Detection: Identifies consecutive increases/decreases with statistical significance
 - Adaptive Analysis: Rolling statistics adapt to changing market conditions
 
- Summary Statistics: Total data points, latest risk values, trend indicators
 - Interactive Charts: Clickable data points with detailed tooltips
 - Historical Data Table: Sortable table with all historical calculations
 - Significant Events: Highlighted periods of unusual risk activity
 - Export Capabilities: View detailed results for any historical date
 
The application features a comprehensive Excel upload system designed for professional trading book management:
- Drag-and-Drop Interface: Modern file upload with visual feedback
 - Template Download: Pre-configured Excel template with sample data
 - Multi-Sheet Support: Separate sheets for Equities, Fixed Income, FX, and Commodities
 - Data Validation: Comprehensive validation with detailed error reporting
 - Format Examples: Clear visual examples for all required data formats
 - Reconciliation Reports: Detailed analysis of data quality issues
 
Each asset class requires a separate sheet with specific columns:
Equities Sheet:
- Counterparty, Instrument, Notional, Delta, Vega, Curvature
 
Fixed Income Sheet:
- Counterparty, Instrument, Notional, Duration, Convexity, Spread
 
FX Sheet:
- Counterparty, Pair, Notional, Delta, Vega
 
Commodities Sheet:
- Counterparty, Instrument, Notional, Delta, Vega
 
- Data Type Validation: Ensures numeric fields are properly formatted
 - Range Validation: Checks for realistic values (e.g., Delta between -1 and 1)
 - Required Field Validation: Ensures all mandatory fields are populated
 - Counterparty Tracking: Validates and tracks unique counterparty names
 - Warning System: Flags unusual but acceptable values
 - Error Reporting: Detailed line-by-line error identification
 
- Risk Managers calculating regulatory capital
 - Compliance Teams ensuring Basel III adherence
 - Finance Professionals learning FRTB methodology
 - Banks & Financial Institutions requiring capital calculations
 
© 2024 MP Capital. All rights reserved.
Basel III FRTB Compliance Tool