fix: calibrate dynamic model symbols
This commit is contained in:
@@ -8,6 +8,7 @@ from tools.calibrate_torch_thresholds import (
|
||||
_average_selected_predictions,
|
||||
_apply_platt_calibration,
|
||||
_build_torch_model,
|
||||
_calibration_symbols,
|
||||
_choose_recommendation,
|
||||
_full_backtest,
|
||||
_fit_platt_calibration,
|
||||
@@ -62,6 +63,21 @@ def _record(index: int, probability: float, future: float) -> ForecastRecord:
|
||||
)
|
||||
|
||||
|
||||
def test_calibration_symbols_follow_explicit_configured_artifact_precedence() -> None:
|
||||
artifact = {"symbols": {"btcusdt": {}, "ethusdt": {}}}
|
||||
|
||||
assert _calibration_symbols("solusdt, xrpusdt", ("ADAUSDT",), artifact) == [
|
||||
"SOLUSDT",
|
||||
"XRPUSDT",
|
||||
]
|
||||
assert _calibration_symbols("", ("ADAUSDT",), artifact) == ["ADAUSDT"]
|
||||
assert _calibration_symbols("", (), artifact) == ["BTCUSDT", "ETHUSDT"]
|
||||
|
||||
|
||||
def test_calibration_symbols_reject_malformed_artifact_symbols() -> None:
|
||||
assert _calibration_symbols("", (), {"symbols": []}) == []
|
||||
|
||||
|
||||
def test_calibration_does_not_fallback_to_too_few_trades() -> None:
|
||||
selected = _choose_recommendation(
|
||||
[_result(trades=1, average=2.0, total=2.0, profit_factor=999.0)],
|
||||
|
||||
Reference in New Issue
Block a user