fix: K线新浪历史补齐与手续费页布局及CTP批量同步

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-24 13:26:53 +08:00
parent 3fe4add8e1
commit de6815d481
8 changed files with 178 additions and 47 deletions
+25
View File
@@ -296,6 +296,31 @@ def list_all_fee_rates() -> list:
return [dict(r) for r in rows]
def list_fee_rates_for_ui() -> list:
"""手续费页展示:CTP 模式下 ctp 来源优先排前。"""
rows = list_all_fee_rates()
if get_fee_source_mode() == "ctp":
rows.sort(
key=lambda r: (
0 if (r.get("source") or "") == "ctp" else 1,
r.get("product") or "",
)
)
return rows
def count_fee_rates_by_source() -> dict[str, int]:
conn = _get_db()
rows = conn.execute(
"SELECT source, COUNT(*) AS n FROM fee_rates GROUP BY source"
).fetchall()
conn.close()
out: dict[str, int] = {}
for row in rows:
out[str(row["source"] or "local")] = int(row["n"] or 0)
return out
def upsert_fee_rate(product: str, fields: dict) -> None:
product = product.lower().strip()
conn = _get_db()