Gate order cancel to trading hours and sync trade logs from CTP.
Disable cancel UI outside sessions, query exchange fills for records, and label local vs counterparty rows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1223,6 +1223,22 @@ def records():
|
||||
start, end = parse_review_date_filter(preset, start, end)
|
||||
|
||||
conn = get_db()
|
||||
ctp_sync_info = None
|
||||
try:
|
||||
from ctp_trade_sync import sync_trade_logs_from_ctp
|
||||
from trading_context import get_account_capital, get_trading_mode
|
||||
from vnpy_bridge import ctp_status
|
||||
|
||||
mode = get_trading_mode(get_setting)
|
||||
if ctp_status(mode).get("connected"):
|
||||
capital = get_account_capital(conn, get_setting)
|
||||
ctp_sync_info = sync_trade_logs_from_ctp(
|
||||
conn, mode, capital=capital, trading_mode=mode,
|
||||
)
|
||||
conn.commit()
|
||||
except Exception as exc:
|
||||
app.logger.warning("ctp trade sync on records page: %s", exc)
|
||||
|
||||
sql = "SELECT * FROM review_records WHERE 1=1"
|
||||
params: list = []
|
||||
if start:
|
||||
@@ -1264,6 +1280,7 @@ def records():
|
||||
trades=trades,
|
||||
equity_curve=equity_curve,
|
||||
auto_records=auto_list,
|
||||
ctp_sync_info=ctp_sync_info,
|
||||
preset=preset,
|
||||
start=start,
|
||||
end=end,
|
||||
|
||||
Reference in New Issue
Block a user