A multi-engine crypto trading system for HyperLiquid perpetuals. Runs strategies in Paper (dry_run) or Live mode, with a kill-switch, circuit-breaker-ready runner, and a server-rendered PWA dashboard.
This
main/directory is the deployable application and the git repository root. All source, docs, and config live here. Secrets (cookies.txt,.env) are gitignored. Database files live indata/(gitignored).
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env_example .env # fill AGENT_API_KEY, HL creds for live
uvicorn main:app --host 0.0.0.0 --port 8792Open http://localhost:8792/ → login with DASHBOARD_USERNAME / DASHBOARD_PASSWORD.
main/
├── main.py # FastAPI app entry
├── config.py # Config (Config class)
├── CONTEXT.md # Why / how we think (operator working doc)
├── NOTES.md # Engineering log
├── BACKLOG.md # Bug-report tracking ledger
├── api/ # REST routers (instances, killswitch, metrics, ...)
├── app/ # UI: routes, templates, static
├── instances/ # Engine runtime: runner, manager, models, events
├── engine/ # Strategy registry + implementations
├── core/ # exchange client, market data
├── backtests/ # Backtest engine
├── testing/ # Unified runner (paper|backtest), isolated store
├── withdrawal/ # Scheduler + manual
├── monitoring/ # Alerts, rotator, tracker, testing_pool
├── design-system/ # MASTER.md (palette authority)
├── docs/ # Architecture contract (README, VOCABULARY, ARCHITECTURE, ...)
├── tests/ # Test suite
├── pinescript-tv/ # Pine Script equivalents
├── scripts/ # Standalone worker (port 9999)
└── data/ # SQLite DBs (gitignored)
docs/README.md— doc indexdocs/ARCHITECTURE.md— module map (current + target)docs/VOCABULARY.md— domain termsdocs/DECISIONS.md— Architecture Decision Recordsdocs/REFACTOR_PLAN.md— executable architecture contractdocs/STYLEGUIDE.md— code styledocs/AI_RULES.md— rules for coding agentsdocs/CONTRIBUTING.md— how to contributedocs/TASK-LIST.md— work items / statusdocs/ROADMAP.md— milestones
- 3-way separation: LIVE (dry_run=False) / PAPER (dry_run=True) / BACKTEST (isolated store)
- MASTER.md wins design palette
- Worker stays standalone (port 9999, not merged)
- Seed engine-1 only on fresh accounts
- CONTEXT.md / NOTES.md at repo root (operator navigation)
- Kill switch (
POST /kill/global) closes all positions first. stop_instancemarket-closes before stopping.- Never flip
dry_run=Falsewithout explicit confirmation.
[Specify]