Intelligence, Advanced Charting & Trading Platform
feature/paper-trading-risk-controls-2026-10-14
diagnostics/chartnova-blank-screen-2026-10-15
diagnostics/chartnova-stage2-v27-preview-2026-10-15
docs/chartnova-stage1-reconcile-manifest-2026-10-15
feature/chartnova-ios-widget
feature/chartnova-light-catalog-lazy-series-2026-10-15
feature/chartnova-market-terminal
feature/chartnova-multimarket-chart-ws-foundation
feature/chartnova-neon-direct-history
feature/chartnova-neon-history
feature/paper-trading-risk-controls-2026-10-14
fix/alpha-vantage-live-payload
fix/chartnova-progressive-loading-2026-10-15
fix/live-proof-runner-cwd-2026-10-14
foundation/phase-0
foundation/postgres-core
main
ops/chartnova-emergency-rollback-2026-10-15
phase-1/candle-builder
phase-1/data-proof-artifact
phase-1/data-proof-metrics
phase-1/data-proof-report
phase-1/external-gates-state
phase-1/gold-api-fallback
phase-1/ingestion-pipeline
phase-1/live-proof-runner
phase-1/market-calendar
phase-1/market-domain
phase-1/neon-live-proof
phase-1/persistence-contract
phase-1/postgres-ci
phase-1/provider-adapters
phase-1/provider-recovery
phase-1/quality-propagation
phase-1/spike-detection
phase-1/xau-provider-adapter
risk/chartnova-alert-runtime-atomic-2026-10-22
risk/chartnova-atomic-outbox-2026-10-22
risk/chartnova-seven-track-safety-2026-10-21
safety/p0-triage-2026-10-13
| 1 | # ChartNova — source OHLC licensing and ingestion quality gate |
| 2 | |
| 3 | Status: **Implemented preflight + unit tests; NOT a live OHLC importer, legal license, deployed feed, or trading signal.** |
| 4 | Repository branch: `feature/chartnova-neon-direct-history` |
| 5 | |
| 6 | ## Current source-of-truth rules |
| 7 | 1. ECB EXR observations remain in `market_ticks` with `data_kind=daily_reference_point_not_ohlc`; they must **never** enter `candles`. One valid daily rate is not a high/low/open/close. |
| 8 | 2. The existing `candles` table was directly checked and remains empty pending genuinely licensed source OHLC. |
| 9 | 3. The Navasan public API guide documents `ohlcSearch` for daily source OHLC (USD Tehran sell, 18K gold and coin, among others), but the publicly retrieved guide **does not establish commercial archival / public redistribution permission**. Obtain the provider's commercial terms/permission before enabling import. No Navasan data was inserted. |
| 10 | 4. TGJU historical OHLC licensing is unresolved and must not be ingested without documented authorization. Crypto/exchange sources likewise need provider-specific scope and network/API verification. |
| 11 | |
| 12 | ## Implemented contract |
| 13 | `packages/market-domain/src/licensed-ohlc-history.mjs` provides `preflightOhlcHistory` for a candidate batch. Inputs include: |
| 14 | - Canonical `symbol`, exact `providerCode`, `timeframe=1d`, declared `rawUnit`, `canonicalUnit`, an IANA `timeZone`, UTC-offset-bearing `openTime`/`closeTime`, and exchange `sessionDate`. |
| 15 | - Explicit `dataKind=source_ohlc`, four provider OHLC values and optional source volume; absent volume remains `null` (not invented zero). |
| 16 | - A separately reviewed license manifest: `status=approved`, `reviewedBy`, `reviewedAt`, `evidenceRef`, `providerCode` and `rights.commercialStorage`; public APIs additionally require `rights.publicRedistribution`. This gate **validates the provided license metadata; it cannot itself certify that the legal document is authentic**. Maintain signed provider contracts outside the public/code repository and only a non-secret evidence reference in GitHub. |
| 17 | - Exact fixed base-10 string normalization for recognized units (currently IRR→IRT /10 for USD and gold 18K), with no implicit buy/sell or gram/ounce conversion. Any unapproved unit pair is rejected. |
| 18 | - Timestamp/price validity, OHLC order, deduplication of exactly matching observations, conflict rejection, and out-of-order counting. |
| 19 | - Optional independently verified exchange session calendar `isSessionDay`. Gap reporting does not synthesize sessions. No public annual publication readiness without a real calendar, a 365+ **date span**, zero missing expected sessions across the **entire requested window**, zero unexpected closed sessions, and zero conflicting/out-of-order observations. |
| 20 | - Preflight marks candidate bars `DEGRADED` with reason `source_ohlc_not_cross_verified`; it does not declare market/source truth or invent a positive quality score. |
| 21 | |
| 22 | ## Outstanding production requirements |
| 23 | - Legal review/evidence for each provider (storage, public display, attribution, derived metrics, retention, redistribution and API sublicensing); do not equate possession of an API key with redistribution rights. |
| 24 | - Licensed provider adapter and validation of real payload response / rate limit / timestamp semantics; no samples or test fixtures are production data. |
| 25 | - Auditable immutable raw observation + normalized OHLC staging in a transaction, mapping to `instruments` and `providers`, with an idempotent unique key. The current `candles` table cannot store provider license/source attribution on its own: add provenance linkage or a separate source-observation record before live OHLC import. |
| 26 | - Exchange calendar confirmed against Iranian session trading schedules and closures; implement quarantine/manual review for spike/outlier/OHLC revisions. |
| 27 | - At least one independently validated year of each *requested* instrument; ECB rates do not satisfy Iranian market one-year OHLC requirements. |
| 28 | - Technical indicator and prediction backtesting must account for candle availability, warmup periods, data revisions, look-ahead and survivorship biases, train/test temporal splits, and uncertainty; do not represent model outputs as certainty. |
| 29 | |
| 30 | ## Verified local tests (test fixtures only) |
| 31 | - Domain suite: **85/85 PASS** via `npm test`. |
| 32 | - Worker/history tests: **14/14 PASS** with `node --test deploy/chartnova/history-ui-sync.test.mjs deploy/chartnova/history-security.test.mjs deploy/chartnova/history-direct.test.mjs deploy/chartnova/history-endpoints.test.mjs`. |
| 33 | - Worker syntax: `node --check deploy/chartnova/worker.mjs` PASS. |
| 34 | - These are local/isolated-branch results. They do **not** establish a deployed direct Worker-Neon authenticated query or a licensed annual OHLC dataset. |
| 35 | |
| 36 | ## Rollback |
| 37 | The new validator is not wired into live ingestion. Revert its commits / omit the validator module without touching the existing Neon tables or the deployed ECB-KV history. Existing user's dirty local worktree and pending `0005_navasan_private_daily_ohlc.sql` are intentionally not overwritten. |
| 38 | |
| 39 | ## Sources for humans to verify license scope |
| 40 | - Navasan official webservice guide: https://www.navasan.tech/webserviceguide/ |
| 41 | - ECB public EXR methodology: https://www.ecb.europa.eu/stats/exchange_rates/html/index.en.html |
| 42 | |
| 43 | ## Independent audit finding — local, uncommitted migration |
| 44 | A read-only inspection of the user's existing **untracked** `db/migrations/0005_navasan_private_daily_ohlc.sql` found its provider mapping sets `raw_unit` to `IRT`, whereas the committed Navasan adapter `packages/market-domain/src/adapters/navasan.mjs` declares `IRR_PER_USD` / `IRR_PER_GRAM` and divides input prices by ten. Those assumptions must be reconciled against a provider-supplied unit contract and actual response before any DB migration/import. Do **not** infer from a price's magnitude whether it is IRR or IRT. The untracked migration was **not modified or executed**; there is no new public Navasan view. |