diff --git a/.kiro/steering/development-process.md b/.kiro/steering/development-process.md index 394d048..f098273 100644 --- a/.kiro/steering/development-process.md +++ b/.kiro/steering/development-process.md @@ -22,7 +22,9 @@ - Frontend: Vitest + MSW (Mock Service Worker) for deterministic API mocking, tests in `frontend/src/test/` - Run Python tests: `python -m pytest tests/ -x --tb=short -q` - Run frontend tests: `cd frontend && npx vitest --run` -- Lint Python: `nix-shell -p ruff --run "ruff check services/"` +- Lint Python: `nix-shell -p ruff --run "ruff check services/"` (or `.venv/bin/ruff check services/`) +- Ruff is pinned to `ruff==0.15.10` in `requirements.txt` — CI uses the same version +- Ruff config: `ruff.toml` with `known-first-party = ["services"]` for consistent import sorting - Pre-existing test failures (not regressions): `test_extractor_prompts.py`, `test_extractor_schemas.py`, `test_filings_adapter.py`, `test_ollama_client.py` ## CI/CD — GitHub Actions diff --git a/.kiro/steering/project-context.md b/.kiro/steering/project-context.md index b55c7fc..3a593ea 100644 --- a/.kiro/steering/project-context.md +++ b/.kiro/steering/project-context.md @@ -25,6 +25,7 @@ Three-layer signal aggregation engine: - Dashboard: `https://stonks.celestium.life` - Query API: `https://stonks-api.celestium.life` - Symbol Registry: `https://stonks-registry.celestium.life` +- Trading Engine: `https://stonks-trading.celestium.life` - Superset: `https://stonks-dash.celestium.life` - Trino: `https://stonks-trino.celestium.life` @@ -72,12 +73,15 @@ When a full reset is needed: - Ollama: `ollama.ollama-service.svc.cluster.local:11434` (cluster-internal), also at `http://10.1.1.12:2701` (external), GPU: 4070 Ti Super 16GB ## Database Migrations -- Located in `infra/migrations/001_*.sql` through `017_*.sql` +- Located in `infra/migrations/001_*.sql` through `027_*.sql` - Applied automatically by `runmefirst.sh` in sorted order -- Next migration number: **018** +- Next migration number: **028** - Key migrations: - 016: Global news interpolation (global_events, macro_impact_records, exposure_profiles, trend_projections) - 017: Competitive intelligence (competitor_relationships, competitive_signal_records) + - 024: Trend history time-series table + - 026: AI agents management (ai_agents, agent_performance_log) + - 027: Agent variants (agent_variants table for A/B testing) ## Key Conventions - All services use `services/shared/config.py` for configuration via env vars diff --git a/README.md b/README.md index 953b412..9e622bf 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,9 @@ Seed data: `python -m services.symbol_registry.seed` ### Autonomous Trading Engine Continuous decision loop that polls for actionable recommendations and executes paper trades without manual intervention. Includes confidence-based position sizing (with sample-size-dampened agreement scoring to prevent thin-evidence inflation), dynamic stop-loss/take-profit (ATR-based), circuit breakers (daily loss cap, single-position loss, volatility detection), reserve pool management (auto-siphon from profits), risk tier auto-adjustment (conservative/moderate/aggressive based on trailing performance), portfolio rebalancing (sector and concentration limits), gradual entry (multi-tranche orders), correlation-aware diversification, earnings calendar awareness, portfolio heat management, tax-lot tracking with wash sale detection, performance tracking (Sharpe, drawdown, win rate, profit factor), and backtesting against historical data. +### AI Agent Management +Configurable AI agents (document extractor, event classifier, thesis rewriter) with database-driven model/prompt resolution. 60-second TTL cache for hot-swapping models without restarts. Agent performance logging with variant attribution for future A/B testing support. + ### Global News Interpolation Macro/geopolitical event ingestion from dedicated sources. Ollama-based classification by impact type, severity, affected regions, and sectors. Company exposure profiles (geographic revenue mix, supply chain regions, commodity dependencies, market position tier) map events to per-company macro impact scores with resilience modifiers. Forward-looking trend projections combine company momentum with macro trajectories. @@ -105,7 +108,8 @@ Historical pattern mining on the platform's own data — how similar catalyst ty ### Paper Trading - Alpaca paper trading integration (3 accounts max per Alpaca owner) -- Full reset: liquidates broker positions, cancels orders, syncs capital from broker balance +- Full reset: liquidates broker positions, cancels orders, clears local DB, syncs capital from broker's actual account balance +- No manual capital controls — engine capital always derived from broker state on reset - Moderate risk tier default, auto-adjustable - Full execution audit trail from signal to broker response - Operator approval workflow available for live mode