feat: autonomous trading engine — full implementation
- Database migration 018 with 13 tables for trading engine state - Trading engine service (services/trading/) with 12 pure computation modules: position sizer, stop-loss manager, reserve pool, circuit breaker, risk tier controller, correlation matrix, tax lots, trading window, gradual entry, notifications, micro-trading, backtester - Core TradingEngine with pre-trade evaluation pipeline and integration wiring - FastAPI HTTP service with 14 endpoints (health, config, decisions, metrics, backtest) - Performance tracker with Sharpe ratio, drawdown, profit factor computation - 194 Python tests (165 property-based + 29 integration) - Frontend: 13 TanStack Query hooks, 7 dashboard panels, tabbed Trading Engine page - Helm chart entry, network policy, nginx proxy, ingress for trading-engine - Shared infrastructure: enums, Redis keys, TradingConfig in AppConfig
This commit is contained in:
@@ -65,3 +65,24 @@ QUEUE_LAKE_PUBLISH = "lake_publish"
|
||||
QUEUE_TRADE = "trade"
|
||||
QUEUE_BROKER = "broker_orders"
|
||||
QUEUE_MACRO_CLASSIFICATION = "macro_classification"
|
||||
|
||||
# --- Trading engine ---
|
||||
QUEUE_TRADING_DECISIONS = "trading_decisions"
|
||||
TRADING_DEDUPE_PREFIX = f"{PREFIX}:dedupe:trading"
|
||||
TRADING_CB_PREFIX = f"{PREFIX}:trading:circuit_breaker"
|
||||
TRADING_NOTIFICATION_RATE = f"{PREFIX}:trading:notification_rate"
|
||||
|
||||
|
||||
def trading_dedupe_key(recommendation_id: str) -> str:
|
||||
"""Return the deduplication key for a trading recommendation."""
|
||||
return f"{TRADING_DEDUPE_PREFIX}:{recommendation_id}"
|
||||
|
||||
|
||||
def trading_cb_key(trigger_type: str) -> str:
|
||||
"""Return the circuit breaker state key for a given trigger type."""
|
||||
return f"{TRADING_CB_PREFIX}:{trigger_type}"
|
||||
|
||||
|
||||
def trading_notification_rate_key(channel: str) -> str:
|
||||
"""Return the notification rate-limit key for a given channel."""
|
||||
return f"{TRADING_NOTIFICATION_RATE}:{channel}"
|
||||
|
||||
Reference in New Issue
Block a user