Skip to main content

📊 Market Data

Guide for reference data and instrument definitions in the MAF OA system.


Quick Overview​

The system organizes market data into two layers:

  • đŸˇī¸ Market Data Products (MDP) — Master reference data (e.g., "LNG Futures", "HSBC Equity")
  • 📍 Market Data Instruments (MDI) — Specific contract instances (e.g., "LNG Dec-2025", "HSBC Call 105.50")

Both can come from internal database or external sources (MAF, vendors)

1ī¸âƒŖ Market Data Products (MDP)​

What is an MDP?​

A Market Data Product is a master record that defines a tradable instrument class:

  • Immutable once created
  • Uniquely identified by mdp_key (e.g., LNG_JKM)
  • Includes static attributes: exchange, currency, asset class, type
  • Can reference an external product ID for integration (e.g., MAF's 10123)

Key Fields​

FieldTypeExamplePurpose
mdp_keystringLNG_JKMStable, human-readable code
exchangestringICE, SGXPrimary trading venue
namestringJKM LNG FuturesDisplay name
asset_classenumCOMMODITY, EQUITY, FX, RATE, etc.Asset category
market_data_typeenumSPOT, FUTURE, FORWARD, OPTION, etc.Instrument type
descriptionstringFront-month LNGOptional notes
base_unitenumMMBTU, BBL, MTPricing unit
base_currencyenumUSD, EUR, SGDPricing currency
sourceenumMAFSource system
source_market_data_product_idstringJKM_FUT_001External system ID
option_styleenumEUROPEAN, AMERICANOption type (if applicable)
underlying_mdp_idint1Parent product (for derivatives)

Examples​

📈 LNG Futures
{
"mdp_key": "LNG_JKM",
"name": "JKM LNG Futures",
"exchange": "ICE",
"asset_class": "COMMODITY",
"market_data_type": "FUTURE",
"base_unit": "MMBTU",
"base_currency": "USD",
"source": "MAF",
"source_market_data_product_id": "JKM_FUT_001"
}
📊 Equity Stock
{
"mdp_key": "EQUITY_700",
"name": "HSBC Holdings PLC",
"exchange": "HKEX",
"asset_class": "EQUITY",
"market_data_type": "SPOT",
"base_currency": "HKD"
}
📞 Call Option (with underlying)
{
"mdp_key": "FUTURE_OPTION_LNG",
"name": "LNG Futures Call Option",
"exchange": "ICE",
"asset_class": "COMMODITY",
"market_data_type": "FUTURE_OPTION",
"option_style": "EUROPEAN",
"underlying_mdp_id": 1
}

2ī¸âƒŖ Market Data Instruments (MDI)​

What is an MDI?​

A Market Data Instrument is a specific contract instance tied to an MDP:

  • One MDP → Many MDIs (e.g., one "LNG Futures" product → contracts for 2512, 2601, 2602, etc.)
  • For spot/index products, MDI is optional (1:1 with MDP)
  • For derivatives, specifies contract term, strike, call/put

Key Fields​

FieldTypeExamplePurpose
mdp_idint1Link to parent Market Data Product
contract_termstring2512, 241221Contract expiry (YYMM or YYMMDD)
cpenumC, PCall or Put (options only)
strike_pricestring105.50Strike price (options only)

Examples​

🔄 Futures Contract (Dec-2025)
{
"mdp_id": 1,
"contract_term": "2512"
}
📊 Option Contract (Call at 105.50)
{
"mdp_id": 10,
"contract_term": "2412",
"cp": "C",
"strike_price": "105.50"
}

Source & Refresh​

  • Authoritative sources:
    • Internal: market_data_products and market_data_instruments tables in the database.
    • External: MAF (Markit Attribution Finance) or other vendor feeds.
  • Refresh cadence:
    • MDPs: Updated only on instrument changes (corporate actions, new listings, delistings). Typically monthly or quarterly.
    • MDIs: Updated as new contracts are introduced (e.g., monthly for rolling futures). Typically weekly or on-demand.
  • Change tracking: All changes logged with created_at, updated_at, and created_by / updated_by (tenant and user context).

🔗 API Endpoints​

Market Data Products​

MethodEndpointPurpose
POST/marketdata/product/insertCreate new products
POST/marketdata/product/selectQuery with filters
PUT/marketdata/product/updateUpdate existing products
DELETE/marketdata/product/deleteRemove products

Market Data Instruments​

MethodEndpointPurpose
POST/marketdata/instrument/insertCreate new instruments
POST/marketdata/instrument/selectQuery instruments
DELETE/marketdata/instrument/deleteRemove instruments

Note: Instruments are validated against their linked product's market_data_type at insert time.

Ownership & Change Process​

  • Data Owner: Data Engineering team / Market Data Team
  • Change Process:
    1. Submit insert/update/delete requests via the REST API (authentication required).
    2. Changes are logged with tenant_id, created_by, updated_by, and timestamps.
    3. For external source mappings, coordinate with MAF or vendor team.
    4. All changes are audit-logged for compliance tracking.

📋 Key Guidelines​

For Data Consumers​

  1. Query by Key — Use mdp_key (e.g., LNG_JKM) for deterministic lookups
  2. Resolve Instruments — For options/futures, specify contract_term, cp, strike_price
  3. External Mapping — Match your product ID against source_market_data_product_id for MAF integration
  4. Tenant Scoping — All queries are scoped to your authenticated tenant_id

For Data Maintainers​

  1. ✅ Check Uniqueness — Prevent duplicate mdp_key values before insert
  2. ✅ Reference Validation — Ensure underlying_mdp_id points to valid MDPs (for derivatives)
  3. ✅ Type Enforcement — Only set option_style for *_OPTION types
  4. ✅ Source Coordination — Keep MAF mappings in sync with external vendor

📊 Data Lifecycle​

EventCadenceNotes
Create MDPOn-demandImmutable after creation
Update MDPRareOnly for master data corrections
Create MDIWeekly / MonthlyNew contract terms/strikes
DeleteAd-hocAudit-logged for compliance

All changes tracked with: tenant_id, created_by, updated_by, created_at, updated_at


🔄 Source & Refresh​

SourceStorageRefreshUse Case
InternalDatabaseOn-demandRegulatory, audit trail
External (MAF)Vendor feedDaily/WeeklyMarket comparison, reconciliation

  • Market Data Price — EOD and real-time pricing queries
  • Code: See app/model/market_models/ for Pydantic models
  • ORM: See app/infra/orm/market_orms/ for database schemas

❓ Questions?​

  • Data Issues → Market Data Team
  • API Issues → Backend Team
  • Permissions → Tenant Admin