品种增加每点价值字段,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
+16
View File
@@ -37,6 +37,22 @@ def _migrate(engine):
cols = {row[1] for row in cur.fetchall()}
if "max_locks" not in cols:
cur.execute("ALTER TABLE rounds ADD COLUMN max_locks INTEGER DEFAULT 3")
cur.execute("PRAGMA table_info(products)")
cols = {row[1] for row in cur.fetchall()}
if "point_value" not in cols:
cur.execute("ALTER TABLE products ADD COLUMN point_value INTEGER DEFAULT 20")
cur.execute("PRAGMA table_info(trades)")
cols = {row[1] for row in cur.fetchall()}
if "point_value" not in cols:
cur.execute("ALTER TABLE trades ADD COLUMN point_value INTEGER DEFAULT 20")
cur.execute("PRAGMA table_info(option_trades)")
cols = {row[1] for row in cur.fetchall()}
if "point_value" not in cols:
cur.execute("ALTER TABLE option_trades ADD COLUMN point_value INTEGER DEFAULT 20")
conn.commit()
finally:
conn.close()