Add BTC/ETH spot tickers on nav, anchored to Beijing 08:00 open.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-17 11:42:19 +08:00
parent 960565482f
commit 08029ccb15
9 changed files with 472 additions and 14 deletions
+23
View File
@@ -5660,6 +5660,29 @@ def api_settings_open_guard():
)
@app.route("/api/nav_spot_tickers")
@login_required
def api_nav_spot_tickers():
"""BTC/ETH 现货最新价,相对北京时间 08:00(OKX 日K开盘)涨跌."""
try:
from lib.market.nav_spot_tickers_lib import build_nav_spot_tickers
tickers = build_nav_spot_tickers(
exchange,
reset_hour=TRADING_DAY_RESET_HOUR,
now_fn=lambda: datetime.now(APP_TZ),
)
return jsonify(
{
"ok": True,
"updated_at": app_now_str(),
"tickers": tickers,
}
)
except Exception as e:
return jsonify({"ok": False, "msg": str(e) or "行情读取失败", "tickers": []}), 502
@app.route("/api/price_snapshot")
@login_required
def api_price_snapshot():