- Updated `train_model.py` and `train_mlx_model.py` to include a time weight decay parameter for improved sample weighting during training. - Modified dataset generation to incorporate sample weights based on time decay, enhancing model performance. - Adjusted deployment scripts to support new backend options and improved error handling for model file transfers. - Added new entries to the training log for better tracking of model performance metrics over time. - Included ONNX model export functionality in the MLX filter for compatibility with Linux servers.
26 lines
699 B
Python
26 lines
699 B
Python
from typing import Optional
|
|
|
|
|
|
def build_labels(
|
|
future_closes: list[float],
|
|
future_highs: list[float],
|
|
future_lows: list[float],
|
|
take_profit: float,
|
|
stop_loss: float,
|
|
side: str,
|
|
) -> Optional[int]:
|
|
for high, low in zip(future_highs, future_lows):
|
|
if side == "LONG":
|
|
# 보수적 접근: 손절(SL)을 먼저 체크
|
|
if low <= stop_loss:
|
|
return 0
|
|
if high >= take_profit:
|
|
return 1
|
|
else: # SHORT
|
|
# 보수적 접근: 손절(SL)을 먼저 체크
|
|
if high >= stop_loss:
|
|
return 0
|
|
if low <= take_profit:
|
|
return 1
|
|
return None
|