1
This commit is contained in:
1 parent
3ae4e18211
commit
730adb3ff2
9 files changed
+206
-33
No files matched your search
+16
-1
@@ -748,9 +748,24 @@ async function loadReal() {
|
||||
document.getElementById("realJournal").innerHTML = real.journal.map(j => `<tr>
|
||||
<td>${mskFull(j.time)}</td><td>${j.tab === "basis" ? "Арбитраж" : "Симулятор"}</td><td>${j.exchange}</td><td><b>${j.coin}</b></td>
|
||||
<td>${{open: "открытие", close: "закрытие", orphan: "закрытие осиротевшей", transfer: "перевод USDT"}[j.action] || j.action}</td>
|
||||
<td class="${j.ok ? "pos" : "neg"}" style="white-space:normal">${j.text}</td></tr>`).join("")
|
||||
<td class="${j.ok ? "pos" : "neg"}" style="white-space:normal">${escapeHtml(j.text)}${journalTiming(j)}</td></tr>`).join("")
|
||||
|| '<tr><td colspan="6" class="empty">Реальных ордеров ещё не было</td></tr>';
|
||||
}
|
||||
function journalTiming(j) {
|
||||
const price = value => Number.isFinite(Number(value)) && value != null ? Number(value).toPrecision(9) : "—";
|
||||
const row = (title, time, spot, futures, single) => {
|
||||
if (time == null && spot == null && futures == null && single == null) return "";
|
||||
const prices = single != null ? `цена ${price(single)}` : `спот ${price(spot)} · фьючерс ${price(futures)}`;
|
||||
return `<div class="mut" style="margin-top:3px">${title}: ${time == null ? "время не записано" : mskFull(time)} · ${prices}</div>`;
|
||||
};
|
||||
const isOpen = j.action === "open", isClose = j.action === "close";
|
||||
if (!isOpen && !isClose) return "";
|
||||
return isOpen
|
||||
? row("Решение открыть", j.decision_open_time, j.decision_spot_price, j.decision_futures_price, j.decision_open_price)
|
||||
+ row("Исполнение открытия", j.actual_open_time, j.actual_spot_price, j.actual_futures_price, j.actual_open_price)
|
||||
: row("Решение закрыть", j.decision_close_time, j.decision_spot_price, j.decision_futures_price, j.decision_close_price)
|
||||
+ row("Исполнение закрытия", j.actual_close_time, j.actual_spot_price, j.actual_futures_price, j.actual_close_price);
|
||||
}
|
||||
async function keySave(ex) {
|
||||
const key = document.getElementById(`kk-${ex}`), secret = document.getElementById(`ks-${ex}`);
|
||||
const r = await api(`/api/real/keys/${ex}`, {api_key: key.value, api_secret: secret.value});
|
||||
|
||||
Reference in new issue
Block a user