mathema-mcp
Python pricing library for Mathema MCP. Build market objects and trades from dicts, then compute prices and Greeks. pip installs one wheel for your OS and Python version. Excel is not included.
Docs: https://help.mathema.com.cn/
Features
- Build calendars, rates/credit/FX curves, and volatility surfaces, then attach them to options, swaps, and bonds
- Load the same objects from a standard market-data snapshot (JSON): mcp_marketdata
- Vanilla closed-form, barrier/digital, American, and path-dependent structures (Monte Carlo)
- Volatility: implied surfaces, historical vol, LocalVol, Heston
- Greeks and related risk measures
User API: mcp.tools / mcp.tool.tools_main. Underlying classes: mcp.wrapper.
Market-data objects
| Layer | Objects | Role |
|---|---|---|
| Conventions | McpCalendar, McpSchedule, McpRateConvention |
Holidays, payment schedules, rate conventions |
| Rates curves | McpYieldCurve / McpYieldCurve2, McpSwapCurve, McpForwardCurve, McpParametricCurve |
Discount, zero, swap, forward |
| Bond curves | McpBondCurve, McpBondSpreadCurve |
Bond discount and spread |
| FX curves | McpFXForwardPointsCurve / 2, McpXccyBasisCurve |
Forward points, cross-currency basis |
| Credit curves | McpCreditCurve |
Hazard rates, default probabilities |
| Curve building blocks | Overnight / Bill / FRA / Swap / Bond *CurveData |
Instruments used to bootstrap a curve |
| Volatility | McpVolSurface, McpFXVolSurface, McpMktVolSurface (and *2) |
Equity/commodity, FX, and quoted market surfaces |
| Rates volatility | McpSwaptionCube, McpCapVolStripping |
Swaption cube, cap stripping |
| Vol models | McpHistVols, McpLocalVol, McpHestonModel |
Historical, Dupire, stochastic vol |
| Snapshots | McpRawMarketManager, McpMarketDataJsonReader, McpLiveMarketDataStore |
Standard JSON → the objects above |
Asset coverage
The same option shapes (vanilla / barrier / digital / double-digital / Asian) attach to FX, equity, and commodity.
| Asset | Coverage |
|---|---|
| FX | Spot, forward, NDF, swap; vanilla/barrier/digital/Asian; strategies; structured forwards |
| Rates | IRS, basis swap, cross-currency swap; deposits/loans, FRA; cap/floor, swaption |
| Credit | CDS, CLN; discounting on a credit curve |
| Bonds | Fixed, amortizing, callable; repo, securities lending, bill discount; bond forward/future; ABS tranches |
| Equity | Spot, future, fund; vanilla/barrier/digital; snowball, phoenix, autocall, range accrual |
| Commodity | Futures, options; commodity lending |
| TRS | Equity TRS, bond TRS |
Convertible bonds are priced on the structured-product path.
Install
pip install mathema-mcp
For table-style APIs (FixedLegs / McpPayoff and similar):
pip install "mathema-mcp[data]"
Or install a downloaded wheel:
pip install path/to/mathema_mcp-1.6.1-cp39-cp39-win_amd64.whl
Usage
The main entry is dict arguments, not SWIG positional args:
from mcp.tools import McpCalendar, McpVersion
from mcp.tool.tools_main import McpYieldCurve
from mcp.utils.enums import DayCounter, Frequency, InterpolatedVariable, InterpolationMethod
print(McpVersion())
cal = McpCalendar()
yc = McpYieldCurve({
"ReferenceDate": "2024-12-13",
"Tenors": ["1M", "1Y"],
"ZeroRates": [0.03, 0.035],
"Calendar": cal,
"DayCounter": DayCounter.Act365Fixed,
"Frequency": Frequency.Continuous,
"Variable": InterpolatedVariable.SIMPLERATES,
"InterpolationMethod": InterpolationMethod.LINEARINTERPOLATION,
})
Dict construction does not require numpy or pandas. Those are only needed for the table APIs ([data]).
Supported wheels
| Platform | Python | Tag |
|---|---|---|
| Windows x64 | 3.9–3.13 | win_amd64 |
| Linux x64 (glibc ≥ 2.28) | 3.9–3.13 | manylinux_2_28_x86_64 |
Runtime
Public wheels are built without CUDA. A local CUDA toolkit or runtime is not required. Structured products use CPU multithreading. GPU Monte Carlo is not included.
Metadata
Release files for mathema-mcp 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 138.2 MB
Release files / mathema_mcp-1.6.1-cp313-cp313-win_amd64.whl
| Download URL | mathema_mcp-1.6.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
dfcb7e611b0ffb1f9bdbec4d442c6d62919388f8305ed2bf72ad89cffc627589
|
|
BLAKE2b-256 checksum How to use checksums |
f198f0e6261783fda3ea1d89c8daff36733ea7e22a572c7321450d6239d8f7de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | mathema_mcp-1.6.1-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0a948addbe45ebfb1c49b097722f673664a59e9c138af8a43ec1b39cdd5ef1e0
|
|
BLAKE2b-256 checksum How to use checksums |
2cccc7124d4875fbda972569dc3b34bc7a703377d09f30032240cdd59d01ecec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp312-cp312-win_amd64.whl
| Download URL | mathema_mcp-1.6.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fd66a0be2eb06951a266f61e94153118bf532d87ec0dc0d91da1e825d8ed078e
|
|
BLAKE2b-256 checksum How to use checksums |
1f1a5cd980705aec72333f9657d18a5de7cf80f764523bc1a5213e0fce1b6d8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | mathema_mcp-1.6.1-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1d020ee553764dff29354751d14add3758cd4d02a15a636773f6b0c0f5bdb767
|
|
BLAKE2b-256 checksum How to use checksums |
899c468acc274d323b8651e7c0b7f42f32ff901781fbd514471513f239321805
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp311-cp311-win_amd64.whl
| Download URL | mathema_mcp-1.6.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
af90c797424b823859b0528ee0831221c99d6a74e27f42c389c4df04ac1e9a2e
|
|
BLAKE2b-256 checksum How to use checksums |
1edca88dacb08bad3d67e729ecbb4fac5c82f39f818231c9db0f311797755be7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | mathema_mcp-1.6.1-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
d72a96828cddf51bfd56694f7f041b1f2cdac1739d09cf3d340ab527aba4919d
|
|
BLAKE2b-256 checksum How to use checksums |
76d68ae32196489309d685c7278371c75b9cb72231c2e73fe81c0cb0b5886fd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp310-cp310-win_amd64.whl
| Download URL | mathema_mcp-1.6.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
94cea774bc4a99d83648de1ee55ec66fdfbdea3040ef1e96df31eec848d6a359
|
|
BLAKE2b-256 checksum How to use checksums |
1161baea49ff912b5c0713ef1ea21d96888f22cc5e99ac7e57bbd98832baa2cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | mathema_mcp-1.6.1-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a47dce734de91f58fae2e974627fa3255e647da5ad20dc9dac5d52fb73763590
|
|
BLAKE2b-256 checksum How to use checksums |
1ffbdecdf7edccfffa5ee2f2d6fb341eac532c1a58fdd0d5c1f9716bf51b4a18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp39-cp39-win_amd64.whl
| Download URL | mathema_mcp-1.6.1-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d9aae0dba3a8db56be5cb24a7a688b1c9cf2501f1cdf43c374618e5385ae9852
|
|
BLAKE2b-256 checksum How to use checksums |
045b327ae56e0d0b7320030c19529358afd90077d08ea023f39e5875c8a80fc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / mathema_mcp-1.6.1-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | mathema_mcp-1.6.1-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ebbc67bbb28cd23a3d3678418302bb0bd234de9090dd2aca5b96cb4198692fc0
|
|
BLAKE2b-256 checksum How to use checksums |
5b59ffdfefa1aa0801b0e8f32364486b6b86be00900b5c29e3e2e07be1a493be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|