Intelligence, Advanced Charting & Trading Platform

1 # Canonical Market Data Contracts
2
3 ## Canonical instruments
4
5 | Symbol | Class | Market | Canonical unit |
6 |---|---|---|---|
7 | `USD_IRT_FREE` | FX | Iran free market | IRT per USD |
8 | `GOLD18_IRT` | Commodity | Iran | IRT per gram 18K |
9 | `XAU_USD` | Commodity | Global spot | USD per troy ounce |
10 | `GOLD18_THEORETICAL_IRT` | Derived | VELYQOR | IRT per gram 18K |
11 | `GOLD18_PREMIUM_IRT` | Derived | VELYQOR | IRT per gram 18K |
12 | `GOLD18_PREMIUM_PCT` | Derived | VELYQOR | percent |
13
14 Provider symbols are mappings and must never replace canonical symbols.
15
16 ## Units
17 - Iran-facing canonical currency unit for MVP: toman (`IRT`).
18 - Provider rial values must be normalized in the provider adapter; the raw provider value remains auditable.
19 - 1 troy ounce = 31.1034768 grams.
20 - 18K purity factor = 0.75.
21
22 ## Theoretical 18K gold
23
24 `gold18_theoretical_irt = (xau_usd / 31.1034768) * 0.75 * usd_irt_free`
25
26 Premium absolute:
27
28 `premium_irt = gold18_market_irt - gold18_theoretical_irt`
29
30 Premium percentage:
31
32 `premium_pct = (gold18_market_irt / gold18_theoretical_irt - 1) * 100`
33
34 ## Time contract
35 - Canonical backend/database timestamps: UTC.
36 - Iran presentation timezone: `Asia/Tehran`.
37 - Provider timestamp and receive timestamp are separate fields.
38 - Raw provider timestamp is retained where available.
39 - Derived calculations align source observations to a target timestamp and record the selected source timestamps.
40
41 ## Derived-value provenance
42 Every derived value must retain at least:
43 - target timestamp
44 - XAU/USD value and timestamp
45 - USD/IRT value and timestamp
46 - formula/calculation version
47 - quality status/score
48 - staleness/quality flags
49
50 ## Quality states
51 Minimum semantic states:
52 - `GOOD`
53 - `DEGRADED`
54 - `STALE`
55 - `INVALID`
56
57 A `STALE` or `INVALID` observation must not be rendered as healthy live data.
58
59 ## Candle invariants
60 For every candle:
61 - `low <= open <= high`
62 - `low <= close <= high`
63 - `open_time < close_time`
64 - unique `(instrument, timeframe, open_time)`
65 - candle/session boundaries use the relevant market calendar rather than blindly assuming UTC midnight.
66
67 ## Initial timeframes
68 Candidate timeframes are `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`. A timeframe is exposed in UI only when source frequency and quality genuinely support it.