feat(scripts): add backfill for missing trend strategy snapshots
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Tests for trend strategy snapshot backfill helpers."""
|
||||
from scripts.backfill_trend_strategy_snapshots import (
|
||||
infer_exit_price,
|
||||
resolve_result_label,
|
||||
)
|
||||
|
||||
|
||||
def test_infer_exit_price_short_stop_loss():
|
||||
exit_p = infer_exit_price("short", 0.336, 4.85, 10, -2.45)
|
||||
assert exit_p is not None
|
||||
assert abs(exit_p - 0.353) < 0.002
|
||||
|
||||
|
||||
def test_resolve_result_label_from_plan_status():
|
||||
plan = {"status": "stopped_sl", "message": "stopped_sl"}
|
||||
assert resolve_result_label(plan, None) == "止损"
|
||||
|
||||
|
||||
def test_resolve_result_label_prefers_plan_status():
|
||||
plan = {"status": "stopped_sl"}
|
||||
trade = {"result": "移动止盈"}
|
||||
assert resolve_result_label(plan, trade) == "止损"
|
||||
Reference in New Issue
Block a user