Spaces:
Runtime error
Runtime error
v2.2: signal model vuelve a BTC/ETH/SOL (probado rentable) + SMC features
Browse files- model_signals.py +15 -24
model_signals.py
CHANGED
|
@@ -303,40 +303,31 @@ def main():
|
|
| 303 |
|
| 304 |
if args.multi:
|
| 305 |
import glob
|
| 306 |
-
|
| 307 |
-
|
|
|
|
| 308 |
dfs = []
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
if len(df_sym) < MIN_ROWS:
|
| 316 |
-
logger.info("Skipped %s: only %d rows (min %d)", sym, len(df_sym), MIN_ROWS)
|
| 317 |
-
continue
|
| 318 |
-
logger.info("Loaded %s: %d rows", sym, len(df_sym))
|
| 319 |
-
# Threshold adaptativo: 2% para estables, 5% para AI volatiles
|
| 320 |
-
thresh = args.threshold if sym in BASE_SYMBOLS else args.threshold * 2.5
|
| 321 |
-
df_sym = create_signal_targets(df_sym, horizon=args.horizon,
|
| 322 |
-
buy_threshold=thresh, sell_threshold=-thresh)
|
| 323 |
-
dfs.append(df_sym)
|
| 324 |
if not dfs:
|
| 325 |
-
logger.error("No
|
| 326 |
return
|
| 327 |
df = pd.concat(dfs, axis=0).sort_index()
|
| 328 |
-
logger.info("Combined: %d rows (%d symbols)", len(df), len(dfs))
|
| 329 |
else:
|
| 330 |
path = os.path.join(DATA_DIR, f"labeled_{args.symbol}_{args.timeframe}.parquet")
|
| 331 |
if not os.path.exists(path):
|
| 332 |
return
|
| 333 |
df = pd.read_parquet(path)
|
| 334 |
|
| 335 |
-
# Crear targets
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
sell_threshold=-args.threshold)
|
| 340 |
feature_cols = select_signal_features(df)
|
| 341 |
result = train_signal_model(df, feature_cols)
|
| 342 |
|
|
|
|
| 303 |
|
| 304 |
if args.multi:
|
| 305 |
import glob
|
| 306 |
+
# Entrenar SOLO con monedas base (probado rentable a threshold 0.7)
|
| 307 |
+
# AI coins tienen comportamiento muy diferente - usar Strategy Runner SMC
|
| 308 |
+
BASE_TRAIN = ["BTCUSDT", "ETHUSDT", "SOLUSDT"]
|
| 309 |
dfs = []
|
| 310 |
+
for sym in BASE_TRAIN:
|
| 311 |
+
path = os.path.join(DATA_DIR, f"labeled_{sym}_{args.timeframe}.parquet")
|
| 312 |
+
if os.path.exists(path):
|
| 313 |
+
df_sym = pd.read_parquet(path)
|
| 314 |
+
logger.info("Loaded %s: %d rows", sym, len(df_sym))
|
| 315 |
+
dfs.append(df_sym)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
if not dfs:
|
| 317 |
+
logger.error("No base symbol data found")
|
| 318 |
return
|
| 319 |
df = pd.concat(dfs, axis=0).sort_index()
|
| 320 |
+
logger.info("Combined: %d rows (%d base symbols)", len(df), len(dfs))
|
| 321 |
else:
|
| 322 |
path = os.path.join(DATA_DIR, f"labeled_{args.symbol}_{args.timeframe}.parquet")
|
| 323 |
if not os.path.exists(path):
|
| 324 |
return
|
| 325 |
df = pd.read_parquet(path)
|
| 326 |
|
| 327 |
+
# Crear targets de senal
|
| 328 |
+
df = create_signal_targets(df, horizon=args.horizon,
|
| 329 |
+
buy_threshold=args.threshold,
|
| 330 |
+
sell_threshold=-args.threshold)
|
|
|
|
| 331 |
feature_cols = select_signal_features(df)
|
| 332 |
result = train_signal_model(df, feature_cols)
|
| 333 |
|