修复前端
This commit is contained in:
@@ -1501,6 +1501,15 @@ def init_db():
|
||||
executed_plan_id INTEGER
|
||||
)"""
|
||||
)
|
||||
for ddl in (
|
||||
"ALTER TABLE trend_pullback_preview_snapshots ADD COLUMN preview_created_at TEXT",
|
||||
"ALTER TABLE trend_pullback_preview_snapshots ADD COLUMN outcome TEXT DEFAULT 'open'",
|
||||
"ALTER TABLE trend_pullback_preview_snapshots ADD COLUMN executed_plan_id INTEGER",
|
||||
):
|
||||
try:
|
||||
c.execute(ddl)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
@@ -5238,18 +5247,27 @@ def render_main_page(page="trade"):
|
||||
trend_plans_raw = conn.execute(
|
||||
"SELECT * FROM trend_pullback_plans WHERE status='active' ORDER BY id DESC"
|
||||
).fetchall()
|
||||
trend_plans = [enrich_active_trend_plan_row(r) for r in trend_plans_raw]
|
||||
trend_plans = []
|
||||
for r in trend_plans_raw:
|
||||
try:
|
||||
trend_plans.append(enrich_active_trend_plan_row(r))
|
||||
except Exception as e:
|
||||
print(f"[render_main_page] enrich trend plan: {e}")
|
||||
trend_plans.append(row_to_dict(r))
|
||||
preview_snapshots = []
|
||||
if page == "records":
|
||||
snap_rows = conn.execute(
|
||||
f"SELECT * FROM trend_pullback_preview_snapshots WHERE {sql_list_time_field('preview_created_at')} >= ? "
|
||||
f"AND {sql_list_time_field('preview_created_at')} <= ? ORDER BY id DESC LIMIT 500",
|
||||
(start_bj, end_bj),
|
||||
).fetchall()
|
||||
for sr in snap_rows:
|
||||
sd = row_to_dict(sr)
|
||||
sd["outcome_label"] = preview_snapshot_outcome_label(sd.get("outcome"))
|
||||
preview_snapshots.append(sd)
|
||||
try:
|
||||
snap_rows = conn.execute(
|
||||
f"SELECT * FROM trend_pullback_preview_snapshots WHERE {sql_list_time_field('preview_created_at')} >= ? "
|
||||
f"AND {sql_list_time_field('preview_created_at')} <= ? ORDER BY id DESC LIMIT 500",
|
||||
(start_bj, end_bj),
|
||||
).fetchall()
|
||||
for sr in snap_rows:
|
||||
sd = row_to_dict(sr)
|
||||
sd["outcome_label"] = preview_snapshot_outcome_label(sd.get("outcome"))
|
||||
preview_snapshots.append(sd)
|
||||
except Exception as e:
|
||||
print(f"[records] trend_pullback_preview_snapshots: {e}")
|
||||
can_trade = (
|
||||
trading_day_reset_allows_new_open(now)
|
||||
and active_count < MAX_ACTIVE_POSITIONS
|
||||
|
||||
Reference in New Issue
Block a user