@davoodmehraban89 / VELYQOR / commits / ad22671
Fork 0

Intelligence, Advanced Charting & Trading Platform

Phase 0: establish VELYQOR foundation

* docs: define VELYQOR product scope * docs: add autonomous engineering rules * docs: establish project state ledger * docs: record foundation architecture decisions * docs: define canonical market data contracts * chore: add repository ignore rules * chore: establish workspace manifest * ci: add phase zero verification workflow * chore: add initial lockfile

davoodmehraban89 committed Oct 5, 2026 at 09:51 UTC ad22671a35b5a91c0771f1d1208b11dad2e6b21a
9 files changed +290 -2
.github/workflows/ci.yml new
+34
@@ -0,0 +1,34 @@
1 +name: CI
2 +
3 +on:
4 + pull_request:
5 + push:
6 + branches: [main]
7 +
8 +permissions:
9 + contents: read
10 +
11 +jobs:
12 + verify:
13 + runs-on: ubuntu-latest
14 + timeout-minutes: 15
15 + steps:
16 + - name: Checkout
17 + uses: actions/checkout@v4
18 +
19 + - name: Setup pnpm
20 + uses: pnpm/action-setup@v4
21 + with:
22 + version: 10.17.1
23 +
24 + - name: Setup Node.js
25 + uses: actions/setup-node@v4
26 + with:
27 + node-version: '20.19.0'
28 + cache: pnpm
29 +
30 + - name: Install dependencies
31 + run: pnpm install --frozen-lockfile
32 +
33 + - name: Verify
34 + run: pnpm verify
.gitignore new
+26
@@ -0,0 +1,26 @@
1 +# dependencies
2 +node_modules/
3 +.pnpm-store/
4 +
5 +# Next.js
6 +.next/
7 +out/
8 +
9 +# tests / coverage
10 +coverage/
11 +playwright-report/
12 +test-results/
13 +
14 +# local env / secrets
15 +.env
16 +.env.*
17 +!.env.example
18 +
19 +# local tooling
20 +.DS_Store
21 +*.log
22 +.vercel/
23 +.wrangler/
24 +
25 +# worktrees
26 +.worktrees/
AGENTS.md new
+32
@@ -0,0 +1,32 @@
1 +# VELYQOR Engineering Rules
2 +
3 +## Mission
4 +Build VELYQOR as a commercial-grade market intelligence platform. Correctness, provenance, security, maintainability, and observable behavior take priority over demo speed.
5 +
6 +## Operating model
7 +One coordinator owns scope, sequencing, dependencies, acceptance gates, and integration. Specialist ownership is split into Market Data & Quant, Platform & Database, Chart & UX, AI/News/Research, and QA/Security/Release. Every task has exactly one primary owner.
8 +
9 +## Mandatory rules
10 +1. Read this file and `PROJECT_STATE.md` before modifying the repository.
11 +2. Inspect the real repository/runtime state before proposing reconstruction.
12 +3. Do not fabricate data, test results, deployment state, provider availability, or connector state.
13 +4. Do not expose secrets or commit credentials.
14 +5. Use current official documentation/Context7 for version-sensitive APIs.
15 +6. New behavior and bug fixes follow test-first development where executable test infrastructure exists.
16 +7. Market calculations must be deterministic, unit-explicit, timestamp-aware, and reproducible.
17 +8. Raw provider observations are immutable audit evidence; normalization creates separate canonical records.
18 +9. Provider-specific parsing and symbols must not leak into the core domain.
19 +10. All backend canonical timestamps are UTC. UI localization is a presentation concern.
20 +11. A stale or invalid price must never be presented as healthy live data.
21 +12. Derived values must retain source timestamps, source values, formula/calculation version, and quality status.
22 +13. AI output is explanatory/analytical evidence, never authoritative market truth.
23 +14. AI/signals may never directly execute an order. A future trading layer requires independent risk and order management.
24 +15. Avoid premature microservices. MVP architecture is a modular monolith plus ingestion workers.
25 +16. PostgreSQL is the canonical market/application datastore. Edge stores are caches/coordination mechanisms only.
26 +17. Destructive, public, paid, or sensitive-access actions require explicit authorization unless already specifically authorized for that action.
27 +
28 +## Definition of Done
29 +A task is Done only when implementation exists, acceptance criteria were checked, relevant tests pass, documentation is updated when needed, security/data-quality impact is considered, CI is green when available, and no material unresolved blocker is hidden.
30 +
31 +## Change ledger
32 +For multi-step work, update `PROJECT_STATE.md` with material decisions, completed work, open risks, blockers, and next checkpoint. Never mark unverified work complete.
PROJECT_STATE.md new
+59
@@ -0,0 +1,59 @@
1 +# VELYQOR Project State
2 +
3 +Last updated: 2026-10-05
4 +
5 +## Current phase
6 +Phase 0 — Foundation & Governance
7 +
8 +## Product scope locked for MVP
9 +- Iran free-market USD/IRT
10 +- Iran 18K gold/IRT market price
11 +- Global XAU/USD
12 +- Theoretical 18K gold/IRT
13 +- Gold market premium/discount absolute and percentage series
14 +- Professional charting, drawing tools, technical indicators, overlays, and persistent user workspaces
15 +
16 +## Architecture baseline
17 +- Modular monolith for the MVP.
18 +- TypeScript/React/Next.js web application; exact package versions are pinned when implementation begins.
19 +- PostgreSQL as canonical datastore; Supabase is the preferred MVP PostgreSQL/Auth/Realtime platform, pending project connection.
20 +- Cloudflare as edge/runtime/cache/protection layer, not the primary database.
21 +- Provider adapters feed immutable raw observations, normalization, quality gates, candle construction, and derived-series calculation.
22 +- UTC canonical storage; Asia/Tehran presentation.
23 +
24 +## Connection priority
25 +P0: GitHub, Context7, PostgreSQL/Supabase, Cloudflare.
26 +P1: Figma, Notion.
27 +P2: TradingCursor (benchmark/research only), Gmail, Railway/Render if a demonstrated need appears.
28 +
29 +## Completed
30 +- Independent private GitHub repository created: `davoodmehraban89/VELYQOR`.
31 +- Initial `main` branch established by owner.
32 +- Foundation branch created: `foundation/phase-0`.
33 +- Product README normalized.
34 +- Engineering/agent operating rules added.
35 +- Next.js current documentation checked through Context7; current v16 documentation requires Node.js >=20.9 and supports TypeScript/App Router defaults.
36 +
37 +## In progress
38 +- Architecture Decision Records.
39 +- Canonical instrument/unit/time contracts.
40 +- Repository skeleton and CI baseline.
41 +- Supabase/PostgreSQL connection.
42 +- Cloudflare environment connection.
43 +- Phase 1 provider research and data proof.
44 +
45 +## Blockers / external actions
46 +- Supabase project for VELYQOR is not yet identified/connected.
47 +- Cloudflare application/environment for VELYQOR is not yet identified/connected.
48 +- Figma and Notion project spaces are not required to start data proof, but are pending for P1.
49 +
50 +## Risks
51 +- Iranian market-data providers may have licensing, timestamp-quality, anti-bot, history, or reliability limitations.
52 +- UI timeframe availability must be constrained by actual observation frequency; synthetic precision is prohibited.
53 +- XAU/USD and USD/IRT source timestamps require explicit alignment and staleness thresholds for theoretical gold.
54 +
55 +## Next checkpoint
56 +1. Commit initial ADRs and data contracts.
57 +2. Establish minimal TypeScript/Next.js repository skeleton and CI.
58 +3. Connect/create PostgreSQL/Supabase resources.
59 +4. Begin provider research and implement the first raw-ingestion proof only after provider/legal/technical suitability is documented.
README.md
+29 -2
@@ -1,3 +1,30 @@
1 # VELYQOR
2 -Intelligence, Advanced Charting & Trading Platform
3 -ok
2 +
3 +**Iran Market Intelligence, Advanced Charting & Trading Platform**
4 +
5 +VELYQOR is a market-intelligence platform focused first on Iranian free-market USD and domestic 18K gold, connected to global XAU/USD data and derived valuation analytics.
6 +
7 +## MVP
8 +
9 +- `USD_IRT_FREE` — Iran free-market USD/IRT
10 +- `GOLD18_IRT` — Iran 18K gold market price
11 +- `XAU_USD` — global gold spot price
12 +- `GOLD18_THEORETICAL_IRT` — theoretical 18K gold value derived from XAU/USD × USD/IRT
13 +- `GOLD18_PREMIUM_IRT` and `GOLD18_PREMIUM_PCT` — market premium/discount
14 +- Professional charting, drawings, indicators, comparison overlays, and persistent workspaces
15 +
16 +## Engineering principles
17 +
18 +- PostgreSQL is the market-data source of truth.
19 +- Raw provider observations are retained for auditability.
20 +- All normalized backend timestamps are UTC; Iran-facing presentation uses `Asia/Tehran`.
21 +- Derived prices retain source provenance and calculation version.
22 +- Provider-specific behavior stays behind adapters.
23 +- AI is not a market-price source and cannot directly execute orders.
24 +- The MVP begins as a modular monolith; services are extracted only when evidence requires it.
25 +
26 +## Current phase
27 +
28 +**Phase 0 — Foundation & Governance**
29 +
30 +See `PROJECT_STATE.md` and `docs/architecture/` for the current execution state and architecture decisions.
docs/architecture/ADR-0001-foundation.md new
+22
@@ -0,0 +1,22 @@
1 +# ADR-0001: MVP Foundation Architecture
2 +
3 +Status: Accepted
4 +Date: 2026-10-05
5 +
6 +## Context
7 +VELYQOR must validate Iranian USD/gold charting and derived gold valuation quickly without creating an architecture that blocks future AI, community, additional markets, or trading capabilities.
8 +
9 +## Decision
10 +1. Start as a modular monolith plus independently schedulable ingestion workers.
11 +2. PostgreSQL is the canonical application and market datastore.
12 +3. Supabase is the preferred MVP PostgreSQL/Auth/Realtime platform, while domain/data contracts remain PostgreSQL-portable.
13 +4. Cloudflare is used for edge delivery, caching, protection, and suitable worker workloads; D1/KV/Durable Objects do not replace the canonical PostgreSQL market store.
14 +5. Market providers are isolated behind adapters.
15 +6. Raw observations are retained separately from normalized ticks/candles.
16 +7. Backend canonical timestamps are UTC; Iran-facing UI uses Asia/Tehran.
17 +8. Derived values retain complete source provenance and calculation version.
18 +9. TradingCursor, if used, is an external research/benchmark provider and never a production market-price source of truth.
19 +10. AI cannot directly execute trades; a future trading layer requires independent risk/order controls.
20 +
21 +## Consequences
22 +This favors correctness, auditability, lower MVP operational complexity, and future extraction of genuinely high-load modules. It deliberately rejects premature microservices and provider-specific core logic.
docs/data/market-contracts.md new
+68
@@ -0,0 +1,68 @@
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.
package.json new
+12
@@ -0,0 +1,12 @@
1 +{
2 + "name": "velyqor",
3 + "version": "0.0.0",
4 + "private": true,
5 + "packageManager": "pnpm@10.17.1",
6 + "engines": {
7 + "node": ">=20.9.0"
8 + },
9 + "scripts": {
10 + "verify": "pnpm --if-present lint && pnpm --if-present typecheck && pnpm --if-present test && pnpm --if-present build"
11 + }
12 +}
pnpm-lock.yaml new
+8
@@ -0,0 +1,8 @@
1 +lockfileVersion: '9.0'
2 +
3 +settings:
4 + autoInstallPeers: true
5 + excludeLinksFromLockfile: false
6 +
7 +importers:
8 + .: {}