scope360-core 0.0.225 → 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
  }
@@ -30095,13 +30102,17 @@ function Qf() {
30095
30102
  const t = xt.getItem("scope360::currency");
30096
30103
  return t && (t != null && t.split("::")[1]) ? +(t == null ? void 0 : t.split("::")[1]) : 1;
30097
30104
  }
30098
- const ft = (t, e = { isPercentage: !1, isFixed: !0, isPlus: !1 }) => {
30105
+ const ft = (t, e = {
30106
+ isPercentage: !1,
30107
+ isFixed: !0,
30108
+ isPlus: !1
30109
+ }) => {
30099
30110
  let n;
30100
30111
  t >= 0 ? n = e.isPlus && t !== 0 ? "+" : "" : n = "-";
30101
30112
  let s = Math.abs(t);
30102
30113
  return e.isFixed && (s = on(s)), e.isPercentage ? `${n}${s}%` : `${n}${Mu()}${on(s * Qf())}`;
30103
30114
  };
30104
- function M5(t, e) {
30115
+ function T5(t, e) {
30105
30116
  const n = +new Date(e) - +new Date(t), s = Math.floor(n / (1e3 * 60 * 60 * 24)), i = Math.floor(
30106
30117
  n % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)
30107
30118
  ), r = Math.floor(n % (1e3 * 60 * 60) / (1e3 * 60)), a = Math.floor(n % (1e3 * 60) / 1e3);
@@ -30203,23 +30214,24 @@ export {
30203
30214
  zf as WidgetChips,
30204
30215
  g5 as WinrateWidget,
30205
30216
  FV as addSlashToPair,
30206
- M5 as calculateTimeDifference,
30217
+ _5 as calculatePNL,
30218
+ T5 as calculateTimeDifference,
30207
30219
  y5 as firebaseConfig,
30208
30220
  LV as formatDate,
30209
30221
  Qf as getCurrencyRate,
30210
30222
  Mu as getCurrencySymbol,
30211
- x5 as getDate,
30223
+ S5 as getDate,
30212
30224
  Kg as getDay,
30213
- S5 as getDaysDifference,
30214
- b5 as getFullYear,
30215
- k5 as getMonth,
30225
+ M5 as getDaysDifference,
30226
+ w5 as getFullYear,
30227
+ x5 as getMonth,
30216
30228
  Be as maskData,
30217
30229
  Zg as numFormat,
30218
30230
  sh as scopeInstance,
30219
- w5 as toBaseDate,
30220
- _5 as toDynamicFix,
30231
+ k5 as toBaseDate,
30232
+ v5 as toDynamicFix,
30221
30233
  on as toFix,
30222
- v5 as transformKeysToQuery,
30234
+ b5 as transformKeysToQuery,
30223
30235
  Jb as useToast,
30224
30236
  ft as withSign
30225
30237
  };