Raw Market Data Functions
About 2 min
Raw Market Data Functions
Visit the Mathema Option Pricing System for foreign exchange options and structured product valuation!
Load standard MCP_MARKET_DATA JSON snapshots into McpYieldCurve2, McpFXForwardPointsCurve2, McpFXVolSurface2, etc., then read values with existing curve UDFs.
Object chain (same for all three entry points):
JSON → LiveStore / RawMD / JsonReader → mdlsGet* / rawmdGet* / mdjsonGet*
→ McpYieldCurve2 … → YieldCurve2ZeroRate / Fxfpc2FXSpotRate / …Note: This page covers client-side JSON market data. Server-side
McpLocalVolData/mkdtGetValueare documented in marketdata.md.
Path helpers
Excel: =McpWorkbookDir()
- Returns the calling workbook directory.
Excel: =McpResolvePath(relative_or_absolute_path)
- Resolves paths such as
data/market_data/…relative to the workbook.
LiveStore (single file + patch)
Excel: =McpLiveMarketDataStore(snapshot_file_or_dir)
Python: MLiveMarketDataStore.loadSnapshot(path)
- Loads
MCP_MARKET_DATA_YYYYMMDD.json; returnsMcpLiveMarketDataStore@n.
Excel: =mdlsGetYieldCurve2(store, curve_id) (and mdlsGetFXForwardPointsCurve2, mdlsGetFXVolSurface2, mdlsGetLocalVol)
- Returns curve/surface/LocalVol objects; then use yieldcurve.md, fxforwardratecurve.md, fxvolsurface.md,
LocalVolGetVolatility. - P2 sample:
EURUSD_LOCALVOL(TC41).
Excel: =mdlsHistVolFromPriceData(store, product_type, instrument_code, valuation_date, sample_num, model)
- Builds
McpHistVolsfrom HIST CSV inprice_data_index(same folder as the snapshot). Read withHvsGetVol. Sample:FXSPOT/USDCNH(TC42).
Excel: =mdlsApplyUpdateFile(store, patch_file)
- Applies incremental patch JSON; must be referenced by downstream cells before post-patch reads.
Excel: =mdlsLastUpdateImpact(store)
- Impact table after last patch (updated / affected ids).
RawMD directory manager
Excel: =McpRawMarketManager(market_data_root)
Python: RawMarketDataManager(root=…)
Excel: =rawmdGetYieldCurve2(manager, curve_id, valuation_date) (and FX/vol / rawmdGetLocalVol)
- Optional valuation date (defaults to latest index date).
Excel: =rawmdHistVolFromPriceData(manager, product_type, instrument_code, valuation_date, sample_num, model)
- Same as
mdlsHistVolFromPriceData; CSV is relative to the RawMD root.
Excel: =rawmdGetYieldCurve(manager, curve_id, valuation_date) / mdlsGetYieldCurve
- Single-sided
McpYieldCurve. P1 sampleUSDDEPO_IMPLIED(FX-implied USD, TC36).
Excel: =rawmdGetSwapCurve(manager, curve_id, valuation_date) / mdlsGetSwapCurve
- Returns
McpSwapCurve@n. Read withSwapCurveZeroRate. Sample:CNY_SWAP_FR007_BGN(TC39).
Excel: =rawmdGetBondCurve(manager, curve_id, valuation_date) / mdlsGetBondCurve
- Returns
McpBondCurve@n. Read withBondCurveZeroRate. Sample:CNY_BOND_TREASURY(TC38).
Excel: =rawmdGetCreditCurve(manager, curve_id, valuation_date) / mdlsGetCreditCurve / mdjsonGetCreditCurve
- Returns
McpCreditCurve@n. Read withCreditCurveHazardRate/CreditCurveDefaultProbability. - P3 sample
CNY_CREDIT_CFETS(spreads in BP, 4 tenors, flatCNYDEPO, TC43). If C++ calibration fails,mdlsGetretries andrawmdGetfalls back to the Python builder.
Excel: =rawmdGetBondSpreadCurve(manager, curve_id, valuation_date) / mdlsGetBondSpreadCurve
- Returns
McpBondSpreadCurve@n. Read withBondSpreadCurveZeroSpread. - P3 sample
CNY_BOND_POLICY_SPREAD(two_curves, TC44). C++ path required; PythonfromJsoncannot build it. - Benchmark shock:
rawmdBondSpreadSetBenchmark(spread, yield_curve)— second argument must beMYieldCurve(sampleCNYDEPO_BUMP), not a BondCurve.
Excel: =rawmdGetForwardCurve(manager, curve_id, valuation_date) / mdlsGetForwardCurve
- Non-FX
McpForwardCurve@n. Read withForwardCurveForwardRate. SampleEQ_FORWARD(TC45). Alias:rawmdForwardCurve.
Excel: =rawmdGetVolSurface(manager, curve_id, valuation_date) / mdlsGetVolSurface
- Non-FX
McpVolSurface@n. Read withVolSurfaceGetVolatility. SampleEQ_VOL_SAMPLE(2×5 grid, TC46). Alias:rawmdVolSurface.
Cross FXFP2
rawmdGetFXForwardPointsCurve2/mdlsGetFXForwardPointsCurve2forCNHTHB_FXFP_CROSS_2(Construction=Cross, no Tenors; built from Leg1/Leg2).- Python
RawMarketDataManager.get_fx_forward_points_curve2cannot build Cross2 — use LiveStore / C++ Manager. - Read:
Fxfpc2FXSpotRate/Fxfpc2FXForwardOutright;Fxfpc2GetCurvefor mid (TC35).
Excel: =rawmdAvailableDates(manager) / rawmdLatestValuationDate
JsonReader (read-only)
Excel: =McpMarketDataJsonReader(json_file)
Python: MMarketDataJsonReader.loadFromFile(path)
- Read-only; no patch support.
Excel: =mdjsonGetYieldCurve2(reader, curve_id) (and FX/vol / Credit / Forward / Vol variants)
PyXLL modules
Register in pyxll.cfg (mcp_lifecycle must be last):
mcp_raw_market_datamcp_market_data_livemcp_lifecycle
Excel cases: TC31–TC46 (see excel/MCP-TC31.md … MCP-TC42.md / MCP-TC43.md … MCP-TC46.md).
