Files
crypto_monitor_user/tests/test_backfill_trend_snapshots.py
dekun 53863559f4 Initialize crypto_monitor_user (user edition) from monitor codebase.
Retarget git remote, install path, and deploy docs from crypto_monitor to crypto_monitor_user.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 16:18:13 +08:00

23 lines
699 B
Python

"""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) == "止损"