fix: replace unicode chars that break Windows cp1252 encoding
This commit is contained in:
parent
b467445708
commit
d81d1dedac
84
config/current_config.json
Normal file
84
config/current_config.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
BIN
llm_client/__pycache__/analyzer.cpython-313.pyc
Normal file
BIN
llm_client/__pycache__/analyzer.cpython-313.pyc
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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.
|
Self-contained script that runs on the Windows PC with GPU.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
@ -280,7 +280,7 @@ def walk_forward_train_test(df: pd.DataFrame, feature_cols: list, config: dict)
|
|||||||
try:
|
try:
|
||||||
model.fit(X_train, y_train)
|
model.fit(X_train, y_train)
|
||||||
except Exception as e:
|
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
|
continue
|
||||||
|
|
||||||
# Get predictions on test set
|
# Get predictions on test set
|
||||||
@ -492,7 +492,7 @@ def compile_results(trades: list, per_window_sharpe: list,
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
def main():
|
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("--config", required=True, help="Path to config JSON")
|
||||||
parser.add_argument("--data", required=True, help="Path to OHLCV CSV")
|
parser.add_argument("--data", required=True, help="Path to OHLCV CSV")
|
||||||
parser.add_argument("--output", required=True, help="Path to output results JSON")
|
parser.add_argument("--output", required=True, help="Path to output results JSON")
|
||||||
@ -505,7 +505,7 @@ def main():
|
|||||||
# Load data
|
# Load data
|
||||||
print(f"Loading data from {args.data}...")
|
print(f"Loading data from {args.data}...")
|
||||||
df = pd.read_csv(args.data, parse_dates=["timestamp"])
|
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
|
# Compute features
|
||||||
print("Computing features...")
|
print("Computing features...")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user