trading/services/trade_executor/config.py

34 lines
1.2 KiB
Python
Raw Normal View History

"""Configuration for the trade executor service."""
from shared.config import BaseConfig
class TradeExecutorConfig(BaseConfig):
"""Extends BaseConfig with trade-executor-specific settings."""
max_position_pct: float = 0.05
max_total_exposure_pct: float = 0.80
max_positions: int = 20
default_stop_loss_pct: float = 0.03
cooldown_minutes: int = 30
alpaca_api_key: str = ""
alpaca_secret_key: str = ""
paper_trading: bool = True
# Kevin v2 risk caps — only applied when TradeSignal.strategy_id ==
# KEVIN_STRATEGY_UUID.
kevin_daily_trade_cap: int = 10
kevin_daily_alloc_cap_usd: float = 20_000.0
kevin_equity_drawdown_halt_pct: float = 0.20 # 20% drawdown → permanent pause
kevin_daily_loss_circuit_pct: float = 0.05 # 5% daily loss → 24h pause
# Slack notifications — pick ONE transport:
# 1. Bot token + channel (preferred) → chat.postMessage API
# 2. Webhook URL (legacy) → single-channel webhook
# If both set, bot-token wins. If neither, notifier is a no-op.
slack_webhook_url: str = ""
slack_bot_token: str = ""
slack_channel: str = ""
model_config = {"env_prefix": "TRADING_"}