scope360-core 0.0.226 → 0.0.227

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.
@@ -30014,7 +30014,14 @@ function Ba(t) {
30014
30014
  function on(t, e = 2) {
30015
30015
  return isNaN(+t) ? 0 : Math.floor(+t * 10 ** e) / 10 ** e;
30016
30016
  }
30017
- function _5(t) {
30017
+ function _5(t, e) {
30018
+ const n = parseFloat(t.entry_price), s = t.amount, i = t.balance_before, r = t.side;
30019
+ let a = 0;
30020
+ r === "SHORT" ? a = (n - e) * s : r === "LONG" && (a = (e - n) * s);
30021
+ const o = a / i * 100;
30022
+ return { pnl: a, pnlToBalanceRatio: o };
30023
+ }
30024
+ function v5(t) {
30018
30025
  if (isNaN(+t))
30019
30026
  return 0;
30020
30027
  const e = parseFloat(String(t));
@@ -30038,19 +30045,19 @@ function Be(t, e, n = {}) {
30038
30045
  let o, l;
30039
30046
  return t ? (o = r === "$" ? Mu() : r, l = a === "$" ? Mu() : a, o + i.repeat(s) + l) : e;
30040
30047
  }
30041
- function v5(t) {
30048
+ function b5(t) {
30042
30049
  return t.reduce((e, n, s) => s === 0 ? `key=${encodeURIComponent(n.id)}` : e + `&key=${encodeURIComponent(n.id)}`, "");
30043
30050
  }
30044
- function b5(t) {
30051
+ function w5(t) {
30045
30052
  return new Date(t).getFullYear();
30046
30053
  }
30047
- function w5(t) {
30054
+ function k5(t) {
30048
30055
  return Oe.fromISO(t, { setZone: !0 }).toFormat("dd LLLL, y, TT");
30049
30056
  }
30050
30057
  function LV(t) {
30051
30058
  return Oe.fromISO(t, { setZone: !0 }).toFormat("dd/LL/y");
30052
30059
  }
30053
- function k5(t) {
30060
+ function x5(t) {
30054
30061
  return [
30055
30062
  "January",
30056
30063
  "February",
@@ -30066,13 +30073,13 @@ function k5(t) {
30066
30073
  "December"
30067
30074
  ][new Date(t).getMonth()];
30068
30075
  }
30069
- function x5(t) {
30076
+ function S5(t) {
30070
30077
  return new Date(t).getDate();
30071
30078
  }
30072
30079
  function Kg(t) {
30073
30080
  return Oe.fromISO(t, { setZone: !0 }).toFormat("cccc");
30074
30081
  }
30075
- function S5(t) {
30082
+ function M5(t) {
30076
30083
  const e = new Date(t), s = /* @__PURE__ */ new Date() - e;
30077
30084
  return Math.floor(s / (1e3 * 3600 * 24));
30078
30085
  }
@@ -30105,7 +30112,7 @@ const ft = (t, e = {
30105
30112
  let s = Math.abs(t);
30106
30113
  return e.isFixed && (s = on(s)), e.isPercentage ? `${n}${s}%` : `${n}${Mu()}${on(s * Qf())}`;
30107
30114
  };
30108
- function M5(t, e) {
30115
+ function T5(t, e) {
30109
30116
  const n = +new Date(e) - +new Date(t), s = Math.floor(n / (1e3 * 60 * 60 * 24)), i = Math.floor(
30110
30117
  n % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)
30111
30118
  ), r = Math.floor(n % (1e3 * 60 * 60) / (1e3 * 60)), a = Math.floor(n % (1e3 * 60) / 1e3);
@@ -30207,23 +30214,24 @@ export {
30207
30214
  zf as WidgetChips,
30208
30215
  g5 as WinrateWidget,
30209
30216
  FV as addSlashToPair,
30210
- M5 as calculateTimeDifference,
30217
+ _5 as calculatePNL,
30218
+ T5 as calculateTimeDifference,
30211
30219
  y5 as firebaseConfig,
30212
30220
  LV as formatDate,
30213
30221
  Qf as getCurrencyRate,
30214
30222
  Mu as getCurrencySymbol,
30215
- x5 as getDate,
30223
+ S5 as getDate,
30216
30224
  Kg as getDay,
30217
- S5 as getDaysDifference,
30218
- b5 as getFullYear,
30219
- k5 as getMonth,
30225
+ M5 as getDaysDifference,
30226
+ w5 as getFullYear,
30227
+ x5 as getMonth,
30220
30228
  Be as maskData,
30221
30229
  Zg as numFormat,
30222
30230
  sh as scopeInstance,
30223
- w5 as toBaseDate,
30224
- _5 as toDynamicFix,
30231
+ k5 as toBaseDate,
30232
+ v5 as toDynamicFix,
30225
30233
  on as toFix,
30226
- v5 as transformKeysToQuery,
30234
+ b5 as transformKeysToQuery,
30227
30235
  Jb as useToast,
30228
30236
  ft as withSign
30229
30237
  };