# Configuration for GRU-SAC Predictor

# --- Run Identification & Output ---
run_id_template: '{timestamp}' # Template for generating unique run IDs. '{timestamp}' will be replaced by YYYYMMDD_HHMMSS. Allows grouping results, logs, and models.

base_dirs:
  results: 'results' # Base directory relative to package root
  logs: 'logs'       # Base directory relative to package root
  models: 'models'     # Base directory relative to package root

# --- Data Parameters ---
data:
  db_dir: '../../data/crypto_market_data' # Path to the directory containing the market data database (relative to where main.py is run).
  exchange: 'bnbspot'                    # Name of the exchange table/data source in the database.
  ticker: 'SOL-USDT'                       # Instrument identifier (e.g., trading pair) within the exchange data.
  start_date: '2024-06-01'                 # Start date for loading data (YYYY-MM-DD). Note: Ensure enough data for lookback + splits.
  end_date: '2025-03-10'                   # End date for loading data (YYYY-MM-DD).
  interval: '1min'                         # Data frequency/interval (e.g., '1min', '5min', '1h').

# --- Data Split ---
split_ratios:
  train: 0.6                                # Proportion of the loaded data to use for training (0.0 to <1.0).
  validation: 0.2                            # Proportion of the loaded data to use for validation (0.0 to <1.0).
  # Test ratio is calculated as 1.0 - train - validation. Ensure train + validation < 1.0.

# --- GRU Model Parameters ---
gru:
  lookback: 60
  epochs: 25
  batch_size: 256
  prediction_horizon: 5
  patience: 5
  model_load_run_id: '20250417_173635'
  recency_weighting:
    enabled: true
    linear_start: 0.2
    linear_end: 1.0
  signed_weighting_beta: 0.0
  composite_loss_kappa: 0.0

# --- Calibration Parameters ---
calibration:
  edge_threshold: 0.55
  recalibrate_every_n: 0
  recalibration_window: 10000

# --- SAC Agent Parameters ---
sac:
  state_dim: 5
  hidden_size: 64
  gamma: 0.97
  tau: 0.02
  actor_lr: 3e-4
  buffer_max_size: 100000
  ou_noise_stddev: 0.2
  ou_noise_theta: 0.15
  ou_noise_dt: 0.01
  alpha: 0.2
  alpha_auto_tune: true
  use_batch_norm: true
  total_training_steps: 100
  min_buffer_size: 2000
  batch_size: 256
  log_interval: 1000
  save_interval: 10000

# --- Environment Parameters (Used by train_sac.py) ---
environment:
  initial_capital: 10000.0 # Notional capital for env/backtest consistency
  transaction_cost: 0.0005 # Fractional cost per trade (e.g., 0.0005 = 0.05%)

# --- Backtesting Parameters ---
backtest:
  initial_capital: 10000.0                   # Starting capital for run_pipeline backtest.
  transaction_cost: 0.0005                   # Transaction cost for run_pipeline backtest.

# --- Experience Generation (Simplified for config) ---
# Configuration for how experiences are generated or sampled for SAC training.
# (Currently only 'generate_new_on_epoch' is directly used from here in main.py)
experience:
  generate_new_on_epoch: False               # If true, generate fresh experiences using validation data at the start of each SAC epoch. If false, generate experiences once initially.

# --- Control Flags ---
# Determine which parts of the pipeline to run.
control:
  train_gru: true                         # Train the GRU model?
  train_sac: true                          # Run the offline SAC training script before backtesting?

  # --- SAC Loading/Resuming --- 
  # For resuming training in train_sac.py:
  sac_resume_run_id: null                    # Run ID of SAC agent to load *before* starting training (e.g., "sac_train_..."). If null, starts fresh.
  sac_resume_step: final                     # Checkpoint step to resume from: 'final' or step number.
  # For loading agent for backtesting in run_pipeline.py:
  sac_load_run_id: null                      # Run ID of the SAC training run to load weights from for *backtesting* (e.g., "sac_train_..."). If null, uses initial weights.
  sac_load_step: final                       # Which SAC checkpoint to load for backtesting: 'final' or step number.

  # --- Other Pipeline Controls ---
  run_backtest: true                         # Run the backtest?
  generate_plots: true                       # Generate output plots?
  # generate_report: True                    # Deprecated: Metrics are saved to a .txt file. 