feat: collect_data持仓处置上下文——switched用attributed定义+深套判定+无策略/失效持仓用position_management框架+当前温区合格策略(老莫:处置决策要有明确策略)
This commit is contained in:
@@ -224,6 +224,17 @@ def collect_data(code):
|
|||||||
except Exception as _te:
|
except Exception as _te:
|
||||||
print(f" ⚠️ 技术位计算失败({code}): {_te}", flush=True)
|
print(f" ⚠️ 技术位计算失败({code}): {_te}", flush=True)
|
||||||
|
|
||||||
|
# 深套重算(价格已拉取,与 strategy_lifecycle is_deep_loss 同口径 -20%)
|
||||||
|
_cost3 = data.get("held_cost") or 0
|
||||||
|
_px3 = data.get("price") or 0
|
||||||
|
if data.get("held") and _cost3 > 0 and _px3 > 0:
|
||||||
|
_pnl3 = (_px3 - _cost3) / _cost3 * 100
|
||||||
|
data["deep_loss"] = _pnl3 < -20
|
||||||
|
data["pnl_pct"] = round(_pnl3, 1)
|
||||||
|
else:
|
||||||
|
data["deep_loss"] = False
|
||||||
|
data["pnl_pct"] = None
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def build_prompt(data):
|
def build_prompt(data):
|
||||||
|
|||||||
Reference in New Issue
Block a user