品种增加每点价值字段,PNL计算支持不同品种差异化配置
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user