LTSM-Forex-Bot/config/config.yaml

190 lines
4.3 KiB
YAML
Raw Permalink Normal View History

# LSTM Trading Bot Configuration
# Multi-timeframe LSTM model for forex/crypto trading
# Data Configuration
data:
symbols: ["EURUSD", "BTCUSD", "ETHUSD"]
timeframes: ["15m", "30m", "1h", "2h"]
start_date: "2020-01-01"
end_date: "2024-12-31"
data_source: "csv" # csv, alpaca, binance, oanda
data_dir: "data/raw"
cache_dir: "data/cache"
# Feature Engineering
features:
technical_indicators:
- rsi
- macd
- stochastic
- atr
- bollinger_bands
- sma_fast
- sma_slow
- ema_fast
- ema_slow
- vwap
- volatility
# Lagged features
lagged_features:
returns: [1, 2, 3, 5, 10, 20]
volume: [1, 5, 10]
# Calendar features
calendar_features:
- hour_of_day
- day_of_week
- month
- quarter
- is_weekend
# Regime features (optional HMM)
regime_features: false
n_regimes: 3
# Model Configuration
model:
# Architecture options: "single_lstm", "multi_lstm_fusion"
architecture: "multi_lstm_fusion"
# Model parameters
input_size: 64 # Will be calculated based on features
hidden_size: 128
num_layers: 2
dropout: 0.2
sequence_length: 60
# Multi-LSTM specific
fusion_strategy: "concatenate" # concatenate, attention, dense
# Output configuration
output_mode: "classification" # regression, classification
num_classes: 3 # for classification: long/flat/short
# Regularization
use_layer_norm: true
use_attention: false
# Training Configuration
training:
# Data split
train_ratio: 0.7
val_ratio: 0.15
test_ratio: 0.15
# Training parameters
batch_size: 32
num_epochs: 100
learning_rate: 0.001
weight_decay: 0.0001
# Loss and metrics
loss_function: "focal_loss" # mse, cross_entropy, focal_loss
label_smoothing: 0.1
# Optimization
optimizer: "adam" # adam, adamw, sgd
scheduler: "cosine_annealing" # cosine_annealing, step, plateau
# Early stopping
patience: 10
min_delta: 0.001
# Optuna hyperparameter search
optuna_trials: 50
optuna_timeout: 3600 # seconds
# Backtesting Configuration
backtest:
# Broker settings
broker: "backtrader"
commission: 0.0002 # 2 pips for forex, 0.1% for crypto
slippage: 0.0001
stake: 10000 # Starting capital
# Risk management
risk:
max_position_size: 0.02 # 2% of capital per trade
max_positions: 5
stop_loss: 0.02 # 2%
take_profit: 0.04 # 4%
trailing_stop: true
circuit_breaker_drawdown: 0.15 # 15% drawdown threshold
# Backtest parameters
warmup_periods: 100 # Periods to wait before trading
benchmark: "buy_and_hold" # buy_and_hold, none
# Live Trading Configuration
live:
mode: "paper" # paper, live
broker: "alpaca" # alpaca, oanda, binance
# Streaming
realtime_data_provider: "alpaca" # alpaca, binance, oanda
reconnect_attempts: 5
reconnect_delay: 5 # seconds
rate_limit_delay: 0.1 # seconds between requests
# Execution
execution_delay: 1 # seconds between signal checks
order_timeout: 30 # seconds to wait for order fill
# Risk management (live)
daily_loss_limit: 0.05 # 5% daily loss limit
max_drawdown: 0.20 # 20% max drawdown
# Broker credentials and connection defaults
api_key: ""
api_secret: ""
base_url: ""
# TradeLocker settings
tradelocker_access_token: ""
tradelocker_email: ""
tradelocker_password: ""
tradelocker_server: "SERVER"
tradelocker_account_id: null
tradelocker_acc_num: null
tradelocker_developer_api_key: ""
tradelocker_demo_base_url: "https://demo.tradelocker.com/backend-api"
tradelocker_live_base_url: "https://live.tradelocker.com/backend-api"
# Alerts
enable_alerts: false
alert_webhook: ""
alert_thresholds:
drawdown: 0.10
loss_streak: 5
# Logging and Monitoring
logging:
level: "INFO"
file: "logs/trading_bot.log"
max_size: 10485760 # 10MB
backup_count: 5
# Metrics to track
metrics:
- sharpe_ratio
- max_drawdown
- calmar_ratio
- hit_ratio
- profit_factor
- total_return
# Environment Variables (set in .env)
# API_KEY_ALPACA=
# API_SECRET_ALPACA=
# API_KEY_OANDA=
# API_KEY_BINANCE=
# TRADELOCKER_ACCESS_TOKEN=
# TRADELOCKER_EMAIL=
# TRADELOCKER_PASSWORD=
# TRADELOCKER_SERVER=
# TRADELOCKER_ACCOUNT_ID=
# TRADELOCKER_ACC_NUM=
# TRADELOCKER_DEVELOPER_API_KEY=
# SLACK_WEBHOOK=
# DISCORD_WEBHOOK=