Add Torch probe entries and Pi artifact sync
This commit is contained in:
@@ -633,6 +633,34 @@ def _torch_forecast_entry_signal(
|
||||
skill = _safe_float(forecast.get("skill"), 0.0)
|
||||
min_edge = max(0.0, settings.time_series_min_edge_percent)
|
||||
min_probability = _torch_min_probability(settings)
|
||||
probe_min_edge = max(0.0, min(settings.time_series_probe_min_edge_percent, min_edge))
|
||||
probe_min_probability = round(
|
||||
_clamp(settings.time_series_probe_min_probability_up, min_probability, 0.85),
|
||||
4,
|
||||
)
|
||||
full_edge_ok = expected_return >= min_edge
|
||||
probe_edge_ok = bool(
|
||||
settings.time_series_probe_enabled
|
||||
and not full_edge_ok
|
||||
and expected_return >= probe_min_edge
|
||||
and probability_up >= probe_min_probability
|
||||
)
|
||||
edge_mode = "full" if full_edge_ok else ("probe" if probe_edge_ok else "blocked")
|
||||
if probe_edge_ok and position_notional > 0:
|
||||
probe_multiplier = _clamp(settings.time_series_probe_size_multiplier, 0.05, 1.0)
|
||||
position_notional = round(
|
||||
min(
|
||||
settings.max_position_usdt,
|
||||
max(settings.min_position_usdt, position_notional * probe_multiplier),
|
||||
),
|
||||
2,
|
||||
)
|
||||
sizing = {
|
||||
**sizing,
|
||||
"notional_usdt": position_notional,
|
||||
"probe_size_multiplier": round(probe_multiplier, 4),
|
||||
"edge_mode": "probe",
|
||||
}
|
||||
confidence = _torch_forecast_confidence(settings, forecast)
|
||||
spread_ok = ticker.spread_percent <= settings.max_spread_percent
|
||||
liquidity_ok = ticker.turnover_24h >= settings.min_24h_turnover_usdt
|
||||
@@ -641,7 +669,7 @@ def _torch_forecast_entry_signal(
|
||||
"torch_model_ok": model_ok,
|
||||
"forecast_usable": bool(forecast.get("usable", False)),
|
||||
"forecast_not_blocked": not bool(forecast.get("block_entry", False)),
|
||||
"expected_edge_ok": expected_return >= min_edge,
|
||||
"expected_edge_ok": full_edge_ok or probe_edge_ok,
|
||||
"probability_ok": probability_up >= min_probability,
|
||||
"skill_ok": skill > 0.0,
|
||||
"confidence_ok": confidence >= settings.time_series_min_confidence,
|
||||
@@ -659,6 +687,10 @@ def _torch_forecast_entry_signal(
|
||||
"atr_trailing_multiplier": _clamp(settings.atr_trailing_multiplier, 0.5, 10.0),
|
||||
"expected_return_percent": expected_return,
|
||||
"min_edge_percent": min_edge,
|
||||
"probe_enabled": settings.time_series_probe_enabled,
|
||||
"probe_min_edge_percent": probe_min_edge,
|
||||
"probe_min_probability_up": probe_min_probability,
|
||||
"edge_mode": edge_mode,
|
||||
"probability_up": probability_up,
|
||||
"min_probability_up": min_probability,
|
||||
"min_confidence": settings.time_series_min_confidence,
|
||||
@@ -679,7 +711,8 @@ def _torch_forecast_entry_signal(
|
||||
(
|
||||
"torch_forecast: PyTorch edge confirmed; "
|
||||
f"model={forecast.get('model')}, p_up={probability_up:.3f}, "
|
||||
f"expected={expected_return:.4f}%, size={position_notional:.2f} USDT"
|
||||
f"expected={expected_return:.4f}%, edge_mode={edge_mode}, "
|
||||
f"size={position_notional:.2f} USDT"
|
||||
),
|
||||
diagnostics,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user