Skip to main content

💰 Market Data Price

Guide for End-of-Day (EOD) pricing data and queries in the MAF OA system.


Quick Overview​

The system provides EOD pricing with three query modes:

  • đŸĻ Internal Prices — Prices from your database
  • 📊 External Prices — Prices from MAF (Markit Attribution Finance)
  • 🔗 Combined Queries — Internal first, then fallback to external

📈 EOD Price Data​

Key Fields​

FieldTypeExamplePurpose
mdp_idint1Link to Market Data Product
mdi_idint5Link to Market Data Instrument
price_datedate2025-01-09EOD date (YYYY-MM-DD)
closedecimal26.00Closing price
opendecimal25.50Opening price
highdecimal26.75Daily high
lowdecimal25.25Daily low
volumeint1500000Trading volume
sourceenumMAFSource system
source_market_data_product_idstring10123External product ID

Example Prices​

📊 Internal EOD Price
{
"mdp_id": 1,
"mdi_id": 5,
"price_date": "2025-01-09",
"open": 25.50,
"high": 26.75,
"low": 25.25,
"close": 26.00,
"volume": 1500000
}
đŸĻ MAF External Price
{
"mdp_id": 1,
"price_date": "2025-01-09",
"open": 25.48,
"high": 26.72,
"low": 25.20,
"close": 25.95,
"source": "MAF",
"source_market_data_product_id": "10123"
}

đŸŽ›ī¸ Query Modes​

Choose one mode for each query:

ModeBehaviorUse Case
internalInternal prices only; fail if not foundRegulatory/audit requirements
externalMAF prices onlyMarket comparison, public benchmarking
combineTry internal first, fallback to MAFRecommended — best of both

Query Example​

Query LNG Dec-2025 (Jan 2025)
{
"rows": [
{
"mdp_id": 1,
"contract_term": "2512",
"source": "MAF"
}
],
"query_mode": "combine",
"start_date": "2025-01-01",
"end_date": "2025-01-31"
}
Get All Instruments for Product
{
"mdp_id": 1,
"start_date": "2025-01-01",
"end_date": "2025-01-31"
}

🔌 API Endpoints​

MethodEndpointPurpose
POST/marketdata/eod/select_rangeQuery EOD prices over date range
POST/marketdata/eod/select_allGet all instruments for a product
POST/marketdata/eod/insertInsert new EOD prices
POST/marketdata/eod/updateUpdate existing prices
POST/marketdata/eod/deleteDelete prices

Note: select_all uses internal prices only; no MAF fallback.


📋 Best Practices​

When Querying​

  1. ✅ Specify Query Mode — Choose internal, external, or combine based on your needs
  2. ✅ Cache Aggressively — EOD prices are immutable; cache for 24+ hours
  3. ✅ Handle Gaps — Not all instruments have prices for all dates
  4. ✅ Use Contract Terms — For futures/options, specify contract_term to avoid ambiguity
  5. ✅ Respect Tenant Scope — Your tenant_id filters all queries automatically

When Inserting/Updating​

  1. ✅ Validate Instruments — Ensure mdp_id and mdi_id exist before insert
  2. ✅ Use Consistent Dates — Format all dates as YYYY-MM-DD
  3. ✅ Document Changes — All inserts/updates are audit-logged automatically
  4. ✅ Reconcile with MAF — Compare internal vs. external prices regularly

🔄 Data Corrections & Backfilling​

OperationEndpointUse Case
BackfillPOST /insertAdd historical prices
CorrectPOST /updateFix erroneous prices
RemovePOST /deleteDelete outdated records

All changes are audit-logged with created_by, updated_by, and timestamps.


📊 Source Comparison​

AspectInternalMAF (External)
LatencyReal-time15-30 min post-close
CoverageYour data onlyMarket-wide
AccuracySource of truthVendor-dependent
Use forCompliance, auditBenchmarking, reconciliation
FallbackManual reconciliationUse internal as primary

⏰ Time Handling​

  • Format: YYYY-MM-DD (date only, no time)
  • Timezone: Market close time in product's local TZ
  • Scope: EOD prices only; intraday data not supported

  • Market Data — Product and instrument definitions
  • Code: See app/model/market_models/ for Pydantic models
  • ORM: See app/infra/orm/market_orms/ for database schemas
  • Services: See app/service/market_services/ for business logic

❓ Support​

  • EOD Queries → Data Team
  • MAF Integration → External Data Team
  • API Issues → Backend Team
  • Permissions → Tenant Admin