修复okx止盈止损
This commit is contained in:
@@ -168,6 +168,33 @@
|
||||
return localStorage.getItem(ordersCollapseKey(exchangeId, symbol)) === "1";
|
||||
}
|
||||
|
||||
function condOrdersFromPosition(pos) {
|
||||
const cond = Array.isArray(pos.conditional_orders) ? pos.conditional_orders : [];
|
||||
if (cond.length) return cond;
|
||||
const et = pos.exchange_tpsl;
|
||||
if (!et) return [];
|
||||
const out = [];
|
||||
if (et.sl && et.sl.trigger_price != null) {
|
||||
out.push({
|
||||
label: "止损",
|
||||
trigger_price: Number(et.sl.trigger_price),
|
||||
amount: null,
|
||||
id: et.sl.order_id,
|
||||
channel: "algo",
|
||||
});
|
||||
}
|
||||
if (et.tp && et.tp.trigger_price != null) {
|
||||
out.push({
|
||||
label: "止盈",
|
||||
trigger_price: Number(et.tp.trigger_price),
|
||||
amount: null,
|
||||
id: et.tp.order_id,
|
||||
channel: "algo",
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function findMonitorOrder(orders, symbol, side) {
|
||||
const want = (side || "").toLowerCase();
|
||||
for (const o of orders || []) {
|
||||
@@ -452,7 +479,7 @@
|
||||
const sideCn = side === "long" ? "做多" : "做空";
|
||||
const sideCls = side === "long" ? "pos-side-long" : "pos-side-short";
|
||||
const mo = monitorOrder || {};
|
||||
const cond = Array.isArray(pos.conditional_orders) ? pos.conditional_orders : [];
|
||||
const cond = condOrdersFromPosition(pos);
|
||||
const reg = Array.isArray(pos.regular_orders) ? pos.regular_orders : [];
|
||||
const guess = guessTpslFromCondOrders(side, cond);
|
||||
const symAttr = esc(symbol).replace(/"/g, """);
|
||||
@@ -583,7 +610,7 @@
|
||||
const symAttr = esc(x.symbol || "").replace(/"/g, """);
|
||||
const sideAttr = esc((x.side || "").toLowerCase()).replace(/"/g, """);
|
||||
const contractsAttr = esc(String(x.contracts != null ? x.contracts : "")).replace(/"/g, """);
|
||||
const cond = Array.isArray(x.conditional_orders) ? x.conditional_orders : [];
|
||||
const cond = condOrdersFromPosition(x);
|
||||
const reg = Array.isArray(x.regular_orders) ? x.regular_orders : [];
|
||||
const guess = guessTpslFromCondOrders(x.side, cond);
|
||||
const slAttr = esc(String(guess.sl)).replace(/"/g, """);
|
||||
|
||||
Reference in New Issue
Block a user