止盈阈值改为A×跳点价×每日手数
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,22 @@ def positions_page(request: Request, db: Session = Depends(get_db)):
|
||||
.all()
|
||||
)
|
||||
|
||||
# Compute stop-profit threshold: latest position A × point_value per round
|
||||
round_thresholds: dict[int, dict] = {}
|
||||
for r in active_rounds:
|
||||
if r.positions:
|
||||
latest_a = r.positions[-1].amp_threshold
|
||||
else:
|
||||
latest_a = 0
|
||||
contract = db.query(Contract).filter(Contract.code == r.contract_code).first()
|
||||
pv = contract.product.point_value if contract and contract.product else 20
|
||||
round_thresholds[r.id] = {
|
||||
"amp": latest_a,
|
||||
"point_value": pv,
|
||||
"daily_hands": r.daily_hands,
|
||||
"threshold": latest_a * pv * r.daily_hands,
|
||||
}
|
||||
|
||||
template = request.app.state.templates.get_template("positions.html")
|
||||
return HTMLResponse(
|
||||
template.render(
|
||||
@@ -45,6 +61,7 @@ def positions_page(request: Request, db: Session = Depends(get_db)):
|
||||
contracts=get_active_contracts(db),
|
||||
product_contracts=get_product_contracts(db),
|
||||
active_rounds=active_rounds,
|
||||
round_thresholds=round_thresholds,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user