Intelligence, Advanced Charting & Trading Platform

1 # ChartNova multi-market foundation — implementation checkpoint
2
3 **Date:** 2026-10-12
4 **Branch:** `feature/chartnova-multimarket-chart-ws-foundation`
5 **Pull request:** https://github.com/davoodmehraban89/VELYQOR/pull/24 (draft; based on draft PR #23)
6 **Status:** Runnable development scaffold and local tests pass; **not deployed, not data-provider integrated**.
7
8 ## Implemented in this branch
9
10 - Standalone `apps/market-terminal` React + Vite market terminal with TradingView Lightweight Charts v5 Canvas; production JS/CSS output builds. Current verified ECB reference history uses a **line**, not a fictional candlestick. Licensed source OHLC route uses CandlestickSeries when a compliant backend is connected. Visible TradingView attribution remains.
11 - `packages/market-feed/src/contracts.mjs`: provider-neutral records with explicit symbol, unit, source, source/receive timestamps, quality, rights and provenance; no public publish for research-only or invalid data.
12 - `packages/market-feed/src/adapters.mjs` and `providers.mjs`: CoinGecko market-chart point normalization, bounded historical request planning, Binance venue-specific genuine kline parsing, optional yfinance research-only bridge, explicit pending Polygon/Navasan/Bonbast capabilities. No provider data were fetched or imported here.
13 - `packages/market-feed/src/history-api.mjs`: unmounted, bounded `GET /api/v2/history` repository port requiring licensed data and a read-only persistence adapter. Metadata now reports `rights: approved_public` only after backend rights gate passes. Web frontend adapter supports both the currently live legacy ECB REST schema and future provider-neutral REST schema (hourly timestamps, daily session dates and actual source OHLC).
14 - Selected WSS protocol: `deploy/chartnova/market-stream-worker.mjs` and `deploy/chartnova/wrangler.realtime.example.toml` — one Durable Object per symbol; public read subscriptions, private authenticated publisher, allowlist/Origin checks, payload bound, capped sockets, persisted monotonic sequence. React UI uses `/stream?symbol=...` and `stream.subscribe`. `realtime-gateway.mjs` is an alternative un-deployed design, **not** the frontend target. No DO or paid Cloudflare resources created.
15 - `apps/market-terminal/package-lock.json` enables deterministic `npm ci`. `apps/market-terminal/README.md`, ADR-0004 and provider matrix document limitations. Existing Windows user's modified worktree and untracked Navasan migration were not edited.
16
17 ## Independent local verification
18
19 From a clean isolated Git worktree on the authorized device:
20
21 - `npm test`: **117/117 PASS** (existing market domain + new feed/gateway + REST→chart integration).
22 - `node --check deploy/chartnova/market-stream-worker.mjs`: **PASS**.
23 - `cd apps/market-terminal && npm ci --no-audit --no-fund && npm run build`: **PASS** (Vite 6.4.4; 35 modules transformed; JS bundle generated).
24 - Earlier isolated reusable `packages/chart-ui` TypeScript check was reported as PASS in the prior branch checkpoint; this is not a browser E2E proof.
25 - yfinance research Python CLI was added, but **Python is unavailable on the Windows device**. Its actual runtime/yfinance interaction is **not tested**.
26 - GitHub Actions for PR #24 were previously **RED**. CI logs were not retrievable via the connected GitHub API (BlobNotFound); keep PR draft and do not describe it as green.
27 - No real staging WebSocket upgraded, no provider subscription or publisher connected, no live REST→licensed-Neon integration/latency measurements completed.
28
29 ## Production invariants (last directly verified)
30 - Neon: 762 ECB reference points; `candles` count = 0.
31 - Restricted role `chartnova_history_ro` remains, currently `NOLOGIN`.
32 - Removed privileged role `chartnova_history_reader` remains absent.
33 - Live `velyqor-preview` Worker binding names: `MARKET_CACHE`, `NAVASAN_API_KEY`, `OANOR_API_KEY`; **no** `CHARTNOVA_HISTORY_DATABASE_URL` or WebSocket Durable Object binding.
34 - No production website deployment occurred.
35
36 ## External prerequisites, prioritized
37
38 1. **Licensing and price semantics:** documented rights to query/store/display/commercially redistribute provider data, per market and quote side. Confirm Navasan IRR vs IRT and per-gram vs mesghal; written Bonbast/Poylgon terms and endpoint specifications. yfinance is research-only unless separate Yahoo data rights are obtained.
39 2. **Provider entitlements/credentials:** approved server-only keys for CoinGecko and Navasan/Bonbast/Polygon as applicable; verify Demo quota and actual 365d hourly retrieval rather than assuming it; Binance region/API reachability (prior 451). Do not put keys in Vite env or GitHub.
40 3. **Secure read-only history:** administrator-assisted scoped Neon reader credential through secret manager, schema view and authorized actual OHLC persistence pipeline; independently verify one-year date coverage and source provenance.
41 4. **Cloudflare staging and spend:** choose approved hostname/route, Cloudflare DO/billing authorization, `STREAM_INGEST_TOKEN` secret, origin/rate limits and WAF/Access. Deploy *staging* before production, instrument latency/connection counts/provider outages and rollback.
42 5. **Market requirements:** confirm initial requested symbols/markets and timeframe/quote-side resolution for crypto, Forex, equities, Iran. Decide true live latency and allowed free/paid quotas.
43 6. **Release gates:** live E2E API and WebSocket tests (plus gaps/reconnect/backpressure), clean browser UI, quality/indicators/backtest no-lookahead, green GitHub CI and explicit release approval.
44
45 ## Restore / rollback
46 This branch is additive and isolated. Existing `velyqor-preview` serves today's deployed ECB/KV and domestic/widget API paths. No production rollback action is needed because no production configuration was changed. Do not merge PR #24 ahead of PR #23's security/CI resolution.