trading-platform/apps/trading-agents/config/risk.yaml

209 lines
4.1 KiB
YAML

# Risk Management Configuration
# Global risk parameters and limits
risk_profiles:
conservative:
name: "Conservative"
max_drawdown: 5.0
max_positions: 3
position_size_pct: 10.0
max_position_size_pct: 15.0
max_risk_per_trade: 1.5
max_leverage: 1.0
max_correlation: 0.5
moderate:
name: "Moderate"
max_drawdown: 10.0
max_positions: 5
position_size_pct: 15.0
max_position_size_pct: 20.0
max_risk_per_trade: 2.0
max_leverage: 1.0
max_correlation: 0.7
aggressive:
name: "Aggressive"
max_drawdown: 20.0
max_positions: 10
position_size_pct: 20.0
max_position_size_pct: 25.0
max_risk_per_trade: 3.0
max_leverage: 1.0
max_correlation: 0.8
# Position sizing
position_sizing:
method: "risk_based" # Options: fixed, risk_based, kelly_criterion
# Risk-based sizing parameters
risk_based:
use_stop_loss: true
default_stop_loss_pct: 2.0
max_position_value_pct: 25.0
min_position_value_usd: 10.0
# Fixed sizing parameters
fixed:
default_size_pct: 10.0
# Stop loss and take profit
stop_loss:
type: "percentage" # Options: percentage, atr, fixed_price
# Percentage-based
percentage:
conservative: 2.0
moderate: 3.0
aggressive: 4.0
# ATR-based
atr:
multiplier:
conservative: 1.5
moderate: 2.0
aggressive: 2.5
period: 14
# Trailing stop
trailing:
enabled: true
distance_pct:
conservative: 1.5
moderate: 2.0
aggressive: 3.0
take_profit:
type: "percentage" # Options: percentage, atr, risk_reward_ratio
# Percentage-based
percentage:
conservative: 3.0
moderate: 6.0
aggressive: 8.0
# Risk/Reward ratio
risk_reward_ratio:
conservative: 1.5
moderate: 2.0
aggressive: 2.5
# Drawdown management
drawdown:
# Actions when drawdown thresholds reached
actions:
- threshold: 50 # % of max drawdown
action: "reduce_position_size"
reduction_pct: 25
- threshold: 75
action: "reduce_position_size"
reduction_pct: 50
- threshold: 90
action: "pause_trading"
- threshold: 100
action: "stop_all_trading"
# Drawdown recovery
recovery:
resume_at_pct: 50 # Resume when drawdown reduces to this %
gradual_increase: true
increase_step_pct: 10
# Correlation limits
correlation:
max_correlation: 0.7
correlation_period: 30 # days
check_before_entry: true
# Portfolio limits
portfolio:
max_total_exposure_pct: 80.0
max_sector_exposure_pct: 40.0
min_diversification: 3 # Minimum number of different symbols
# Per-symbol limits
per_symbol:
max_positions: 1
max_value_pct: 25.0
# Time-based limits
time_limits:
# Trading hours (UTC)
trading_hours:
enabled: false
start: "00:00"
end: "23:59"
# Daily limits
daily:
max_trades: 50
max_loss_pct: 5.0
max_loss_usd: 500.0
reset_time: "00:00" # UTC
# Weekly limits
weekly:
max_trades: 200
max_loss_pct: 10.0
# Monthly limits
monthly:
max_trades: 800
max_loss_pct: 20.0
# Circuit breakers
circuit_breakers:
# Consecutive losses
consecutive_losses:
enabled: true
max_losses: 5
pause_duration_minutes: 60
# Rapid drawdown
rapid_drawdown:
enabled: true
threshold_pct: 3.0 # % loss in short period
period_minutes: 15
pause_duration_minutes: 120
# Volatility spike
volatility_spike:
enabled: true
threshold_multiplier: 3.0 # 3x normal volatility
action: "reduce_position_size"
# Emergency settings
emergency:
# Kill switch
kill_switch:
enabled: true
triggers:
- max_daily_loss_pct: 10.0
- max_drawdown_pct: 25.0
- consecutive_errors: 10
# Auto-close positions
auto_close:
on_max_drawdown: true
on_kill_switch: true
on_agent_error: true
# Monitoring and alerts
monitoring:
# Alert thresholds
alerts:
drawdown_warning: 3.0 # %
drawdown_critical: 4.5 # %
position_size_warning: 20.0 # %
correlation_warning: 0.8
# Logging
logging:
log_all_trades: true
log_rejected_signals: true
log_risk_checks: true
detailed_metrics: true