MCP (Mathema Calculation Platform) - FICC Derivatives Pricing Library
MCP (Mathema Calculation Platform) - FICC Derivatives Pricing Library
A comprehensive Python library for Fixed Income, Currency, and Commodities (FICC) derivatives pricing and risk management. MCP provides professional-grade tools for financial institutions, trading desks, and quantitative analysts, with seamless Excel integration that allows users to create complex financial models and templates directly within Excel spreadsheets.
🚀 Key Features
- Comprehensive FICC Coverage: Support for FX, Interest Rate, Bond, and Volatility products
- Professional Pricing Models: Black-Scholes, Heston, Bachelier, and advanced volatility models
- Real-time & Historical Data: Integration with market data providers
- Excel Integration: Seamless Excel add-in functionality via PyXLL
- High Performance: Optimized C++ core with Python wrapper
- Production Ready: Used by major financial institutions
📊 Supported Financial Products
💱 FX, Commodities & Equity Index Options
- Vanilla Options
- Call/Put Options
- American Style Options
- Asian Options (Average rate/strike)
- Exotic Options
- Barrier Options (Knock-in, Knock-out)
- Touch Options (One-Touch, No-Touch)
- Digital Options (Cash/Asset-or-Nothing)
🔄 Structured FX & Precious Metals Products
- Forward Products
- Outright Forward
- Range Forward (Spread Forward)
- Floor Forward (Protected Forward)
- Cap Forward (Capped Forward)
- Cap & Floor Forward (Cylinder)
- Ratio Forward
- Dual Currency Forward
- Target Forward
🏦 Interest Rate Products
- Bonds
- Bullet Bonds (One-time maturity payment)
- Callable Bonds (Embedded options)
- Coupon Bonds (Regular interest payments)
- Perpetual Bonds
- Floating Rate Notes (FRN)
- Interest Rate Swaps
- Standard IRS (FR007, SOFR, etc.)
- Float/Float Swaps
- Float/Fixed Swaps
- Fixed/Float Swaps
- Interest Rate Derivatives
- Bond Forwards
- Bond Options
- Swaptions (Interest Rate Swap Options)
- Caps & Floors
- Forward Rate Agreements (FRA)
📈 Market Data & Curves
- Curve Models
- Forward Curves
- Yield Curves
- Volatility Surfaces
- Local Volatility Models
- Interest Rate Curves
- Deposit Curves
- Bond Curves
- Swap Curves
- Parametric Curves
- Interest Rate Surfaces
- Cap/Floor Volatility Surfaces
- IRO Volatility Cubes
🏗️ Structured Products (OTC Derivatives or Structured Deposit)
Customized structured options linked to interest rates, FX rates, commodities, and equity indices:
- Double No Touch (Bilateral barrier)
- Triple Ranges Put (Three-level put structure)
- Range Accrual (Accumulative range)
- Digital Call (Binary call option)
- Autocallables (Monthly observation auto-call)
- Triple Ranges Call (Three-level call structure)
- Cash Delivery Forward (Subsidized delivery structured forward)
- Double Ranges (Dual-level structure)
- Digital Put (Binary put option)
- Single Touch (One-sided barrier)
- Call Put Spread (Spread structure)
- Auto Call (Callable structure)
- Shark Fin (Dual shark fin)
- Dual Shark Fin (Bidirectional shark fin)
- Discrete Double No Touch (Daily observation EUR/USD)
- Discrete One Touch Downside (Downward one-touch)
- Discrete One Touch Upside (Upward one-touch)
- Discrete Ping Pong Option (Discrete ping-pong option)
- Single Range Accrual Call (One-sided call range accrual)
- Single Range Accrual Put (One-sided put range accrual)
- Custom Structures (More tailored products available)
🚀 GPU Acceleration Support
Structured products utilize Monte Carlo simulation and support GPU acceleration for enhanced performance. If your machine has NVIDIA RTX series or compatible GPUs installed, you can enable GPU acceleration through:
- PyXLL Configuration: Set
MCP_RUNMODE = GPUinpyxll.cfg - Environment Variable: Set
MCP_RUNMODE = GPUin system environment variables
GPU acceleration significantly improves calculation speed for complex structured products pricing.
🛠️ Installation
MCP supports both automated installation (recommended) and manual installation methods.
🚀 Quick Installation (Recommended)
The easiest way to install MCP is using our automated installation script:
# Download and extract MCP, then run:
install.batVerify Installation
Use the same Python Excel will use:
python test_install.pyFeatures of Quick Installation:
- ✅ Scans 64-bit CPython 3.9–3.13 and matches
_mcp.cp3xx-win_amd64.pyd - ✅ Writes
lib\X64\pyxll.cfg(Python path and PyXLL license) - ✅ Registers
lib\X64\pyxll.xll - ✅ Does not set a user PYTHONPATH
- ✅ 64-bit Excel only
🔧 Manual Installation
If you prefer manual installation or automated installation fails:
Prerequisites
- Python: 64-bit CPython 3.9 / 3.10 / 3.11 / 3.12 / 3.13
- OS: Windows 10/11 64-bit
- Excel: 64-bit Microsoft Excel 2016 or later (32-bit Excel is not supported)
- PyXLL: license for production; trial is available at install time
Step 1: Download MCP Excel Package
- Download mcp_excel:
- Obtain
mcp_excel_1.6.xxxxxxxx.zip(Download) and extract it.
- Obtain
Note: The package already includes Excel and Python programming support
Step 2: Install Python Dependencies
cd C:\path\to\mcp_excel
C:\Path\To\Python\python.exe -m pip install -r requirements.txtKeep NumPy on 1.x (numpy>=1.19,<2).
Step 3: Configure Excel Integration
Do not set a user PYTHONPATH. import mcp loads lib\X64\_mcp.cp3xx-win_amd64.pyd for the running interpreter.
- Set
executableinlib\X64\pyxll.cfgto that Python’spythonw.exe. - Paste the PyXLL key under
[LICENSE], or leave empty for trial. - Confirm Excel is 64-bit. Register
lib\X64\pyxll.xll(or runinstall.bat). - Close every Excel window, then reopen Excel.
Step 4: Verify Installation
python -c "import mcp; print('MCP installed successfully', mcp._mcp.__file__)"
python example\calendar\quickstart.pyPython Environment Options
If you cannot find a suitable Python version, you can use the following options:
Option 1: Install Anaconda
Installation Steps:
- Run the downloaded
Anaconda3-2022.05-Windows-x86_64.exe - Follow the installation wizard, keeping default settings recommended
Option 2: Use Python Portable Package
- Download link: Python Portable Package python.zip
Installation Steps:
- Simply extract python.zip to use
💡 Quick Examples
FX Vanilla Option Pricing
from mcp.tool.tools_main import McpVanillaOption
from mcp.utils.enums import BuySell, CallPut, OptionExpiryNature
# Create option parameters
option_args = {
'Pair': 'USD/CNY',
'BuySell': BuySell.Buy,
'CallPut': CallPut.Call,
'OptionExpiryNature': OptionExpiryNature.EUROPEAN,
'StrikePx': 7.3,
'SpotPx': 7.0671,
'Volatility': 0.0484,
'DomesticRate': 0.0186,
'ForeignRate': 0.0475,
'ExpiryDate': '2025-02-14',
'DeliveryDate': '2025-02-18',
'FaceAmount': 1000000
}
# Price the option
option = McpVanillaOption(option_args)
price = option.Price()
print(f"Option Price: {price:.2f}")Yield Curve Construction
from mcp.tool.tools_main import McpYieldCurve2
from mcp.utils.enums import DayCounter, Frequency
# Build bilateral yield curve
curve_args = {
'ReferenceDate': '2024-12-13',
'Tenors': ['ON', '1M', '3M', '6M', '1Y', '2Y', '5Y'],
'BidZeroRates': [0.0458, 0.0433, 0.0433, 0.0433, 0.0433, 0.043, 0.042],
'AskZeroRates': [0.0459, 0.0458, 0.0458, 0.0458, 0.0458, 0.046, 0.045],
'DayCounter': DayCounter.Act365Fixed,
'Frequency': Frequency.Continuous
}
curve = McpYieldCurve2(curve_args)
zero_rate = curve.ZeroRate('2025-12-13', 'mid')
print(f"1Y Zero Rate: {zero_rate*100:.4f}%")FX Forward Points Curve
from mcp.tool.tools_main import McpFXForwardPointsCurve2
# Build bilateral forward points curve
forward_args = {
'ReferenceDate': '2024-12-13',
'Pair': 'USD/CNY',
'FXSpotRate': 7.1650,
'Tenors': ['ON', '1M', '3M', '6M', '1Y'],
'BidForwardPoints': [-22.0, -250, -733, -1393, -2395],
'AskForwardPoints': [-21.0, -248, -730, -1390, -2390]
}
forward_curve = McpFXForwardPointsCurve2(forward_args)
points = forward_curve.FXForwardPoints('2025-03-13', 'mid')
print(f"3M Forward Points: {points:.1f}")🔧 Requirements
System Requirements
- OS: Windows 10/11 64-bit
- Python: 64-bit CPython 3.9–3.13
- Memory: 4GB RAM minimum, 8GB recommended
- Storage: about 500MB+ (multi-ABI pyds are larger)
- Excel: 64-bit Microsoft Excel 2016 or later
Dependencies
Essential Dependencies (Automatically Installed)
- NumPy: Numerical computing
- Pandas: Data manipulation
- Requests: HTTP requests for server functions
- Python-dateutil: Date handling
Optional Dependencies
- PyXLL: Commercial license required for Excel integration
- Matplotlib: Plotting and visualization
- Jupyter: Notebook support
- Development tools: pytest, black, flake8, mypy
🆘 Troubleshooting
Common Issues
No matching Python / wrong ABI
- Install 64-bit CPython 3.9–3.13 from python.org and tick PATH
"ModuleNotFoundError: No module named 'mcp'"
- Run from the extracted MCP folder, or ensure
sys.pathincludes it (PyXLLpythonpathalready does) - Do not rely on a user PYTHONPATH
- Run
python test_install.pywith the same Python Excel uses
Excel add-in not loading
- Restart Excel
- Check Excel Add-ins settings
- Verify PyXLL is installed
Windows 11 Specific Issues
If you're using Windows 11 and encounter these errors:
ModuleNotFoundError: No module named 'mcp._mcp'- Excel shows "Error importing Python modules"
Solution: Copy and rename DLL files from system directory:
- Navigate to
C:\Windows\system32\ - Find these files:
msvcr120_clr0400.dllmsvcp120_clr0400.dll
- Copy them to
.\lib\X64\and rename to:msvcr120.dllmsvcp120.dll
Note: Why this works? We don't know either 😅 - but it fixes the issue on Windows 11!
Get Help
- Run diagnostics:
python test_install.py - GitHub issues: Report problems
Important Notes
- Use 64-bit CPython 3.9–3.13 that matches a shipped
_mcp.cp3xx-win_amd64.pyd - If loading fails, verify that the
executablepath inpyxll.cfgis correct - If you're using Windows 11 and it doesn't work, please follow the Windows 11 specific solution above
⚠️ Disclaimer: This software is provided for educational and professional use. Users are responsible for compliance with all applicable regulations and third-party license terms. The authors are not liable for any financial losses or regulatory violations.