Configuration
All KlawTrade settings live in a single YAML file at config/settings.yaml. The init wizard generates this file, but you can edit it directly at any time. Changes take effect on the next restart.
Configuration File
system:
mode: paper # paper | live
always_on: false # run outside market hours
timezone: US/Eastern
heartbeat_interval_seconds: 30
max_concurrent_orders: 5
trading_hours:
start: "09:30"
end: "16:00"
broker:
provider: alpaca
paper: true
risk:
max_portfolio_allocation: 0.90 # 90% max total allocation
max_single_position_pct: 0.10 # 10% max per position
max_sector_allocation_pct: 0.30 # 30% max per sector
max_correlated_exposure_pct: 0.40 # 40% max correlated
max_daily_loss_pct: 0.03 # 3% daily loss limit
max_weekly_loss_pct: 0.07 # 7% weekly loss limit
max_drawdown_pct: 0.15 # 15% max drawdown
max_single_trade_loss_pct: 0.02 # 2% per trade
max_open_positions: 15
max_daily_trades: 50
min_cash_reserve_pct: 0.10 # 10% cash reserve
circuit_breaker:
consecutive_losses_halt: 5
halt_duration_minutes: 60
vix_threshold: 35.0
order_guards:
require_limit_orders: true
min_volume_threshold: 100000
max_spread_pct: 0.02
strategy:
universe:
watchlist:
- SPY
- QQQ
- AAPL
- MSFT
- NVDA
- GOOGL
- AMZN
- META
- TSLA
- AMD
max_universe_size: 25
signals:
min_confidence: 0.70
max_signal_age_seconds: 300
portfolio:
starting_capital: 100000
benchmark: SPY
dashboard:
enabled: true
port: 8080
logging:
level: INFO
format: json
file: logs/klawtrade.logKey Options
| Option | Default | Description |
|---|---|---|
system.mode | paper | Controls whether real orders are placed. Must be paper or live. Set to live only when you are ready to trade with real money. |
system.always_on | false | When true, the engine runs outside market hours (useful for simulation mode). |
risk.max_daily_loss_pct | 0.03 | If daily losses exceed this threshold (3%), the circuit breaker halts all trading. |
risk.max_single_position_pct | 0.10 | Maximum percentage of total equity any single position can use (10%). |
strategy.universe.watchlist | SPY, QQQ, AAPL... | The list of ticker symbols to scan. Default includes 10 major tickers. |
strategy.signals.min_confidence | 0.70 | Minimum confidence score a signal must have to pass the risk gate. Strategies produce scores between 0 and 1. |
Environment Variables
Sensitive credentials are stored in a .env file in the project root. This file is automatically loaded at startup and should never be committed to version control.
ALPACA_API_KEY=your_api_key_here
ALPACA_SECRET_KEY=your_secret_key_here
ALPACA_BASE_URL=https://paper-api.alpaca.marketsIf Alpaca API keys are not set, KlawTrade automatically falls back to its built-in simulation broker which uses simulated price data. No external API keys are required to get started.