fix: initialize adaptive rules for legacy exits
This commit is contained in:
@@ -719,6 +719,42 @@ def test_torch_forecast_uses_legacy_exit_for_paper_fallback_position(make_settin
|
||||
assert signal.diagnostics["entry_path"] == "legacy_fallback"
|
||||
|
||||
|
||||
def test_torch_forecast_legacy_fallback_can_hold_after_minimum_time(make_settings, tmp_path) -> None:
|
||||
settings = make_settings(
|
||||
tmp_path,
|
||||
strategy_mode="torch_forecast",
|
||||
time_series_trend_fallback_enabled=True,
|
||||
time_series_fallback_mode="legacy",
|
||||
)
|
||||
strategy = SpotStrategy(settings)
|
||||
position = Position(
|
||||
1,
|
||||
"BTCUSDT",
|
||||
1,
|
||||
100,
|
||||
100,
|
||||
0.1,
|
||||
90,
|
||||
120,
|
||||
101,
|
||||
opened_at=utc_now() - timedelta(seconds=600),
|
||||
entry_diagnostics={"entry_path": "legacy_fallback"},
|
||||
)
|
||||
ticker = Ticker("BTCUSDT", 101, 100.99, 101.01, 10_000_000, 1000, 1.0)
|
||||
|
||||
signal = strategy.exit_signal(
|
||||
position,
|
||||
_ready_candles(),
|
||||
ticker,
|
||||
learning={"adaptive_rules": {}},
|
||||
forecast={},
|
||||
)
|
||||
|
||||
assert signal.action == "HOLD"
|
||||
assert signal.diagnostics["trade_mode"] == "LEGACY_FALLBACK"
|
||||
assert signal.diagnostics["adaptive_rules"] == {}
|
||||
|
||||
|
||||
def test_torch_forecast_allows_explicit_manual_quality_override(make_settings, tmp_path) -> None:
|
||||
settings = make_settings(
|
||||
tmp_path,
|
||||
|
||||
Reference in New Issue
Block a user