Load options review from local records with compact journal UI.

Drop exchange sync for the review page, auto-import closed local options and hedge plans, and match contract-style multi-timeframe upload styling with smaller fonts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 09:54:35 +08:00
parent c6142dc246
commit 48afc8ebe3
6 changed files with 194 additions and 102 deletions
+7 -5
View File
@@ -20,6 +20,7 @@ from lib.options.options_review_lib import (
SOURCE_LABELS,
compute_review_stats,
delete_review_entry,
ensure_local_review_synced,
get_review_trade,
list_review_trades,
save_review_entry,
@@ -103,14 +104,11 @@ def register_options_review_routes(app: Flask, cfg: dict[str, Any], repo_root: s
@app.route("/api/options/review/sync", methods=["POST"])
@lr
def api_options_review_sync():
"""刷新本地 options_trades + 已结束对冲计划(不访问交易所)."""
conn = cfg["get_db"]()
try:
init_options_review_tables(conn)
ex, err = _require_ex(cfg)
# 对冲可无交易所密钥;期权历史需要密钥
result = sync_all_review_sources(conn, ex if ex is not None else None)
if ex is None and result.get("options"):
result["options"] = {"ok": False, "msg": err}
result = sync_all_review_sources(conn, from_exchange=False)
conn.commit()
return jsonify(result)
finally:
@@ -121,6 +119,8 @@ def register_options_review_routes(app: Flask, cfg: dict[str, Any], repo_root: s
def api_options_review_trades():
conn = cfg["get_db"]()
try:
ensure_local_review_synced(conn)
conn.commit()
items = list_review_trades(
conn,
source_type=(request.args.get("source_type") or "").strip() or None,
@@ -214,6 +214,8 @@ def register_options_review_routes(app: Flask, cfg: dict[str, Any], repo_root: s
def api_options_review_stats():
conn = cfg["get_db"]()
try:
ensure_local_review_synced(conn)
conn.commit()
stats = compute_review_stats(
conn,
source_type=(request.args.get("source_type") or "").strip() or None,