diff --git a/app.py b/app.py index 87ef7e0..12a9cf5 100644 --- a/app.py +++ b/app.py @@ -1328,6 +1328,17 @@ def update_trade(tid): fee = calc["fee"] pnl_net = calc["pnl_net"] + form_pnl_raw = d.get("pnl") + if form_pnl_raw not in (None, ""): + pnl = float(form_pnl_raw) + pnl_net = round(pnl - fee, 2) + + try: + from app import holding_to_minutes + minutes = int(holding_to_minutes(open_time, close_time) or 0) + except Exception: + minutes = int(d.get("holding_minutes") or row.get("holding_minutes") or 0) + conn.execute( """UPDATE trade_logs SET symbol_name=?, monitor_type=?, direction=?, @@ -1345,7 +1356,7 @@ def update_trade(tid): close_px, lots, float(d.get("margin") or 0), - int(d.get("holding_minutes") or 0), + minutes, open_time, close_time, pnl, diff --git a/static/css/records.css b/static/css/records.css index 9d6b722..3723144 100644 --- a/static/css/records.css +++ b/static/css/records.css @@ -93,6 +93,66 @@ display: flex; } +.records-page .records-verify-toggle { + display: flex; + align-items: center; + gap: .45rem; + margin-bottom: .75rem; + font-size: .82rem; + color: var(--text-muted); + cursor: pointer; +} + +.records-page .records-verify-toggle input { + flex-shrink: 0; +} + +.records-trade-card .records-src-badge { + margin-left: .25rem; + font-size: .65rem; +} + +.records-trade-card .records-verified-inline { + margin-left: .25rem; +} + +.records-trade-card .btn-records-action, +.records-trade-table-wrap .btn-records-action { + background: #1f3a5a; + color: #8fc8ff; + border: none; + border-radius: 6px; + padding: .3rem .55rem; + font-size: .72rem; + text-decoration: none; + cursor: pointer; + white-space: nowrap; +} + +.records-trade-card .btn-records-action:disabled, +.records-trade-table-wrap .btn-records-action:disabled { + opacity: .45; + cursor: not-allowed; +} + +.records-trade-card .btn-records-del, +.records-trade-table-wrap .btn-records-del { + background: rgba(239, 68, 68, .15); + color: var(--loss); + border: none; + border-radius: 6px; + padding: .3rem .55rem; + font-size: .72rem; + text-decoration: none; + cursor: pointer; + white-space: nowrap; +} + +.records-trade-card .records-trade-actions, +.records-trade-table-wrap .records-trade-actions { + min-width: 15.5rem; +} + #trade-detail-modal .records-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); @@ -303,6 +363,11 @@ html:is([data-layout="tablet"], .layout-tablet) .records-page .records-desktop-o display: none !important; } +html:is([data-mobile="1"], .layout-phone) .records-page .records-verify-toggle, +html:is([data-layout="phone"], .layout-phone) .records-page .records-verify-toggle { + display: flex; +} + html:is([data-mobile="1"], .layout-phone) .records-page .records-trade-card .card-body, html:is([data-layout="phone"], .layout-phone) .records-page .records-trade-card .card-body { padding: 0; diff --git a/static/js/records.js b/static/js/records.js index b890061..d8aaecb 100644 --- a/static/js/records.js +++ b/static/js/records.js @@ -47,6 +47,9 @@ html += ''; html += '
跨日持仓的盈亏以平仓价与柜台结算为准;表格中「开仓价」为程序记录,「平仓价」为成交回报,二者不一致时请以平仓价核对净盈亏。
-