修复币安交易记录
This commit is contained in:
@@ -231,6 +231,7 @@
|
||||
<a href="/export/journal_entries">复盘记录</a>
|
||||
<a href="/export/key_monitors">关键位(当前)</a>
|
||||
<a href="/export/key_monitor_history">关键位历史</a>
|
||||
<button type="button" id="btn-sync-exchange-pnl" style="padding:6px 10px;border:1px solid #304164;border-radius:8px;background:#1f3a5a;color:#8fc8ff;cursor:pointer;font-size:.85rem">同步交易所盈亏</button>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<div class="stat-item"><div class="label">交易所</div><div class="value">{{ exchange_display }}</div></div>
|
||||
@@ -999,6 +1000,29 @@ function attachListWindowToExports(){
|
||||
});
|
||||
}
|
||||
|
||||
function syncExchangePnl(force){
|
||||
const btn = document.getElementById("btn-sync-exchange-pnl");
|
||||
if(btn) btn.disabled = true;
|
||||
fetch("/api/sync_exchange_pnl", {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify({limit: 200, force: !!force})
|
||||
}).then(r=>r.json()).then(data=>{
|
||||
if(data.ok){
|
||||
alert("已同步 " + (data.synced||0) + " / " + (data.candidates||0) + " 条记录,页面将刷新");
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.msg || "同步失败");
|
||||
}
|
||||
}).catch(()=>alert("同步请求失败")).finally(()=>{ if(btn) btn.disabled = false; });
|
||||
}
|
||||
|
||||
document.getElementById("btn-sync-exchange-pnl")?.addEventListener("click", function(){
|
||||
if(confirm("从 Binance 流水回填盈亏(含手续费)?将覆盖未复盘记录的展示盈亏。")){
|
||||
syncExchangePnl(true);
|
||||
}
|
||||
});
|
||||
|
||||
function loadJournals(){
|
||||
const qs = listWindowQueryString();
|
||||
fetch("/api/journals" + (qs ? "?" + qs : "")).then(r=>r.json()).then(data=>{
|
||||
|
||||
Reference in New Issue
Block a user