stock-bot/apps/stock
2026-10-28 13:48:41 -04:00
..
analytics Unify analytics calculations and fail closed on unavailable data 2026-10-21 19:28:21 -04:00
config fix(monitoring): report observed research and paper readiness (O02) 2026-10-28 12:58:38 -04:00
data-ingestion Extract shared calculations and preserve legacy research capabilities 2026-10-21 20:27:07 -04:00
data-pipeline safety 2026-10-20 18:36:19 -04:00
engine refactor(engine): share strict native financial views (CL18) 2026-10-26 20:30:01 -04:00
orchestrator fix(monitoring): report observed research and paper readiness (O02) 2026-10-28 12:58:38 -04:00
scripts refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
web-api fix(api): reject retired backtest creation before writes (CL23) 2026-10-28 13:48:41 -04:00
web-app fix(web): replace prototype dashboard with research workbench (CL24) 2026-10-28 13:43:39 -04:00
package.json first refactor 2026-10-20 12:39:38 -04:00
README.md fix: clean up service configuration startup and development commands 2026-10-26 13:23:49 -04:00
TRADING_SYSTEM_README.md docs: align stock readmes with current research platform 2026-10-24 18:59:32 -04:00
tsconfig.json work on spider for te 2025-07-06 15:26:47 -04:00

Stock platform

For the complete local research stack, run bun run infra:up then bun run dev:research from the repository root after the initial build. The API, orchestrator and browser use ports 2003, 2004 and 5173. This preserves existing data and does not activate trading.

The stock application combines a TypeScript research workbench and strategy runtime with an authoritative Rust financial engine.

Start with Understanding Stock Bot. It explains the connected system, follows a complete backtest, and introduces the actual strategy API.

Applications

Folder Responsibility
web-app React interface for strategies, backtests, experiments, research and paper deployment review.
web-api Research APIs, database migrations, durable submission and dispatch, result retrieval and WebSocket updates.
orchestrator Durable research workers and explicitly configured paper execution.
engine Native Rust replay, matching, risk, ledger and financial reports. Loaded by Bun; it is not a separate HTTP service.
data-ingestion Provider integration and raw data collection.
data-pipeline Provider exchange/symbol metadata normalization and catalog synchronization.
config Stock-specific configuration and shared application contracts.

The system map explains their databases, queues, shared libraries and process boundaries. Replay of retained historical input does not need another provider fetch. Service startup still needs the stores enabled by its configuration and dependency container.

Build and development

Run the repository-wide install, build and checks from the repository root, following the root README. That build includes shared libraries and the native engine.

After the required local services and configuration are ready, individual development entrypoints are:

bun run --cwd apps/stock/web-app dev
bun run --cwd apps/stock/web-api dev
bun run --cwd apps/stock/orchestrator dev

Run these in separate terminals from the repository root. The frontend alone does not run backtests; the API and orchestrator handle admission and execution. Ingestion and pipeline are additional entrypoints when you need to collect source data or synchronize the catalog.

Open http://localhost:5173 and sign in with STOCK_BOT_ADMIN_TOKEN from the root .env. Both STOCK_BOT_ADMIN_TOKEN and STOCK_BOT_SERVICE_TOKEN must be configured as distinct values of at least 32 characters before starting HTTP services. The API uses port 2003; the orchestrator uses 2004. The frontend has a fixed port to avoid colliding with Docker's Grafana (3000) and Bull Board (3001) or silently moving to an unapproved browser origin.

Stock configuration is loaded by config-instance.ts, with stock-specific validation in stock-app.schema.ts. HTTP authentication/session behavior is in the shared security module. Keep backend credentials out of frontend build variables.

Supported execution

Current web research uses retained strategy versions and datasets, one execution asset/series, cash-funded long-only accounting, and the canonical Rust engine. Research candidates execute in isolation. Paper execution requires separate review, configuration and activation; live broker execution is disabled.

TRADING_SYSTEM_README.md preserves an earlier design. Its proposed interfaces, performance descriptions and live-trading claims do not describe the current connected runtime.