22 lines
1.0 KiB
Python
22 lines
1.0 KiB
Python
import sys
|
|
sys.path.insert(0, '/home/hmo/.hermes/profiles/position-analyst/scripts')
|
|
sys.path.insert(0, '/home/hmo/MoFin')
|
|
from strategy_lifecycle import validate_strategy
|
|
|
|
# 模拟 97 中心坏数据(5元股票被写成中心97)
|
|
bad = {'code': '000711', 'price': 5.69, 'entry_low': 94.0, 'entry_high': 100.0,
|
|
'stop_loss': 90.0, 'take_profit': 110.0, 'timing_signal': '买入',
|
|
'rr_ratio': 2.0, 'tech_snapshot': '强撑94 弱撑95 弱压99 强压100',
|
|
'sector_context': '环保', 'signal_factors': ['x'], 'currency': 'CNY'}
|
|
passed, failures = validate_strategy(bad)
|
|
print('坏数据(中心97 vs 价5.69): passed =', passed)
|
|
for f in failures:
|
|
print(' FAIL:', f.get('id'), '-', f.get('desc', '')[:60])
|
|
|
|
# 正常数据
|
|
good = dict(bad)
|
|
good['entry_low'], good['entry_high'], good['stop_loss'], good['take_profit'] = 5.23, 6.15, 5.0, 7.0
|
|
passed2, failures2 = validate_strategy(good)
|
|
print('好数据(区5.23~6.15): passed =', passed2)
|
|
for f in failures2:
|
|
print(' FAIL:', f.get('id'), '-', f.get('desc', '')[:60]) |