refactor: pre-M0 cleanup, core library hardening, and isolated dev/QA Docker stack
- Remove ~44k LOC of dead code, legacy v1 TS simulator/strategy stack, event-bus, analytics FastAPI prototype, legacy calculation archives, and unused deps (data-ingestion provider API handlers untouched) - Extract @stock-bot/di/http-security and isolate @stock-bot/browser to data-ingestion via ServiceContainerBuilder.withRegistrations() - Harden @stock-bot/mongodb read-only proxies, flatten @stock-bot/postgres with unified master+research migrations, and fix @stock-bot/config EnvLoader, ServiceApplication worker lifecycle, NamespacedCache.clear(), and BatchProcessor error propagation - Flatten workspace root (remove apps/stock/package.json) and collapse orchestrator re-export shims - Pin all Docker image versions, add shm_size/nofile/RAM caps and docker-compose.quant.yml, fix 05-add-visible-column.sql view recreation, and decouple dev/QA Compose project names for side-by-side execution - Update PLATFORM-PLAN, DATA-CONTRACTS (bars_1m PARTITION BY MONTH, Rust bulk ETL, DuckDB limits), MILESTONES, and servers docs
This commit is contained in:
parent
ce9e2df67c
commit
4cd6038063
432 changed files with 1247 additions and 44469 deletions
|
|
@ -129,7 +129,18 @@ Plus `resolution_conflict`, `override` (keyed by `(source, source_id, valid_from
|
|||
|
||||
### A. DuckDB + Hive Parquet (`/mnt/data/stockbot/curated/`)
|
||||
|
||||
All Parquet files use `ZSTD` compression, integer `listing_id` (`INT32`), UTC `TIMESTAMPTZ` (`ts`, `known_at`), and explicit `known_at_source`:
|
||||
All Parquet files use `ZSTD` compression, integer `listing_id` (`INT32`), UTC `TIMESTAMPTZ` (`ts`, `known_at`), and explicit `known_at_source`.
|
||||
|
||||
- **Bulk ETL rule (`tools/curate-etl`):** Multi-hundred-million and multi-billion-row collections (`eodPrices` `846M`, `eodIntraday1M` `3.40B`, `eodIntraday5M` `1.08B`, `qmFilings` `30.5M`) are curated via a dedicated Rust binary in the Cargo workspace (`mongodb::bson::RawDocumentBuf` zero-copy BSON cursors + in-RAM `provider_mapping`/`qmSplits` lookup tables + `rayon` sharded `parquet`/ILP writers)—**never** through single-threaded JS/Node object-allocation loops.
|
||||
- **DuckDB connection budget:** Every `MarketDataStore` (TS) and `stockbot.data` (Python) DuckDB instance must execute at connection open:
|
||||
```sql
|
||||
SET memory_limit = '6GB';
|
||||
SET threads = 4;
|
||||
SET temp_directory = '/mnt/data/stockbot/tmp/duckdb';
|
||||
```
|
||||
(overridable via env on local dev, e.g. `2GB`/`2` threads) so concurrent campaign workers never inherit DuckDB's default `80%` host-RAM (`~100 GiB`) ceiling.
|
||||
|
||||
Schemas:
|
||||
|
||||
- **`bars_1d/year=YYYY/part.parquet`**: `(listing_id INT32, ts TIMESTAMPTZ, session_date DATE, open DOUBLE, high DOUBLE, low DOUBLE, close DOUBLE, volume DOUBLE, vwap DOUBLE, currency VARCHAR, source VARCHAR, known_at TIMESTAMPTZ)` — strictly raw OHLC and **un-adjusted** share `volume`, sorted by `(listing_id, session_date)`.
|
||||
- **`adj_factors/part.parquet`**: `(listing_id INT32, ex_date DATE, split_factor DOUBLE, div_cash DOUBLE, div_currency VARCHAR, cum_split_factor DOUBLE, cum_total_factor DOUBLE, known_at TIMESTAMPTZ)`.
|
||||
|
|
@ -146,7 +157,9 @@ All Parquet files use `ZSTD` compression, integer `listing_id` (`INT32`), UTC `T
|
|||
|
||||
### B. QuestDB `10.2.0` (Intraday & Live Streaming)
|
||||
|
||||
Image pinned to `questdb/questdb:10.2.0`. `listing_id` is stored as decimal string inside `SYMBOL CAPACITY 65536 NOCACHE` and converted to `number` (`INT32`) at the `MarketDataStore` adapter boundary:
|
||||
Image pinned to `questdb/questdb:10.2.0`. Host kernel must enforce `vm.max_map_count >= 1048576` (`/etc/sysctl.d/99-stockbot.conf`), container `ulimits.nofile` set to `1048576`, and off-heap memory bounded via `QDB_RAM_USAGE_LIMIT_BYTES=21474836480` (`20 GiB`) + JVM `-Xms2g -Xmx4g` inside a `28g` container `mem_limit` on `quant`.
|
||||
|
||||
`listing_id` is stored as decimal string inside `SYMBOL CAPACITY 65536 NOCACHE` and converted to `number` (`INT32`) at the `MarketDataStore` adapter boundary. `bars_1m` uses **`PARTITION BY MONTH`** (`270` partitions / `~3,780` files across 22.5 years at `~13.2M` rows/month, vs. `~5,670` partitions / `~79,000` files under `PARTITION BY DAY`—cutting 1-year `W2` cold partition seeks from 252 to 12 while keeping live monthly WAL `< 40 MB`):
|
||||
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS bars_1m (
|
||||
|
|
@ -161,7 +174,7 @@ CREATE TABLE IF NOT EXISTS bars_1m (
|
|||
source SYMBOL CAPACITY 8 CACHE, -- 'eod_unadj' | 'qm_raw' | 'ib_live'
|
||||
known_at TIMESTAMP,
|
||||
ts TIMESTAMP
|
||||
) TIMESTAMP(ts) PARTITION BY DAY WAL
|
||||
) TIMESTAMP(ts) PARTITION BY MONTH WAL
|
||||
DEDUP UPSERT KEYS(ts, listing_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS fx_1m (
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ Actionable build tracker for turning Stock Bot into the AI algo research & IB li
|
|||
- [ ] **Purge hardcoded credentials & close `sb-research.*` holdout leak:**
|
||||
- Rotate and remove the hardcoded Webshare proxy URL in `apps/stock/data-ingestion/src/handlers/ib/shared/config.ts:19` (read from env only) and extend `scripts/audit-secrets.ts` to catch `http(s)://user:pass@` literals; also fix `fetch-symbols.action.ts:108` (`ib_symbols` → `ibSymbols`).
|
||||
- Remove `GET /api/v2/datasets/canonical/:hash/export` from `sb-research.*` permissions in `apps/stock/web-api/src/services/research-agents.service.ts:51` and scope agent `GET` routes to granted projects/templates.
|
||||
- [ ] **Pin container tags, kernel limits & `quant` RAM caps:**
|
||||
- Replace all `:latest` / floating tags in `docker-compose*.yml` with exact pinned versions (`questdb:10.2.0`, `postgres:16.9-alpine`, `mongo:7.0.21-jammy`, `dragonfly:v1.30.3`, etc.).
|
||||
- Configure `shm_size` (`2g` on `quant`, `512m` in dev) for PostgreSQL 16 parallel workers, `ulimits.nofile = 1048576` on QuestDB/MongoDB, `/etc/sysctl.d/99-stockbot.conf` (`vm.max_map_count = 1048576`) on `quant`, and hard `mem_limit` + engine caps in `docker-compose.quant.yml` (reserving `~24 GiB` of `125 GiB` for OS page cache).
|
||||
|
||||
### Exit Criteria
|
||||
1. `CARGO_BUILD_JOBS=2 bun run check` passes all 11 gates (`0` errors, `0` warnings).
|
||||
|
|
@ -57,13 +60,14 @@ Actionable build tracker for turning Stock Bot into the AI algo research & IB li
|
|||
- Implement Pass 2 normalization (fix `provider-symbol.ts` for IB `exchangeId`/`description`; ticker root/suffix parser; ISIN Luhn validator + CUSIP→ISIN derivation; precompute `[first_bar_date, last_bar_date]` per `(source, source_id)`).
|
||||
- Implement Pass 3 two-stage matching (Stage A: global ISIN/CUSIP → `instrument`; Stage B: EOD/QM venue → `listing`, IB `conid` attached at `(instrument_id, currency)`, temporal bar-span overlap required on Tier 3/4 ticker matches) + Pass 6 OTC delisting chains (`SIVB` → `SIVBQ`).
|
||||
- Implement Pass 4 batch 25-date cross-sectional price cross-check (`{ date: { $in: sampleDates } }`) and export US+CA match & conflict report + `override` seed file.
|
||||
- [ ] **Step 2 Core — Daily, Corporate Actions, FX & Events (`Parquet + DuckDB`):**
|
||||
- [ ] **Step 2 Core — Zero-Copy Rust Bulk ETL + Daily, Actions, FX & Events (`Parquet + DuckDB`):**
|
||||
- Build `tools/curate-etl` in the Cargo workspace (`mongodb::bson::RawDocumentBuf` zero-copy BSON cursors + preloaded in-RAM `provider_mapping`/`qmSplits` tables + `rayon` sharded Zstd `parquet` writer) so `846M` `eodPrices` rows (and `3.40B` `eodIntraday1M` rows in `M2`) never iterate through single-threaded JS object loops.
|
||||
- Curate `bars_1d` (un-adjusting `eodPrices.volume` via `qmSplits` and cross-checking `qmPrices.sharevolume`).
|
||||
- Curate `corporate_actions` & `adj_factors` (`qmSplits` excluding `1:1` no-ops, `qmDividends` ignoring bogus `usdFxRate: 1`, plus OTC continuation & `-30%`/`-100%` Shumway terminal delisting events).
|
||||
- Curate `fx_1d` (`CAD.FOREX` 1971–2025 + `teMarketData.USDCAD` through 2026).
|
||||
- Curate `events` (`qmFilings` UTC-converted `timefiled` + form groups; `qmEarnings` linked to `qmFilings` or lagged to `16:05 ET` when `announceTime == 'N/A'`) and `shorts` (`ceoShorts` with `+4` Canadian business-day `known_at` lag).
|
||||
- [ ] **`MarketDataStore` + Rolling 6-Month Vault + `trial_ledger`:**
|
||||
- Implement `MarketDataStore` (TS) and `stockbot.data` (Python) over DuckDB + Parquet with mandatory `known_at <= asOf` and `ts < VAULT_CUTOFF_TS` (`max_ingested_ts - 6 months`) enforcement.
|
||||
- Implement `MarketDataStore` (TS) and `stockbot.data` (Python) over DuckDB + Parquet with mandatory `known_at <= asOf`, `ts < VAULT_CUTOFF_TS` (`max_ingested_ts - 6 months`), and per-connection `SET memory_limit = '6GB'; SET threads = 4; SET temp_directory = ...` enforcement.
|
||||
- Add PostgreSQL `trial_ledger` and `vault_evaluations` tables (protected by `reject_research_evidence_mutation()`) + canonical DSR ($\hat{N}$ effective trials) in `@stock-bot/calculations` (see [VALIDATION-AND-RIGOR.md](VALIDATION-AND-RIGOR.md)).
|
||||
- [ ] **Signal Analyzer + `marimo` Workspace:**
|
||||
- Implement `analyze_signal` and `event_study` (IC, rank-IC, quantile spreads, turnover, pre/post-2023 recency split, Newey-West $t$-stat, automatic `trial_ledger` write).
|
||||
|
|
@ -88,8 +92,8 @@ Actionable build tracker for turning Stock Bot into the AI algo research & IB li
|
|||
- Materialize 2D `(period_end, known_at)` deduplicated wide snapshots + TTM features (`fundamentals_pit`).
|
||||
- Curate `ceoPosts` (`14.8M`) separating `bot == "1"` newswires from retail posts and guarding `edited != null` text timestamps; curate lagged `teData` regime series.
|
||||
- [ ] **Intraday Curation (`QuestDB 10.2.0`):**
|
||||
- Pin `questdb/questdb:10.2.0` in `docker-compose*.yml`; replace legacy `libs/data/questdb` (`LATEST BY` → `LATEST ON`, parameterized PG queries, ILP batch writer).
|
||||
- Load split-unadjusted `eodIntraday1M` (US 2003–2025), raw `qmIntraday` (CA/US 2024–2025), and `CAD.FOREX` `1m` (`5.2M` bars) into `bars_1m` and `fx_1m` (`listing_id SYMBOL CAPACITY 65536 NOCACHE`, `DEDUP UPSERT KEYS(ts, listing_id)`).
|
||||
- Replace legacy `libs/data/questdb` (`LATEST BY` → `LATEST ON`, parameterized PGWire queries, ILP v2 batch writer); verify `vm.max_map_count >= 1048576` and `ulimits.nofile = 1048576` on `quant` before bulk load.
|
||||
- Extend `tools/curate-etl` with sharded multi-socket ILP v2 writers to stream split-unadjusted `eodIntraday1M` (`3.40B` rows, US 2003–2025), raw `qmIntraday` (CA/US 2024–2025), and `CAD.FOREX` `1m` (`5.2M` bars) into **`PARTITION BY MONTH`** `bars_1m` (`270` partitions across 22.5y) and `fx_1m` (`listing_id SYMBOL CAPACITY 65536 NOCACHE`, `DEDUP UPSERT KEYS(ts, listing_id)`).
|
||||
- [ ] **Versioned Feature Library (`D04` reopened):**
|
||||
- Build declarative SQL/Polars batch runner writing versioned `(listing_id, ts, known_at, value)` columns + `register_signal(...)` SDK entrypoint.
|
||||
|
||||
|
|
@ -108,9 +112,10 @@ Actionable build tracker for turning Stock Bot into the AI algo research & IB li
|
|||
- [ ] **Tier 1 Columnar Screener:**
|
||||
- Vectorized Polars/DuckDB portfolio sweep (`signal × universe × rebalance × cost`), writing full $M_{T \times N}$ return matrices to `trial_ledger` and computing CSCV PBO ($S = 16$).
|
||||
- [ ] **Tier 2 Rust `financial/` Multi-Asset Upgrades (`apps/stock/engine/src/financial/*`):**
|
||||
- **Task 1 — Retire JSON-over-Postgres/IPC/N-API bar path (prerequisite):** Store only `(hash, manifest, parquet_paths)` in `backtest_datasets` (retiring the `255 MB`-capped `payload JSONB` blob), pass only the manifest + read-only Parquet paths through `NativeBacktestWorker` IPC and N-API so Rust `parquet`/`arrow-rs` reads columns directly with zero JS bar objects, replace per-bar JSON stdio in `candidate-sandbox.ts` with compact Arrow IPC / `Float64Array` barrier frames, remove `serde_json::Value` triple-parsing from bulk payloads in `api/canonical.rs`, and lift single-series TS gates in `native-worker.ts`.
|
||||
- **Atomic timestamp-slice marks (`F06`):** Update all marks at timestamp `t` before checking `RiskAccount` daily-loss/drawdown latches.
|
||||
- **Simultaneous `Target` sell-netting:** Credit haircut-adjusted pending `Sell` proceeds toward same-barrier `Buy` reservations in `MatchingAccount::submit`.
|
||||
- **Feature side-channel & Arrow loader:** Pass precomputed `features` into `Replay` decision barriers and `StrategyContext`; load bars/features from Parquet/Arrow paths instead of Postgres `JSONB` snapshots; remove duplicate `serde_json::Value` parse in `api/canonical.rs`; lift single-series TS gates in `native-worker.ts` and `candidate-sandbox.ts`.
|
||||
- **Feature side-channel:** Pass precomputed `features` columns into `Replay` decision barriers and `StrategyContext`.
|
||||
- **Long/short, multi-currency Margin & corporate actions:** Signed positions/targets + borrow fee accrual; `BTreeMap<Currency, Posting>` (`USD`/`CAD` cash & negative margin-loan interest + `FXCONV` sweeps + tradable FX pairs); ex-date splits, cash dividends, TSX/TSXV `100/500/1000` board-lot rounding, and OTC/Shumway delisting liquidations.
|
||||
- [ ] **Validation Suite & Engine Consolidation:**
|
||||
- Add Purged Walk-Forward & CPCV (`purge = horizon + warmup`, `embargo = max(5d, 0.01 * T)`), parameter stability surface, capacity (ADV participation), and US/CA factor exposure (`MKT`, `SMB`, `HML`, `MOM`).
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ APP (web-app): Lab (+ marimo) · Agents · Strategies · Data · Trading · Mark
|
|||
| Layer | Owns | Language |
|
||||
| --- | --- | --- |
|
||||
| `data-ingestion` | Provider crawlers → raw MongoDB (scheduled jobs disabled outside dedicated ingester) | TypeScript |
|
||||
| `data-pipeline` | Entity resolution, split/volume un-adjustment, PIT curation, batch features → Postgres + Parquet + QuestDB | TypeScript + Python/DuckDB batch |
|
||||
| `data-pipeline` + `curate-etl` | Entity resolution & orchestration (TS), zero-copy BSON bulk bar ETL (`tools/curate-etl` in Rust), PIT/feature batch jobs → Postgres + Parquet + QuestDB | TypeScript + Rust (`RawDocumentBuf`/Arrow/ILP) + Python/DuckDB |
|
||||
| Research kernel | Single API + MCP server enforcing vault cutoff, budgets, trial ledger, and canonical metrics | TypeScript (`web-api` / `orchestrator` / `@stock-bot/calculations`) |
|
||||
| Engine | Authoritative accounting, multi-currency margin ledger, corporate actions, fills, risk, replay | Rust (`apps/stock/engine/src/financial`) |
|
||||
| Python SDK + marimo | Exploration, Signal Analyzer, Event Study, Tier 1 columnar screener, feature batch definitions | Python (`polars`, `duckdb`, `marimo`) |
|
||||
|
|
@ -176,9 +176,10 @@ Full schemas and SQL contracts live in **[DATA-CONTRACTS.md](DATA-CONTRACTS.md)*
|
|||
### Access rules & performance targets
|
||||
|
||||
1. **One access contract (`MarketDataStore` in TS, `stockbot.data` in Python).** Every non-vault call enforces `ts < VAULT_CUTOFF_TS` and `known_at <= asOf` inside the adapter. No raw-SQL escape hatch is exposed to agents; human localhost sessions may query read-only pre-vault DuckDB views.
|
||||
2. **Storage hygiene.**
|
||||
2. **Storage & memory hygiene.**
|
||||
- `MarketDataStore` and Parquet expose `listing_id` as `INT32`; inside QuestDB `10.2.0`, `listing_id` is stored as `SYMBOL CAPACITY 65536 NOCACHE` so `LATEST ON` backward partition scans and `ASOF JOIN` fast paths work without JVM heap bloat.
|
||||
- Sealed `>90d` QuestDB `bars_1m` partitions may be compressed in-place (`ALTER TABLE bars_1m CONVERT PARTITION TO PARQUET`) if NVMe capacity requires it; recent partitions remain native mmap.
|
||||
- QuestDB `bars_1m` uses **`PARTITION BY MONTH`** (`270` partitions across 22.5y instead of `~5,670` daily partitions) with host `vm.max_map_count >= 1048576`, `ulimits.nofile = 1048576`, and `QDB_RAM_USAGE_LIMIT_BYTES` capped (`20 GiB` on `quant`). Sealed `>90d` monthly partitions may be compressed in-place (`ALTER TABLE bars_1m CONVERT PARTITION TO PARQUET`) if NVMe capacity requires it; recent partitions remain native mmap.
|
||||
- Every DuckDB connection explicitly sets `memory_limit = '6GB'`, `threads = 4`, and `temp_directory` on `quant` (instead of DuckDB's `80%` host-RAM default), leaving `~24 GiB` of `quant`'s `125 GiB` unallocated for Linux NVMe page cache.
|
||||
3. **Measured storage targets on `quant` (`12900K`, SN850X NVMe):**
|
||||
- **W1:** 20y US+CA daily universe (~15k active+delisted listings, ~45M bars) + 1 signal IC/quantile scan: **`< 3 s` warm / `< 8 s` cold**.
|
||||
- **W2:** 1 listing, 1y of `1m` bars (~100k–200k rows) from QuestDB: **`< 250 ms` warm / `< 1 s` cold**.
|
||||
|
|
@ -264,7 +265,7 @@ Extends the existing 8-decimal Rust kernel (retiring legacy `f64` `BacktestEngin
|
|||
|
||||
- **Atomic timestamp-slice marking (`F06` fix):** Apply all instrument marks at timestamp `t` before evaluating `RiskAccount` portfolio drawdown/daily-loss latches so hedged long/short moves never trigger false intermediate halts.
|
||||
- **Simultaneous target rebalancing:** Credit haircut-adjusted pending `Sell` proceeds against same-barrier `Buy` reservations in `MatchingAccount::submit` so fully invested cross-sectional rotations execute cleanly in one barrier.
|
||||
- **Feature side-channel & Arrow loading:** Load market bars + precomputed `features` directly from Parquet/Arrow into Rust (eliminating PostgreSQL's 1 GB `JSONB` snapshot ceiling and removing double `serde_json::Value` parsing in `api/canonical.rs`), triggering JS/sandbox callbacks **only on declared rebalance barriers**.
|
||||
- **Zero-JSON market-data path & Feature side-channel:** Eliminate the 8× JSON/Zod/IPC/N-API bar path (`backtest_datasets.payload` `255 MB` `JSONB` ceiling, `structuredClone`, `fork({ serialization: 'json' })`, and `api/canonical.rs` triple `serde_json::Value` parse). Retain only `(hash, manifest, parquet_paths)` in PostgreSQL, read Parquet/Arrow columns directly inside Rust `Replay`, restrict `canonical.rs` `keys_match` to small control/config envelopes, and stream multi-asset decision-barrier slices to `candidate-sandbox.ts` as compact **Arrow IPC / flat `Float64Array` binary frames** on declared rebalance barriers.
|
||||
- **Long/short, multi-currency margin & corporate actions:** Signed quantities/targets, short borrow fee accrual, `BTreeMap<Currency, Posting>` (`USD` + `CAD` cash/margin balances with IB benchmark+spread interest on negative balances, plus tradable FX pairs), ex-date split share adjustments, cash dividend postings, TSX/TSXV board-lot sizing (`100`/`500`/`1,000` shares), and OTC/Shumway delisting liquidations.
|
||||
|
||||
### Validation suite, Trial Ledger & 6-Month Vault
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ These documents describe **what is already implemented and running in code today
|
|||
| **[guide/code-reading.md](guide/code-reading.md)** | Function-level call paths across `web-api`, `orchestrator`, and `engine` |
|
||||
| **[backtest-datasets.md](backtest-datasets.md)** | Current v2 retained dataset snapshot preparation, hashing, and local export |
|
||||
| **[data-pipeline/phase1-investigation.md](data-pipeline/phase1-investigation.md)** | Measured 31-collection QA MongoDB inventory, identifier coverage, and cross-provider tricky cases |
|
||||
| **[cleanup-audit.md](cleanup-audit.md)** | Separation between reviewed `@stock-bot/calculations` core and preserved `/legacy` functions |
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
# Shared-library cleanup: preservation and removal audit
|
||||
|
||||
This records the shared-library cleanup following `ccce401`. It does not
|
||||
claim to audit every deletion from the earlier execution/strategy refactors. The first
|
||||
pass inferred that no current imports meant no future value; that was too broad for a
|
||||
trading/feature-engineering repository. This revision separates capabilities by ownership
|
||||
and readiness instead of deleting them on usage alone.
|
||||
|
||||
| Previously removed item | Current disposition |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Active basic calculations, technical indicators, risk and performance modules | All 105 exported functions preserved in `libs/calculations/src/legacy/`, with original executable bodies. Explicit `@stock-bot/calculations/legacy` entry; not endorsed as reviewed core. |
|
||||
| Tested orchestrator equity/return/trade/performance and window math | Moved into supported `@stock-bot/calculations/analytics` and `/indicators`; report/strategy consumers migrated. No strategy checkpoint/version changes. |
|
||||
| Generic OHLCV extraction, features, grouping/filtering and timestamps | All 13 helpers restored to `@stock-bot/calculations/market-data`. SMA/return formulas delegate to reviewed core; invalid-input, VWAP and grouping behavior hardened as documented. |
|
||||
| Seven `.disabled` math modules | Full original sources preserved as verified Markdown research snapshots, including unique indicators and numerical prototypes. Not activated or silently labeled production-ready. |
|
||||
| `POSITION_SIZING_FIXES.md` | Preserved as historical research notes with an explicit warning that its correctness/production claims were not independently verified. |
|
||||
| Proxy URL and sleep helpers | Restored to `@stock-bot/utils/common` and named root exports. |
|
||||
| Date helpers | Restored to `@stock-bot/utils/dates`: validated UTC weekday/date functions; old `dateUtils` names retained as deprecated aliases. Not an exchange/holiday calendar. UTC semantics replace the old environment-dependent local calendar arithmetic. |
|
||||
| `utils` assertion facade | Remains removed. `at`/`defined` are unchanged in `@stock-bot/invariants`; all consumers import the actual owner. This removes a duplicate entry point, not the functionality. |
|
||||
| Domain-type re-exports through the calculation barrel | Domain types remain unchanged in `@stock-bot/types`; callers import the owner, rather than maintaining another re-export layer. |
|
||||
| Empty `analyzePortfolio` API | Remains removed: it returned empty objects and implemented no calculation. Real legacy/research portfolio functions are preserved above. |
|
||||
| Old generic utility test file | Its 21 existing cases were split into 13 market-data tests and 8 common/date tests at the owning packages, with UTC assertions and new boundary tests. No executed behavior coverage was discarded merely for being unused by apps. |
|
||||
| `connection-manager.test.ts.old` and `redis-cache.test.ts.old` | Remain removed as `.old` files; full source/scenarios preserved in cache test references. These were not run by the test runner. They contain 27 and 47 cases, respectively, and are not all equivalent to the active tests. Some target absent APIs; the connection-manager suite is skipped and has broken mock names. No passing coverage is claimed. |
|
||||
| Old handler-registry singleton implementation | Remains removed. The metadata/configuration/service/scheduling registry lives in `@stock-bot/handler-registry`; no imports used the `.old` singleton. Reintroducing it would create another registry authority. |
|
||||
| `simple-statistics`, unused utility dependencies/references in orchestrator/coverage CLI, and config/cache/type dependencies in general utilities | Remain removed. No live imports required them. The orchestrator now declares the actual calculation workspace; the calculation package has no infrastructure/native dependencies. |
|
||||
|
||||
## Preservation evidence and readiness
|
||||
|
||||
[The calculation inventory](../libs/calculations/migration-audit.json) records every
|
||||
previously exported math function, source provenance, legacy AST hashes and research
|
||||
source hashes. Tests verify all 105 legacy exports and their unchanged executable bodies,
|
||||
and all seven research snapshots. This proves source/capability preservation, **not**
|
||||
algorithmic correctness. The reviewed core is tested separately; legacy functions can
|
||||
still contain zero/Infinity fallbacks, inconsistent conventions or incomplete formulas.
|
||||
|
||||
[The calculation contract](../libs/calculations/README.md) specifies supported units,
|
||||
warm-up/alignment, invalid-result policies and the promotion path for legacy/research
|
||||
functions. [Research concerns](../libs/calculations/research/README.md) identify known
|
||||
limitations before reuse. Supported stock application code cannot import the legacy
|
||||
tier, and no supported math module can load it transitively.
|
||||
|
||||
The retired Redis test sources are retained as
|
||||
[connection-manager scenarios](../libs/core/cache/test/references/connection-manager-tests.md)
|
||||
and [cache scenarios](../libs/core/cache/test/references/redis-cache-tests.md). Their
|
||||
valid assertions should be ported with correct public contracts and isolated fixtures;
|
||||
archived source is deliberately not counted in any test totals.
|
||||
|
||||
This revision does not change cache production code, trading/execution behavior,
|
||||
persisted data, environment files or WCAG. General date helpers and OHLCV edge-case
|
||||
contracts are the explicit behavior corrections noted above; old legacy math remains
|
||||
unchanged and opt-in.
|
||||
|
|
@ -295,8 +295,8 @@ The deterministic selection produced **25 candidates** across 5 buckets. The sam
|
|||
[`libs/core/queue/src/queue-manager.ts`](../../libs/core/queue/src/queue-manager.ts) · [`libs/core/handlers/src/index.ts`](../../libs/core/handlers/src/index.ts) · [`apps/stock/data-pipeline/src/handlers/index.ts`](../../apps/stock/data-pipeline/src/handlers/index.ts) · [`apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts`](../../apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts) · [`apps/stock/data-pipeline/src/handlers/symbols/symbols.handler.ts`](../../apps/stock/data-pipeline/src/handlers/symbols/symbols.handler.ts)
|
||||
- **HTTP API**. Hono routers delegate to services.
|
||||
[`apps/stock/web-api/package.json`](../../apps/stock/web-api/package.json) · [`apps/stock/web-api/src/routes/exchange.routes.ts`](../../apps/stock/web-api/src/routes/exchange.routes.ts) · [`apps/stock/web-api/src/routes/pipeline.routes.ts`](../../apps/stock/web-api/src/routes/pipeline.routes.ts)
|
||||
- **Tests**. The pipeline package runs Bun tests. The Mongo workspace has an example Bun test suite.
|
||||
[`apps/stock/data-pipeline/package.json`](../../apps/stock/data-pipeline/package.json) · [`libs/data/mongodb/test/mongodb.test.ts`](../../libs/data/mongodb/test/mongodb.test.ts)
|
||||
- **Tests**. The pipeline package and environment safety suite run Bun tests.
|
||||
[`apps/stock/data-pipeline/package.json`](../../apps/stock/data-pipeline/package.json) · [`test/unit/environment-safety.test.ts`](../../test/unit/environment-safety.test.ts)
|
||||
- **Web app**. React and Vite, with the application split into feature folders.
|
||||
[`apps/stock/web-app/package.json`](../../apps/stock/web-app/package.json) · [`apps/stock/web-app/vite.config.ts`](../../apps/stock/web-app/vite.config.ts) · [`apps/stock/web-app/src/features/exchanges/ExchangesPage.tsx`](../../apps/stock/web-app/src/features/exchanges/ExchangesPage.tsx)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Timing/risk policy regressions also include adjacent_open_zero_latency, positive
|
|||
|
||||
## G2 — Durability and recovery
|
||||
|
||||
Existing [order execution](../../test/postgres/order-execution.test.ts), [strategy recovery](../../test/postgres/strategy-recovery.test.ts) and [durable backtest](../../test/postgres/durable-backtest.test.ts) cases are mandatory for touching those boundaries. Inject failures before/after decision, intent, fill, snapshot, result commits and publication. Verify stale attempt fencing, duplicate IDs, pending inputs, cancellation and restore-before-each-decision. Recovery must preserve per-effect context, not just final balances.
|
||||
Existing [canonical paper](../../test/postgres/canonical-paper.test.ts), [canonical paper crash](../../test/postgres/canonical-paper-crash.test.ts) and [durable backtest](../../test/postgres/durable-backtest.test.ts) cases are mandatory for touching those boundaries. Inject failures before/after decision, intent, fill, snapshot, result commits and publication. Verify stale attempt fencing, duplicate IDs, pending inputs, cancellation and restore-before-each-decision. Recovery must preserve per-effect context, not just final balances.
|
||||
|
||||
No tests against a development trading account/database. `bun run test:postgres` requires a disposable `stock_bot_safety*` database and dedicated Redis DB15 via `PIPELINE_TEST_DATABASE_URL` and `BACKTEST_TEST_REDIS_URL`. Provision/start containers only when execution and resource use are authorized.
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ bun run check
|
|||
bun run test:postgres
|
||||
```
|
||||
|
||||
`bun run check` runs build/types/contracts/tooling/utils/calculations/integration/native/lint and secret audit; it **does not include** disposable PostgreSQL, browser E2E or Python analytics. Run `bun run test:e2e` separately for the web workbench and `bun run test:analytics-api` if Python API behavior is touched. Native command is `cargo test -p engine --lib --offline`; missing dependencies are a reported blocker, not a pass.
|
||||
`bun run check` runs build/types/contracts/tooling/utils/calculations/integration/native/lint and secret audit; it **does not include** disposable PostgreSQL or browser E2E. Run `bun run test:e2e` separately for the web workbench. Native command is `cargo test -p engine --lib --offline`; missing dependencies are a reported blocker, not a pass.
|
||||
|
||||
The browser gate requires a built checkout, explicit `PIPELINE_TEST_DATABASE_URL` pointing to a disposable `stock_bot_safety*` database, dedicated Redis DB15 in `BACKTEST_TEST_REDIS_URL`, and Chromium. Install the pinned browser explicitly with `bun run test:e2e:install` if missing; do not install browsers implicitly during checks. The command rebuilds the frontend for same-origin production use. It exercises authenticated HTTP/WebSocket routes, durable dispatch and SQL persistence with deterministic UI fixtures plus an actual native smoke run. Fixture results are not financial-correctness evidence. Never use a development trading database or queue.
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ TypeScript owns product/application logic, strategy authoring, signal/regime com
|
|||
|
||||
## Rationale and evidence
|
||||
|
||||
Current TypeScript [applyFill](../../../../apps/stock/orchestrator/src/execution/model.ts#L108) and Rust [process_fill](../../../../apps/stock/engine/src/backtest/engine.rs#L426) are competing authorities. Consolidation removes behavioral drift; moving all authoring to Rust would reduce flexibility without proving a throughput benefit.
|
||||
Historical TypeScript `applyFill` (`orchestrator/src/execution/model.ts`, retired in pre-M0 cleanup) and Rust [process_fill](../../../../apps/stock/engine/src/backtest/engine.rs#L426) were competing authorities. Consolidation removes behavioral drift; moving all authoring to Rust would reduce flexibility without proving a throughput benefit.
|
||||
|
||||
## Alternatives and tradeoffs
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ C03 only adds unpaid-fee liability to the **existing non-reducing gross-capital
|
|||
|
||||
## Evidence / alternative costs
|
||||
|
||||
[TS amount/cost basis](../../../../apps/stock/orchestrator/src/execution/model.ts#L81), [aggregate owner attribution problem](../../../../apps/stock/orchestrator/src/execution/model.ts#L108), [native fill broadcast](../../../../apps/stock/engine/src/backtest/engine.rs#L489). Exact postings fix arithmetic, not market modeling. A full multicurrency double-entry/margin/borrow engine is not required for v1.
|
||||
Historical TS amount/cost basis and aggregate owner attribution (`orchestrator/src/execution/model.ts`, retired in pre-M0 cleanup), [native fill broadcast](../../../../apps/stock/engine/src/backtest/engine.rs#L489). Exact postings fix arithmetic, not market modeling. A full multicurrency double-entry/margin/borrow engine is not required for v1.
|
||||
|
||||
## Migration and tests
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Status: **approved by owner, 2026-10-22** (explicit “yes” to ADR-002/003/004
|
|||
|
||||
## Evidence and rationale
|
||||
|
||||
[Current same-event execution](../../../../apps/stock/engine/src/backtest/engine.rs#L249), [bar-close bid/ask](../../../../apps/stock/orchestrator/src/services/ExecutionService.ts#L224), [v1 timestamp contract](../../../../libs/core/types/src/historical-data.ts#L90), [invented VWAP](../../../../apps/stock/orchestrator/src/data/historical-dataset.ts#L230).
|
||||
[Current same-event execution](../../../../apps/stock/engine/src/backtest/engine.rs#L249), historical bar-close bid/ask (`orchestrator/src/services/ExecutionService.ts`, retired in pre-M0 cleanup), [v1 timestamp contract](../../../../libs/core/types/src/historical-data.ts#L90), [invented VWAP](../../../../apps/stock/orchestrator/src/data/historical-dataset.ts#L230).
|
||||
|
||||
## Alternatives / tradeoffs
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ TS owns SQL custody, not independent accounting. No native/DB two-phase commit a
|
|||
|
||||
## Decision durability
|
||||
|
||||
Preserve [restore-before-each-step and intent transactions](../../../../apps/stock/orchestrator/src/execution/StrategyRecovery.ts#L151), [account locks and duplicate/conflict handling](../../../../apps/stock/orchestrator/src/execution/PostgresExecutionRepository.ts#L46), and existing failure tests. Paper strategy contexts use committed event views; never substitute a later account state. Restore RNG/decision cursors along with checkpoint state.
|
||||
Preserve durable step recovery, account locks, and duplicate/conflict handling in [canonical paper execution custody](../../../../apps/stock/orchestrator/src/execution/canonical-paper.ts), along with existing failure tests. Paper strategy contexts use committed event views; never substitute a later account state. Restore RNG/decision cursors along with checkpoint state.
|
||||
|
||||
All currently supported paper order policies must be preserved or a migration explicitly refused. F05 covers market/limit and DAY/GTC/IOC/FOK; do not silently drop IOC/FOK at cutover.
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ The first isolation profile is a local Linux x86_64 Docker scratch image contain
|
|||
|
||||
## Evidence
|
||||
|
||||
[Current role model](../../../../libs/core/di/src/http/security.ts#L4) is a small operator boundary, not research isolation. [Current registry dependencies](../../../../apps/stock/orchestrator/src/strategies/StrategyRegistry.ts#L7) expose execution services that the new decision API must not expose.
|
||||
[Current role model](../../../../libs/core/di/src/http/security.ts#L4) is a small operator boundary, not research isolation. Historical `StrategyRegistry.ts` (retired in pre-M0 cleanup) exposed execution services that the new decision API must not expose.
|
||||
|
||||
## Alternatives / tradeoffs
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ flowchart LR
|
|||
WS --> UI
|
||||
```
|
||||
|
||||
Evidence: [transactional submission](../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L211), [dataset freeze](../../../apps/stock/orchestrator/src/backtest/BacktestRunner.ts#L190), [recovery](../../../apps/stock/orchestrator/src/execution/StrategyRecovery.ts#L151), [shared mode mutation](../../../apps/stock/orchestrator/src/container.ts#L101).
|
||||
Evidence: [transactional submission](../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L211), [dataset freeze](../../../apps/stock/orchestrator/src/backtest/BacktestRunner.ts#L190), legacy `StrategyRecovery.ts` (retired in pre-M0 cleanup), [container composition](../../../apps/stock/orchestrator/src/container.ts).
|
||||
|
||||
## Target: one product, one financial core
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ If a run ends with an open position, Rust values the remaining position using it
|
|||
|
||||
## 5. Save and inspect the result
|
||||
|
||||
Rust returns financial facts, including orders, fills, positions and valuation. [`buildCanonicalBacktestReport()`](../../apps/stock/orchestrator/src/backtest/canonical-result.ts) derives statistical analysis from those facts without replacing the ledger. Unavailable metrics retain an explicit reason; an absent win rate or benchmark comparison is not zero performance.
|
||||
Rust returns financial facts, including orders, fills, positions and valuation. [`buildCanonicalBacktestReport()`](../../libs/research/src/results.ts) derives statistical analysis from those facts without replacing the ledger. Unavailable metrics retain an explicit reason; an absent win rate or benchmark comparison is not zero performance.
|
||||
|
||||
`BacktestRunner` validates the result and commits it through [`PostgresBacktestRunRepository`](../../apps/stock/orchestrator/src/backtest/PostgresBacktestRunRepository.ts). Completion notifications follow persistence. The browser's [CanonicalResults](../../apps/stock/web-app/src/features/backtest/components/CanonicalResults.tsx) and [ResultProvenance](../../apps/stock/web-app/src/features/backtest/components/ResultProvenance.tsx) render this saved record. Reloading the page reads the same run; it does not rerun the simulation. WebSocket updates help refresh the display, but the database owns status and results.
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Keep history in explicit state, use engine time instead of `Date.now()`, and avo
|
|||
|
||||
## A minimal callback shape
|
||||
|
||||
Import author types from `@stock-bot/research/strategy-api`. This subpath contains only types; it exposes no native sessions, execution controllers, brokers, or storage services. Existing host imports of `contracts/canonical-strategy.ts` remain compatible.
|
||||
Import author types from `@stock-bot/research/strategy-api`. This subpath contains only types; it exposes no native sessions, execution controllers, brokers, or storage services.
|
||||
|
||||
This simple callback requests one share when its series is fresh. It demonstrates the authoring contract; it is not a validated investment strategy or a ready-to-upload candidate package.
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ The built-ins use [wholeShareTarget](../../apps/stock/orchestrator/src/strategie
|
|||
|
||||
The strategy combines these values into entry and exit decisions and remembers desired exposure through partial execution. Keep a new feature or filter similarly explicit. Reuse the [calculation library](../../libs/calculations/README.md); do not create another ledger or fill calculator. No universal signal framework is required to add a second condition.
|
||||
|
||||
For a first change, follow one parameter from [the built-in selection schemas](../../apps/stock/orchestrator/src/contracts/builtin-strategy.ts), through the calculation and decision, into the [regime fixture](../../test/fixtures/canonical-regime-research.ts). Add a small test with known prices and expected targets before trying larger datasets. Compare the filter on/off under identical inputs using [the existing comparison example](../../apps/stock/orchestrator/examples/canonical-regime-research.ts). A favorable comparison still needs held-out validation.
|
||||
For a first change, follow one parameter from [the built-in selection schemas](../../apps/stock/config/src/contracts/builtin-strategy.ts), through the calculation and decision, into the [regime fixture](../../test/fixtures/canonical-regime-research.ts). Add a small test with known prices and expected targets before trying larger datasets. Compare the filter on/off under identical inputs using [the existing comparison example](../../apps/stock/orchestrator/examples/canonical-regime-research.ts). A favorable comparison still needs held-out validation.
|
||||
|
||||
## From source code to a saved candidate
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ An untrusted candidate strategy gets another boundary: [candidate-sandbox.ts](..
|
|||
There are two different kinds of data worth keeping separate:
|
||||
|
||||
1. **Provider storage changes over time.** For example, the [EOD intraday action](../../apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts) upserts bars into MongoDB collections such as `eodIntraday1M`. These are source records, not a reproducible experiment by themselves.
|
||||
2. **A retained dataset identifies exact research input.** [Stored-source preparation](../../apps/stock/web-api/src/services/stored-dataset-preparation.ts) reads a declared range through [StorageService](../../apps/stock/orchestrator/src/services/StorageService.ts). It requires explicit metadata, converts rows into a v2 dataset, and previews its hash. [Dataset preparation](../../apps/stock/web-api/src/services/dataset-preparation.service.ts) verifies that same hash when retaining it. [Retention](../../apps/stock/orchestrator/src/data/retained-research-dataset.ts) saves the validated bars and manifest in PostgreSQL `backtest_datasets`.
|
||||
2. **A retained dataset identifies exact research input.** [Stored-source preparation](../../apps/stock/web-api/src/services/stored-dataset-preparation.ts) reads a declared range through [StorageService](../../libs/trading-runtime/src/historical-storage.ts). It requires explicit metadata, converts rows into a v2 dataset, and previews its hash. [Dataset preparation](../../apps/stock/web-api/src/services/dataset-preparation.service.ts) verifies that same hash when retaining it. [Retention](../../libs/trading-runtime/src/retained-dataset.ts) saves the validated bars and manifest in PostgreSQL `backtest_datasets`.
|
||||
|
||||
Runs select that retained content by hash. A later provider correction therefore does not silently change an earlier run's input. Importing an explicit complete dataset is another route into the same validation and retention boundary.
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ The stored-source adapter currently accepts **one raw EOD intraday series at `1m
|
|||
| **MongoDB** | Provider records and ingestion history, including the EOD bars used by stored-source preparation. Required for that ingestion/preparation path, not for replay of an already retained snapshot. |
|
||||
| **Redis-compatible storage** | BullMQ job delivery and service caches. The durable research run and its result remain in PostgreSQL. See [BacktestDispatcher](../../apps/stock/web-api/src/services/BacktestDispatcher.ts). |
|
||||
| **QuestDB** | An existing time-series adapter and historical storage route. The current web API, ingestion and pipeline entrypoints explicitly disable it in their container composition. Do not add it to the required retained-dataset research path just because the adapter exists. |
|
||||
| **Local build artifacts** | Native binary, worker bundle and retained strategy package identities are verified before execution. They supply executable code; they are not another account database. See [canonical-build.ts](../../apps/stock/orchestrator/src/backtest/canonical-build.ts). |
|
||||
| **Local build artifacts** | Native binary, worker bundle and retained strategy package identities are verified before execution. They supply executable code; they are not another account database. See [canonical-build.ts](../../libs/trading-runtime/src/canonical-build.ts). |
|
||||
|
||||
DI owns each service/global/proxy cache transport and closes only that container's connections.
|
||||
Their key prefixes and cache DB1 remain unchanged; queue data uses DB0 and each QueueManager
|
||||
|
|
|
|||
|
|
@ -37,6 +37,20 @@ All 16 containers run from `/mnt/data/stockbot` (`docker compose --env-file .env
|
|||
| | `loki` / `prometheus` | `3100` / `9090` | Centralized logs (`promtail`) & metrics |
|
||||
| | `pgadmin` / `mongo-express` | `5050` / `8081` | Database admin UIs (LAN-only) |
|
||||
|
||||
### 2.1 `quant` (`125 GiB` RAM) Memory, Shared-Memory & Kernel Budget
|
||||
|
||||
Enforced via [docker-compose.quant.yml](../docker-compose.quant.yml) + `/etc/sysctl.d/99-stockbot.conf` (`vm.max_map_count = 1048576`):
|
||||
|
||||
| Component | Engine-Internal Cap | Container `mem_limit` | Required OS / Container Settings |
|
||||
| --- | --- | --- | --- |
|
||||
| **MongoDB `7.0.21`** (`stock`) | `--wiredTigerCacheSizeGB 16` (`8` outside bulk ETL) | `24g` | `ulimits.nofile = 1048576` |
|
||||
| **QuestDB `10.2.0`** | `QDB_RAM_USAGE_LIMIT_BYTES=21474836480` (`20 GiB`), JVM `-Xms2g -Xmx4g` | `28g` | `ulimits.nofile = 1048576`, host `vm.max_map_count >= 1048576`, `bars_1m` `PARTITION BY MONTH` |
|
||||
| **PostgreSQL `16.9`** (`trading_bot`) | `shared_buffers=4GB`, `effective_cache_size=16GB`, `work_mem=64MB`, `maintenance_work_mem=1GB` | `10g` | **`shm_size: 2g`** (prevents `64m` `/dev/shm` parallel hash-join/index errors) |
|
||||
| **Dragonfly `v1.30.3`** | `--maxmemory=4gb --proactor_threads=4` | `5g` | Emulated cluster / hashtag locks |
|
||||
| **DuckDB + Workers + `web-api`** | `SET memory_limit='6GB'; SET threads=4; SET temp_directory='/mnt/data/stockbot/tmp/duckdb'` per worker | `30g` total | Prevents DuckDB's default `80%` host-RAM (`~100 GiB`) per-worker allocation |
|
||||
| **Monitoring & Admin** | Prometheus `--storage.tsdb.retention.time=15d` | `4g` total | Pinned versions across Prometheus, Loki, Grafana, Admin UIs |
|
||||
| **Linux OS Page Cache** | — | **~24 GiB unallocated** | Keeps hot SN850X NVMe Parquet & QuestDB `mmap` pages resident |
|
||||
|
||||
---
|
||||
|
||||
## 3. Local Development vs `quant` Separation
|
||||
|
|
@ -47,7 +61,7 @@ All 16 containers run from `/mnt/data/stockbot` (`docker compose --env-file .env
|
|||
| **`qa` (`quant`)** | `docker-compose.yml` + `docker-compose.quant.yml` | `10.0.0.51:5432` (`trading_bot`) | `10.0.0.51:27017` (`stock`) | `10.0.0.51:27017` (`stock`, `MONGODB_READ_URI` for `data-pipeline`) | `10.0.0.51:6379` | `10.0.0.51:9000` |
|
||||
| **Paper / Live (`9900K`)** | `docker-compose.prod.yml` (`M5`) | Isolated execution DB | None | Curated artifact pull only | Local `:6379` | Local `:9000` (90d hot window) |
|
||||
|
||||
> **Offline Local Snapshot:** The workstation's pre-migration Docker containers (`trading-bot-*`) are intentionally stopped with their local Docker volumes preserved untouched as a cold local fallback.
|
||||
> **Side-by-Side Local Execution:** On the `91 GiB` workstation, `docker-compose.dev.yml` (`stock-bot-dev-*` on `5433`/`27018`/`6380`/`9100`) and `docker-compose.yml` (`trading-bot-*` local QA stack on `5432`/`27017`/`6379`/`9000`) use non-overlapping ports, networks, and volume namespaces so both stacks run simultaneously without conflict (`./scripts/docker.sh start --dev && ./scripts/docker.sh start --qa`).
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue