修复okx止盈止损
This commit is contained in:
@@ -410,10 +410,27 @@
|
||||
</details>`;
|
||||
}
|
||||
|
||||
function pickExTpslOrders(cond) {
|
||||
let sl = cond.find((o) => /^止损\b/.test(o.label || ""));
|
||||
let tp = cond.find((o) => /^止盈\b/.test(o.label || "") && !(o.label || "").includes("止盈止损"));
|
||||
if (!sl || !tp) {
|
||||
const combo = cond.find((o) => (o.label || "").includes("止盈止损"));
|
||||
if (combo) {
|
||||
const m = (combo.label || "").match(/SL=([\d.eE+-]+).*TP=([\d.eE+-]+)/i);
|
||||
if (m) {
|
||||
if (!sl) sl = { ...combo, label: "止损", trigger_price: Number(m[1]) };
|
||||
if (!tp) tp = { ...combo, label: "止盈", trigger_price: Number(m[2]) };
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!sl) sl = cond.find((o) => (o.label || "").includes("止损"));
|
||||
if (!tp) tp = cond.find((o) => (o.label || "").includes("止盈") && o !== sl);
|
||||
return { sl, tp };
|
||||
}
|
||||
|
||||
function renderExTpslRows(exchangeId, symbol, cond) {
|
||||
const symAttr = esc(symbol || "").replace(/"/g, """);
|
||||
const sl = cond.find((o) => (o.label || "").includes("止损"));
|
||||
const tp = cond.find((o) => (o.label || "").includes("止盈"));
|
||||
const { sl, tp } = pickExTpslOrders(cond);
|
||||
function row(label, o) {
|
||||
if (!o) {
|
||||
return `<div class="pos-ex-order-row"><span class="pos-ex-order-main">${label}:—</span></div>`;
|
||||
|
||||
Reference in New Issue
Block a user