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