@orderly.network/hooks 2.12.2-alpha.0 → 2.12.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +170 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -170,7 +170,7 @@ declare global {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
declare const _default: "2.12.
|
|
173
|
+
declare const _default: "2.12.3-alpha.0";
|
|
174
174
|
|
|
175
175
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
176
176
|
type useQueryOptions<T> = SWRConfiguration & {
|
package/dist/index.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ declare global {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
declare const _default: "2.12.
|
|
173
|
+
declare const _default: "2.12.3-alpha.0";
|
|
174
174
|
|
|
175
175
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
176
176
|
type useQueryOptions<T> = SWRConfiguration & {
|
package/dist/index.js
CHANGED
|
@@ -75,9 +75,9 @@ function useMarketCategoriesConfig() {
|
|
|
75
75
|
// src/version.ts
|
|
76
76
|
if (typeof window !== "undefined") {
|
|
77
77
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
78
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.12.
|
|
78
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.12.3-alpha.0";
|
|
79
79
|
}
|
|
80
|
-
var version_default = "2.12.
|
|
80
|
+
var version_default = "2.12.3-alpha.0";
|
|
81
81
|
var fetcher = (url, init2 = {}, queryOptions) => net.get(url, init2, queryOptions?.formatter);
|
|
82
82
|
var noCacheConfig = {
|
|
83
83
|
dedupingInterval: 0,
|
|
@@ -599,6 +599,20 @@ var useAudioPlayer = (src, options = {}) => {
|
|
|
599
599
|
const el = getOrderFilledAudio();
|
|
600
600
|
el.volume = Math.max(0, Math.min(1, volume));
|
|
601
601
|
}, [volume]);
|
|
602
|
+
React.useEffect(() => {
|
|
603
|
+
const handleVisibilityChange = () => {
|
|
604
|
+
if (document.visibilityState === "visible") {
|
|
605
|
+
const el = getOrderFilledAudio();
|
|
606
|
+
el.pause();
|
|
607
|
+
el.removeAttribute("src");
|
|
608
|
+
el.load();
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
612
|
+
return () => {
|
|
613
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
614
|
+
};
|
|
615
|
+
}, []);
|
|
602
616
|
const play = React.useCallback(() => {
|
|
603
617
|
const currentSrc = srcRef.current;
|
|
604
618
|
const currentEnabled = enabledRef.current;
|
|
@@ -1308,7 +1322,7 @@ function checkTPSLOrderTypeIsMarket(key, values) {
|
|
|
1308
1322
|
}
|
|
1309
1323
|
function tpslCalculateHelper(key, inputs, options = {}) {
|
|
1310
1324
|
const { symbol } = options;
|
|
1311
|
-
if (key !== "quantity" && key !== "tp_trigger_price" && key !== "sl_trigger_price" && key !== "tp_pnl" && key !== "sl_pnl" && key !== "tp_offset" && key !== "sl_offset" && key !== "tp_offset_percentage" && key !== "sl_offset_percentage" && key !== "tp_order_price" && key !== "sl_order_price" && key !== "tp_order_type" && key !== "sl_order_type") {
|
|
1325
|
+
if (key !== "quantity" && key !== "tp_trigger_price" && key !== "sl_trigger_price" && key !== "tp_pnl" && key !== "sl_pnl" && key !== "tp_offset" && key !== "sl_offset" && key !== "tp_offset_percentage" && key !== "sl_offset_percentage" && key !== "tp_offset_from_mark" && key !== "sl_offset_from_mark" && key !== "tp_offset_percentage_from_mark" && key !== "sl_offset_percentage_from_mark" && key !== "tp_order_price" && key !== "sl_order_price" && key !== "tp_order_type" && key !== "sl_order_type") {
|
|
1312
1326
|
return {
|
|
1313
1327
|
[key]: inputs.value
|
|
1314
1328
|
};
|
|
@@ -1316,6 +1330,7 @@ function tpslCalculateHelper(key, inputs, options = {}) {
|
|
|
1316
1330
|
const orderType = key.startsWith("tp_") ? types.AlgoOrderType.TAKE_PROFIT : types.AlgoOrderType.STOP_LOSS;
|
|
1317
1331
|
const keyPrefix = key.slice(0, 3);
|
|
1318
1332
|
const qty = Number(key === "quantity" ? inputs.value : inputs.qty);
|
|
1333
|
+
const markPrice = inputs.markPrice ?? inputs.entryPrice;
|
|
1319
1334
|
if (qty === 0 && (key === "tp_pnl" || key === "sl_pnl" || key === "tp_trigger_price" || key === "sl_trigger_price")) {
|
|
1320
1335
|
return {
|
|
1321
1336
|
// [`${keyPrefix}trigger_price`]: "",
|
|
@@ -1326,7 +1341,7 @@ function tpslCalculateHelper(key, inputs, options = {}) {
|
|
|
1326
1341
|
[key]: inputs.value
|
|
1327
1342
|
};
|
|
1328
1343
|
}
|
|
1329
|
-
let trigger_price, offset, offset_percentage, pnl, order_price, tpsl_order_type = inputs.values[`${keyPrefix}order_type`] ?? types.OrderType.MARKET;
|
|
1344
|
+
let trigger_price, offset, offset_percentage, offset_from_mark, offset_percentage_from_mark, pnl, order_price, tpsl_order_type = inputs.values[`${keyPrefix}order_type`] ?? types.OrderType.MARKET;
|
|
1330
1345
|
const entryPrice = new utils.Decimal(inputs.entryPrice).todp(options.symbol?.quote_dp ?? 2, utils.Decimal.ROUND_UP).toNumber();
|
|
1331
1346
|
switch (key) {
|
|
1332
1347
|
case "tp_trigger_price":
|
|
@@ -1338,6 +1353,8 @@ function tpslCalculateHelper(key, inputs, options = {}) {
|
|
|
1338
1353
|
[`${keyPrefix}trigger_price`]: trigger_price,
|
|
1339
1354
|
[`${keyPrefix}offset`]: "",
|
|
1340
1355
|
[`${keyPrefix}offset_percentage`]: "",
|
|
1356
|
+
[`${keyPrefix}offset_from_mark`]: "",
|
|
1357
|
+
[`${keyPrefix}offset_percentage_from_mark`]: "",
|
|
1341
1358
|
[`${keyPrefix}pnl`]: "",
|
|
1342
1359
|
[`${keyPrefix}ROI`]: ""
|
|
1343
1360
|
};
|
|
@@ -1347,31 +1364,6 @@ function tpslCalculateHelper(key, inputs, options = {}) {
|
|
|
1347
1364
|
}
|
|
1348
1365
|
break;
|
|
1349
1366
|
}
|
|
1350
|
-
// case "tp_enable":
|
|
1351
|
-
// case "sl_enable": {
|
|
1352
|
-
// return {
|
|
1353
|
-
// [`${keyPrefix}enable`]: inputs.value,
|
|
1354
|
-
// [`${keyPrefix}order_type`]: OrderType.MARKET,
|
|
1355
|
-
// [`${keyPrefix}trigger_price`]: "",
|
|
1356
|
-
// [`${keyPrefix}order_price`]: "",
|
|
1357
|
-
// [`${keyPrefix}offset`]: "",
|
|
1358
|
-
// [`${keyPrefix}offset_percentage`]: "",
|
|
1359
|
-
// [`${keyPrefix}pnl`]: "",
|
|
1360
|
-
// [`${keyPrefix}ROI`]: "",
|
|
1361
|
-
// };
|
|
1362
|
-
// }
|
|
1363
|
-
// case 'tp_pnl':{
|
|
1364
|
-
// if (inputs.values.tp_order_type !== OrderType.MARKET) {
|
|
1365
|
-
// pnl = inputs.value;
|
|
1366
|
-
// trigger_price = pnlToPrice({
|
|
1367
|
-
// qty,
|
|
1368
|
-
// pnl: Number(inputs.value),
|
|
1369
|
-
// entryPrice,
|
|
1370
|
-
// orderSide: inputs.orderSide,
|
|
1371
|
-
// orderType,
|
|
1372
|
-
// })
|
|
1373
|
-
// }
|
|
1374
|
-
// }
|
|
1375
1367
|
case "tp_pnl":
|
|
1376
1368
|
case "sl_pnl": {
|
|
1377
1369
|
pnl = inputs.value;
|
|
@@ -1418,6 +1410,30 @@ function tpslCalculateHelper(key, inputs, options = {}) {
|
|
|
1418
1410
|
}
|
|
1419
1411
|
break;
|
|
1420
1412
|
}
|
|
1413
|
+
case "tp_offset_from_mark":
|
|
1414
|
+
case "sl_offset_from_mark": {
|
|
1415
|
+
offset_from_mark = inputs.value;
|
|
1416
|
+
if (!checkTPSLOrderTypeIsMarket(key, inputs.values)) {
|
|
1417
|
+
order_price = offsetToPrice({
|
|
1418
|
+
qty,
|
|
1419
|
+
offset: Number(inputs.value),
|
|
1420
|
+
entryPrice: markPrice,
|
|
1421
|
+
orderSide: inputs.orderSide,
|
|
1422
|
+
orderType: key === "tp_offset_from_mark" ? types.AlgoOrderType.TAKE_PROFIT : types.AlgoOrderType.STOP_LOSS
|
|
1423
|
+
});
|
|
1424
|
+
trigger_price = inputs.values[`${keyPrefix}trigger_price`] ?? order_price;
|
|
1425
|
+
} else {
|
|
1426
|
+
trigger_price = offsetToPrice({
|
|
1427
|
+
qty,
|
|
1428
|
+
offset: Number(inputs.value),
|
|
1429
|
+
// entryPrice,
|
|
1430
|
+
entryPrice: markPrice,
|
|
1431
|
+
orderSide: inputs.orderSide,
|
|
1432
|
+
orderType: key === "tp_offset_from_mark" ? types.AlgoOrderType.TAKE_PROFIT : types.AlgoOrderType.STOP_LOSS
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
break;
|
|
1436
|
+
}
|
|
1421
1437
|
case "tp_order_price":
|
|
1422
1438
|
case "sl_order_price": {
|
|
1423
1439
|
order_price = inputs.value;
|
|
@@ -1458,12 +1474,38 @@ function tpslCalculateHelper(key, inputs, options = {}) {
|
|
|
1458
1474
|
}
|
|
1459
1475
|
break;
|
|
1460
1476
|
}
|
|
1477
|
+
case "tp_offset_percentage_from_mark":
|
|
1478
|
+
case "sl_offset_percentage_from_mark": {
|
|
1479
|
+
offset_percentage_from_mark = inputs.value;
|
|
1480
|
+
const markBase = Number(markPrice);
|
|
1481
|
+
if (!checkTPSLOrderTypeIsMarket(key, inputs.values)) {
|
|
1482
|
+
order_price = offsetPercentageToPrice({
|
|
1483
|
+
qty,
|
|
1484
|
+
percentage: Number(`${inputs.value}`.replace(/\.0{0,2}$/, "")),
|
|
1485
|
+
entryPrice: markBase,
|
|
1486
|
+
orderSide: inputs.orderSide,
|
|
1487
|
+
orderType
|
|
1488
|
+
});
|
|
1489
|
+
trigger_price = inputs.values[`${keyPrefix}trigger_price`] ?? order_price;
|
|
1490
|
+
} else {
|
|
1491
|
+
trigger_price = offsetPercentageToPrice({
|
|
1492
|
+
qty,
|
|
1493
|
+
percentage: Number(`${inputs.value}`.replace(/\.0{0,2}$/, "")),
|
|
1494
|
+
entryPrice: markBase,
|
|
1495
|
+
orderSide: inputs.orderSide,
|
|
1496
|
+
orderType
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
break;
|
|
1500
|
+
}
|
|
1461
1501
|
}
|
|
1462
1502
|
if (!trigger_price && checkTPSLOrderTypeIsMarket(key, inputs.values)) {
|
|
1463
1503
|
return {
|
|
1464
1504
|
[`${keyPrefix}trigger_price`]: "",
|
|
1465
1505
|
[`${keyPrefix}offset`]: "",
|
|
1466
1506
|
[`${keyPrefix}offset_percentage`]: "",
|
|
1507
|
+
[`${keyPrefix}offset_from_mark`]: "",
|
|
1508
|
+
[`${keyPrefix}offset_percentage_from_mark`]: "",
|
|
1467
1509
|
[`${keyPrefix}pnl`]: "",
|
|
1468
1510
|
[`${keyPrefix}ROI`]: "",
|
|
1469
1511
|
[key]: inputs.value
|
|
@@ -1508,6 +1550,8 @@ function tpslCalculateHelper(key, inputs, options = {}) {
|
|
|
1508
1550
|
[`${keyPrefix}order_price`]: order_price ? utils.todpIfNeed(order_price, symbol?.quote_dp ?? 2) : "",
|
|
1509
1551
|
[`${keyPrefix}offset`]: offset ?? "",
|
|
1510
1552
|
[`${keyPrefix}offset_percentage`]: offset_percentage ?? "",
|
|
1553
|
+
[`${keyPrefix}offset_from_mark`]: offset_from_mark ?? inputs.values[`${keyPrefix}offset_from_mark`] ?? "",
|
|
1554
|
+
[`${keyPrefix}offset_percentage_from_mark`]: offset_percentage_from_mark ?? inputs.values[`${keyPrefix}offset_percentage_from_mark`] ?? "",
|
|
1511
1555
|
[`${keyPrefix}pnl`]: pnl ?? ""
|
|
1512
1556
|
// [`${keyPrefix}ROI`]: calcROI({
|
|
1513
1557
|
// pnl: Number(pnl ?? 0),
|
|
@@ -1695,6 +1739,7 @@ function tpslInputHandle(inputs) {
|
|
|
1695
1739
|
// order price or mark price
|
|
1696
1740
|
qty: values.side === types.OrderSide.BUY ? Number(values.order_quantity) : Number(values.order_quantity) * -1,
|
|
1697
1741
|
orderSide: values.side,
|
|
1742
|
+
markPrice,
|
|
1698
1743
|
// values: newValues,
|
|
1699
1744
|
values
|
|
1700
1745
|
},
|
|
@@ -1730,6 +1775,10 @@ var getCalculateHandler = (fieldName) => {
|
|
|
1730
1775
|
case "sl_offset":
|
|
1731
1776
|
case "tp_offset_percentage":
|
|
1732
1777
|
case "sl_offset_percentage":
|
|
1778
|
+
case "tp_offset_from_mark":
|
|
1779
|
+
case "sl_offset_from_mark":
|
|
1780
|
+
case "tp_offset_percentage_from_mark":
|
|
1781
|
+
case "sl_offset_percentage_from_mark":
|
|
1733
1782
|
case "tp_order_price":
|
|
1734
1783
|
case "tp_order_type":
|
|
1735
1784
|
case "sl_order_type":
|
|
@@ -5144,6 +5193,11 @@ var MarkPriceCalculator = class extends BaseCalculator {
|
|
|
5144
5193
|
|
|
5145
5194
|
// src/orderly/calculator/calculatorContext.ts
|
|
5146
5195
|
var CalculatorContext = class _CalculatorContext {
|
|
5196
|
+
// holding: API.Holding[];
|
|
5197
|
+
// portfolio — dynamic getter to always read the latest output from PortfolioCalculator
|
|
5198
|
+
get portfolio() {
|
|
5199
|
+
return this.output["portfolio"] || useAppStore.getState().portfolio;
|
|
5200
|
+
}
|
|
5147
5201
|
static get instance() {
|
|
5148
5202
|
return this._instance;
|
|
5149
5203
|
}
|
|
@@ -5162,7 +5216,6 @@ var CalculatorContext = class _CalculatorContext {
|
|
|
5162
5216
|
update(scope, data) {
|
|
5163
5217
|
this.setCtxData();
|
|
5164
5218
|
this.markPrices = scope === "markPrice" /* MARK_PRICE */ ? data : this.output[MarketCalculatorName];
|
|
5165
|
-
this.portfolio = this.output["portfolio"] || useAppStore.getState().portfolio;
|
|
5166
5219
|
return this;
|
|
5167
5220
|
}
|
|
5168
5221
|
setCtxData() {
|
|
@@ -5180,7 +5233,6 @@ var CalculatorContext = class _CalculatorContext {
|
|
|
5180
5233
|
clearCache() {
|
|
5181
5234
|
this.output = {};
|
|
5182
5235
|
this.accountInfo = void 0;
|
|
5183
|
-
this.portfolio = void 0;
|
|
5184
5236
|
}
|
|
5185
5237
|
deleteByName(name) {
|
|
5186
5238
|
delete this.output[name];
|
|
@@ -11046,7 +11098,11 @@ var tpslFields = [
|
|
|
11046
11098
|
"tp_offset",
|
|
11047
11099
|
"sl_offset",
|
|
11048
11100
|
"tp_offset_percentage",
|
|
11049
|
-
"sl_offset_percentage"
|
|
11101
|
+
"sl_offset_percentage",
|
|
11102
|
+
"tp_offset_from_mark",
|
|
11103
|
+
"sl_offset_from_mark",
|
|
11104
|
+
"tp_offset_percentage_from_mark",
|
|
11105
|
+
"sl_offset_percentage_from_mark"
|
|
11050
11106
|
];
|
|
11051
11107
|
var isBracketOrder = (order) => {
|
|
11052
11108
|
return !!order.tp_trigger_price || !!order.sl_trigger_price;
|
|
@@ -11262,6 +11318,8 @@ var useTaskProfitAndStopLossInternal = (position, options) => {
|
|
|
11262
11318
|
entryPrice: position.average_open_price,
|
|
11263
11319
|
qty: side === types.OrderSide.BUY ? Number(prev.quantity) : -Number(prev.quantity),
|
|
11264
11320
|
orderSide: side,
|
|
11321
|
+
markPrice: markPrice ?? position.average_open_price,
|
|
11322
|
+
// use mark price as the default value
|
|
11265
11323
|
values: prev
|
|
11266
11324
|
},
|
|
11267
11325
|
{
|
|
@@ -18642,10 +18700,14 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18642
18700
|
tp_pnl: "",
|
|
18643
18701
|
tp_offset: "",
|
|
18644
18702
|
tp_offset_percentage: "",
|
|
18703
|
+
tp_offset_from_mark: "",
|
|
18704
|
+
tp_offset_percentage_from_mark: "",
|
|
18645
18705
|
sl_trigger_price: "",
|
|
18646
18706
|
sl_pnl: "",
|
|
18647
18707
|
sl_offset: "",
|
|
18648
|
-
sl_offset_percentage: ""
|
|
18708
|
+
sl_offset_percentage: "",
|
|
18709
|
+
sl_offset_from_mark: "",
|
|
18710
|
+
sl_offset_percentage_from_mark: ""
|
|
18649
18711
|
}));
|
|
18650
18712
|
},
|
|
18651
18713
|
hasTP_SL: () => {
|
|
@@ -18736,6 +18798,42 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18736
18798
|
symbolInfo2
|
|
18737
18799
|
);
|
|
18738
18800
|
}
|
|
18801
|
+
if (newValues.tp_offset_from_mark !== void 0 && newValues.tp_offset_from_mark !== "") {
|
|
18802
|
+
newValues = calculate2(
|
|
18803
|
+
newValues,
|
|
18804
|
+
"tp_offset_from_mark",
|
|
18805
|
+
newValues.tp_offset_from_mark,
|
|
18806
|
+
markPrice,
|
|
18807
|
+
symbolInfo2
|
|
18808
|
+
);
|
|
18809
|
+
}
|
|
18810
|
+
if (newValues.tp_offset_percentage_from_mark !== void 0 && newValues.tp_offset_percentage_from_mark !== "") {
|
|
18811
|
+
newValues = calculate2(
|
|
18812
|
+
newValues,
|
|
18813
|
+
"tp_offset_percentage_from_mark",
|
|
18814
|
+
newValues.tp_offset_percentage_from_mark,
|
|
18815
|
+
markPrice,
|
|
18816
|
+
symbolInfo2
|
|
18817
|
+
);
|
|
18818
|
+
}
|
|
18819
|
+
if (newValues.sl_offset_from_mark !== void 0 && newValues.sl_offset_from_mark !== "") {
|
|
18820
|
+
newValues = calculate2(
|
|
18821
|
+
newValues,
|
|
18822
|
+
"sl_offset_from_mark",
|
|
18823
|
+
newValues.sl_offset_from_mark,
|
|
18824
|
+
markPrice,
|
|
18825
|
+
symbolInfo2
|
|
18826
|
+
);
|
|
18827
|
+
}
|
|
18828
|
+
if (newValues.sl_offset_percentage_from_mark !== void 0 && newValues.sl_offset_percentage_from_mark !== "") {
|
|
18829
|
+
newValues = calculate2(
|
|
18830
|
+
newValues,
|
|
18831
|
+
"sl_offset_percentage_from_mark",
|
|
18832
|
+
newValues.sl_offset_percentage_from_mark,
|
|
18833
|
+
markPrice,
|
|
18834
|
+
symbolInfo2
|
|
18835
|
+
);
|
|
18836
|
+
}
|
|
18739
18837
|
} else {
|
|
18740
18838
|
if (typeof newValues.tp_trigger_price !== "undefined") {
|
|
18741
18839
|
newValues = calculate2(
|
|
@@ -18755,6 +18853,42 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18755
18853
|
symbolInfo2
|
|
18756
18854
|
);
|
|
18757
18855
|
}
|
|
18856
|
+
if (newValues.tp_offset_from_mark !== void 0 && newValues.tp_offset_from_mark !== "") {
|
|
18857
|
+
newValues = calculate2(
|
|
18858
|
+
newValues,
|
|
18859
|
+
"tp_offset_from_mark",
|
|
18860
|
+
newValues.tp_offset_from_mark,
|
|
18861
|
+
markPrice,
|
|
18862
|
+
symbolInfo2
|
|
18863
|
+
);
|
|
18864
|
+
}
|
|
18865
|
+
if (newValues.tp_offset_percentage_from_mark !== void 0 && newValues.tp_offset_percentage_from_mark !== "") {
|
|
18866
|
+
newValues = calculate2(
|
|
18867
|
+
newValues,
|
|
18868
|
+
"tp_offset_percentage_from_mark",
|
|
18869
|
+
newValues.tp_offset_percentage_from_mark,
|
|
18870
|
+
markPrice,
|
|
18871
|
+
symbolInfo2
|
|
18872
|
+
);
|
|
18873
|
+
}
|
|
18874
|
+
if (newValues.sl_offset_from_mark !== void 0 && newValues.sl_offset_from_mark !== "") {
|
|
18875
|
+
newValues = calculate2(
|
|
18876
|
+
newValues,
|
|
18877
|
+
"sl_offset_from_mark",
|
|
18878
|
+
newValues.sl_offset_from_mark,
|
|
18879
|
+
markPrice,
|
|
18880
|
+
symbolInfo2
|
|
18881
|
+
);
|
|
18882
|
+
}
|
|
18883
|
+
if (newValues.sl_offset_percentage_from_mark !== void 0 && newValues.sl_offset_percentage_from_mark !== "") {
|
|
18884
|
+
newValues = calculate2(
|
|
18885
|
+
newValues,
|
|
18886
|
+
"sl_offset_percentage_from_mark",
|
|
18887
|
+
newValues.sl_offset_percentage_from_mark,
|
|
18888
|
+
markPrice,
|
|
18889
|
+
symbolInfo2
|
|
18890
|
+
);
|
|
18891
|
+
}
|
|
18758
18892
|
}
|
|
18759
18893
|
return newValues;
|
|
18760
18894
|
};
|
|
@@ -19772,6 +19906,9 @@ var useTpslPriceChecker = (params) => {
|
|
|
19772
19906
|
return null;
|
|
19773
19907
|
}
|
|
19774
19908
|
}
|
|
19909
|
+
if (typeof liqPrice === "number" && (!Number.isFinite(liqPrice) || liqPrice <= 0)) {
|
|
19910
|
+
return null;
|
|
19911
|
+
}
|
|
19775
19912
|
let slPriceDecimal;
|
|
19776
19913
|
let liqPriceDecimal;
|
|
19777
19914
|
try {
|