Sync exchange PnL when hub loads trade records API.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,7 +19,12 @@ def register_trade_records_api(
|
||||
filter_trade_records_excluding_miss: Callable[[list], list],
|
||||
app_tz: Any,
|
||||
format_price_fn: Callable[[Any, Any], str] | None = None,
|
||||
sync_exchange_pnl_fn: Callable[[Any], Any] | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
sync_exchange_pnl_fn(conn): 可选,列表前节流回填交易所已实现盈亏.
|
||||
中控只走本 API,不经实例整页渲染,必须在此触发,否则盈亏U会一直显示「估」.
|
||||
"""
|
||||
from lib.instance.records_list_lib import list_trade_records_page
|
||||
|
||||
@app.route("/api/trade_records")
|
||||
@@ -40,6 +45,11 @@ def register_trade_records_api(
|
||||
offset = 0
|
||||
conn = get_db()
|
||||
try:
|
||||
if sync_exchange_pnl_fn is not None:
|
||||
try:
|
||||
sync_exchange_pnl_fn(conn)
|
||||
except Exception:
|
||||
pass
|
||||
payload = list_trade_records_page(
|
||||
conn,
|
||||
start_bj,
|
||||
|
||||
Reference in New Issue
Block a user