đ° 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â
| Field | Type | Example | Purpose |
|---|---|---|---|
mdp_id | int | 1 | Link to Market Data Product |
mdi_id | int | 5 | Link to Market Data Instrument |
price_date | date | 2025-01-09 | EOD date (YYYY-MM-DD) |
close | decimal | 26.00 | Closing price |
open | decimal | 25.50 | Opening price |
high | decimal | 26.75 | Daily high |
low | decimal | 25.25 | Daily low |
volume | int | 1500000 | Trading volume |
source | enum | MAF | Source system |
source_market_data_product_id | string | 10123 | External 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:
| Mode | Behavior | Use Case |
|---|---|---|
internal | Internal prices only; fail if not found | Regulatory/audit requirements |
external | MAF prices only | Market comparison, public benchmarking |
combine | Try internal first, fallback to MAF | Recommended â 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â
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /marketdata/eod/select_range | Query EOD prices over date range |
| POST | /marketdata/eod/select_all | Get all instruments for a product |
| POST | /marketdata/eod/insert | Insert new EOD prices |
| POST | /marketdata/eod/update | Update existing prices |
| POST | /marketdata/eod/delete | Delete prices |
Note:
select_alluses internal prices only; no MAF fallback.
đ Best Practicesâ
When Queryingâ
- â
Specify Query Mode â Choose
internal,external, orcombinebased on your needs - â Cache Aggressively â EOD prices are immutable; cache for 24+ hours
- â Handle Gaps â Not all instruments have prices for all dates
- â
Use Contract Terms â For futures/options, specify
contract_termto avoid ambiguity - â
Respect Tenant Scope â Your
tenant_idfilters all queries automatically
When Inserting/Updatingâ
- â
Validate Instruments â Ensure
mdp_idandmdi_idexist before insert - â Use Consistent Dates â Format all dates as YYYY-MM-DD
- â Document Changes â All inserts/updates are audit-logged automatically
- â Reconcile with MAF â Compare internal vs. external prices regularly
đ Data Corrections & Backfillingâ
| Operation | Endpoint | Use Case |
|---|---|---|
| Backfill | POST /insert | Add historical prices |
| Correct | POST /update | Fix erroneous prices |
| Remove | POST /delete | Delete outdated records |
All changes are audit-logged with
created_by,updated_by, and timestamps.
đ Source Comparisonâ
| Aspect | Internal | MAF (External) |
|---|---|---|
| Latency | Real-time | 15-30 min post-close |
| Coverage | Your data only | Market-wide |
| Accuracy | Source of truth | Vendor-dependent |
| Use for | Compliance, audit | Benchmarking, reconciliation |
| Fallback | Manual reconciliation | Use 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
đ Related Documentationâ
- 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