品种增加每点价值字段,PNL计算支持不同品种差异化配置

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
fish
2026-07-28 09:49:37 +08:00
parent 5018eb2083
commit 833491b8d0
8 changed files with 66 additions and 18 deletions
+3 -1
View File
@@ -48,6 +48,7 @@ def admin_page(request: Request, db: Session = Depends(get_db)):
"code": p.code,
"name": p.name,
"exchange": p.exchange,
"point_value": p.point_value,
"contracts": contract_list,
})
@@ -71,11 +72,12 @@ def create_product(
code: str = Form(...),
name: str = Form(...),
exchange: str = Form(...),
point_value: int = Form(20),
db: Session = Depends(get_db),
):
existing = db.query(Product).filter(Product.code == code.upper()).first()
if not existing:
p = Product(code=code.upper(), name=name, exchange=exchange)
p = Product(code=code.upper(), name=name, exchange=exchange, point_value=point_value)
db.add(p)
db.commit()
return RedirectResponse("/admin/?tab=product", status_code=303)