diff --git a/config/current_config.json b/config/current_config.json new file mode 100644 index 0000000..65d2da6 --- /dev/null +++ b/config/current_config.json @@ -0,0 +1,84 @@ +{ + "model_type": "xgboost", + "features": { + "technical_indicators": [ + "RSI_14", + "RSI_7", + "RSI_21", + "MACD_line", + "MACD_signal", + "MACD_hist", + "BB_upper", + "BB_lower", + "BB_width", + "ATR_14", + "SMA_5", + "SMA_10", + "SMA_20", + "SMA_50", + "SMA_200", + "EMA_5", + "EMA_10", + "EMA_20", + "EMA_50", + "OBV", + "stoch_k", + "stoch_d", + "williams_r", + "CCI_20", + "ROC_10", + "keltner_upper", + "keltner_lower" + ], + "lookback_periods": [ + 3, + 5, + 10, + 20 + ], + "use_volume_features": true, + "use_volatility_features": true, + "use_candle_patterns": true, + "use_lag_features": true, + "lag_periods": [ + 1, + 2, + 3, + 5 + ] + }, + "target": { + "type": "classification", + "direction": "long", + "horizon_candles": 6, + "threshold_pct": 1.0 + }, + "hyperparameters": { + "learning_rate": 0.05, + "max_depth": 6, + "n_estimators": 500, + "subsample": 0.8, + "colsample_bytree": 0.8, + "min_child_weight": 5, + "gamma": 0.1, + "reg_alpha": 0.1, + "reg_lambda": 1.0 + }, + "strategy": { + "entry_threshold": 0.6, + "exit_type": "trailing_stop", + "stop_loss_pct": 2.0, + "take_profit_pct": 4.0, + "trailing_stop_pct": 1.5, + "position_sizing": "confidence_scaled", + "max_position_pct": 100, + "min_confidence_to_trade": 0.55 + }, + "training": { + "walk_forward_windows": 5, + "train_pct": 0.7, + "validation_pct": 0.15, + "test_pct": 0.15 + }, + "timeframe": "4h" +} \ No newline at end of file diff --git a/llm_client/__pycache__/analyzer.cpython-313.pyc b/llm_client/__pycache__/analyzer.cpython-313.pyc new file mode 100644 index 0000000..9e5dfd5 Binary files /dev/null and b/llm_client/__pycache__/analyzer.cpython-313.pyc differ diff --git a/ml_engine/train_and_backtest.py b/ml_engine/train_and_backtest.py index 8853ab2..d856b35 100755 --- a/ml_engine/train_and_backtest.py +++ b/ml_engine/train_and_backtest.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -BTC ML Trading Strategy — Train & Backtest Engine +BTC ML Trading Strategy -- Train & Backtest Engine Self-contained script that runs on the Windows PC with GPU. Usage: @@ -280,7 +280,7 @@ def walk_forward_train_test(df: pd.DataFrame, feature_cols: list, config: dict) try: model.fit(X_train, y_train) except Exception as e: - print(f" Window {w+1}: training failed — {e}", file=sys.stderr) + print(f" Window {w+1}: training failed -- {e}", file=sys.stderr) continue # Get predictions on test set @@ -492,7 +492,7 @@ def compile_results(trades: list, per_window_sharpe: list, # --------------------------------------------------------------------------- def main(): - parser = argparse.ArgumentParser(description="BTC ML Trading — Train & Backtest") + parser = argparse.ArgumentParser(description="BTC ML Trading -- Train & Backtest") parser.add_argument("--config", required=True, help="Path to config JSON") parser.add_argument("--data", required=True, help="Path to OHLCV CSV") parser.add_argument("--output", required=True, help="Path to output results JSON") @@ -505,7 +505,7 @@ def main(): # Load data print(f"Loading data from {args.data}...") df = pd.read_csv(args.data, parse_dates=["timestamp"]) - print(f" {len(df)} rows, {df['timestamp'].iloc[0]} → {df['timestamp'].iloc[-1]}") + print(f" {len(df)} rows, {df['timestamp'].iloc[0]} -> {df['timestamp'].iloc[-1]}") # Compute features print("Computing features...")