stock-bot/apps/stock
2026-10-28 14:45:12 -04:00
..
analytics refactor(analytics): initialize optional capabilities lazily (CL35) 2026-10-28 14:42:39 -04:00
config refactor(runtime): expose shared admission and artifact boundaries (CL26) 2026-10-28 14:02:03 -04:00
data-ingestion refactor(data): normalize provider symbols and remove dead scaffolding (CL34) 2026-10-28 13:56:31 -04:00
data-pipeline refactor(data): normalize provider symbols and remove dead scaffolding (CL34) 2026-10-28 13:56:31 -04:00
engine refactor(engine): share strict native financial views (CL18) 2026-10-26 20:30:01 -04:00
orchestrator refactor(backtest): isolate legacy persistence capabilities (CL33) 2026-10-28 14:45:12 -04:00
scripts refactored monorepo for more projects 2025-06-22 23:48:01 -04:00
web-api refactor(api): compose research services with narrow collaborators (CL28) 2026-10-28 14:45:11 -04:00
web-app refactor(web): isolate research workflows and shared form utilities (CL30) 2026-10-28 14:42:58 -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.