scope360-core 0.0.228 → 0.0.230

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.
@@ -20894,10 +20894,14 @@ const ev = /* @__PURE__ */ OR("line", Ll), PR = { class: "chart-container" }, tv
20894
20894
  let p = [];
20895
20895
  switch (e.dataType) {
20896
20896
  case "balanceChartData":
20897
- p = d.length !== 0 ? d.map((g) => (h.add(g.date), on(g.balance * Qf(), 2))) : [0, 0];
20897
+ d.length === 0 ? p = [0, 0] : p = d.map((g) => (h.add(g.date), on(g.balance * Qf(), 2)));
20898
20898
  break;
20899
20899
  case "performanceChartData":
20900
- p = d.length !== 0 ? d.map((g, y) => (h.add(g.date), on(y ? g.pnl_to_deposit + g[y - 1].pnl_to_deposit : g.pnl_to_deposit, 2))) : [0, 0];
20900
+ d.length === 0 ? p = [0, 0] : p = d.reduce((g, y, w) => {
20901
+ h.add(y.date);
20902
+ const b = w ? g[w - 1] : 0, T = on(b + y.pnl_to_deposit, 2);
20903
+ return g.push(T), g;
20904
+ }, []);
20901
20905
  break;
20902
20906
  }
20903
20907
  f.push({
@@ -21711,7 +21715,7 @@ const ev = /* @__PURE__ */ OR("line", Ll), PR = { class: "chart-container" }, tv
21711
21715
  ])
21712
21716
  ]));
21713
21717
  }
21714
- }, p5 = /* @__PURE__ */ Ue(C$, [["__scopeId", "data-v-139cca32"]]), bf = (t) => (xn("data-v-cbc80015"), t = t(), Sn(), t), A$ = { class: "winrate-widget" }, R$ = { class: "winrate-widget__winrate" }, E$ = { class: "winrate-widget__title-wrapper" }, $$ = /* @__PURE__ */ bf(() => /* @__PURE__ */ A("div", { class: "winrate-widget__title" }, "Daily Winrate", -1)), I$ = { class: "winrate-widget__chart" }, N$ = { class: "winrate-widget__data" }, L$ = { class: "winrate-widget__data_value" }, F$ = /* @__PURE__ */ bf(() => /* @__PURE__ */ A("div", { class: "winrate-widget__data_title" }, "Winrate", -1)), Y$ = { class: "winrate-widget__average-rr" }, V$ = { class: "winrate-widget__title-wrapper" }, B$ = /* @__PURE__ */ bf(() => /* @__PURE__ */ A("div", { class: "winrate-widget__title" }, "Average RR", -1)), W$ = {
21718
+ }, p5 = /* @__PURE__ */ Ue(C$, [["__scopeId", "data-v-139cca32"]]), bf = (t) => (xn("data-v-ac0909db"), t = t(), Sn(), t), A$ = { class: "winrate-widget" }, R$ = { class: "winrate-widget__winrate" }, E$ = { class: "winrate-widget__title-wrapper" }, $$ = /* @__PURE__ */ bf(() => /* @__PURE__ */ A("div", { class: "winrate-widget__title" }, "Daily Winrate", -1)), I$ = { class: "winrate-widget__chart" }, N$ = { class: "winrate-widget__data" }, L$ = { class: "winrate-widget__data_value" }, F$ = /* @__PURE__ */ bf(() => /* @__PURE__ */ A("div", { class: "winrate-widget__data_title" }, "Winrate", -1)), Y$ = { class: "winrate-widget__average-rr" }, V$ = { class: "winrate-widget__title-wrapper" }, B$ = /* @__PURE__ */ bf(() => /* @__PURE__ */ A("div", { class: "winrate-widget__title" }, "Average RR", -1)), W$ = {
21715
21719
  __name: "WinrateWidget",
21716
21720
  props: {
21717
21721
  winrate: { type: Number, default: 0 },
@@ -21759,7 +21763,7 @@ const ev = /* @__PURE__ */ OR("line", Ll), PR = { class: "chart-container" }, tv
21759
21763
  ])
21760
21764
  ]));
21761
21765
  }
21762
- }, g5 = /* @__PURE__ */ Ue(W$, [["__scopeId", "data-v-cbc80015"]]), z$ = (t) => (xn("data-v-e6d713b2"), t = t(), Sn(), t), H$ = { class: "average-rr-line-container" }, U$ = { class: "average-rr-line" }, j$ = {
21766
+ }, g5 = /* @__PURE__ */ Ue(W$, [["__scopeId", "data-v-ac0909db"]]), z$ = (t) => (xn("data-v-e6d713b2"), t = t(), Sn(), t), H$ = { class: "average-rr-line-container" }, U$ = { class: "average-rr-line" }, j$ = {
21763
21767
  key: 0,
21764
21768
  class: "average-rr-line__progress"
21765
21769
  }, q$ = /* @__PURE__ */ z$(() => /* @__PURE__ */ A("div", { class: "average-rr-line__dot" }, null, -1)), G$ = [
@@ -30014,7 +30018,14 @@ function Ba(t) {
30014
30018
  function on(t, e = 2) {
30015
30019
  return isNaN(+t) ? 0 : Math.floor(+t * 10 ** e) / 10 ** e;
30016
30020
  }
30017
- function _5(t) {
30021
+ function _5(t, e) {
30022
+ const n = parseFloat(t.entry_price), s = t.amount, i = t.balance_before, r = t.side;
30023
+ let a = 0;
30024
+ r === "SHORT" ? a = (n - e) * s : r === "LONG" && (a = (e - n) * s);
30025
+ const o = a / i * 100;
30026
+ return { pnl: a, pnlToBalanceRatio: o };
30027
+ }
30028
+ function v5(t) {
30018
30029
  if (isNaN(+t))
30019
30030
  return 0;
30020
30031
  const e = parseFloat(String(t));
@@ -30038,19 +30049,19 @@ function Be(t, e, n = {}) {
30038
30049
  let o, l;
30039
30050
  return t ? (o = r === "$" ? Mu() : r, l = a === "$" ? Mu() : a, o + i.repeat(s) + l) : e;
30040
30051
  }
30041
- function v5(t) {
30052
+ function b5(t) {
30042
30053
  return t.reduce((e, n, s) => s === 0 ? `key=${encodeURIComponent(n.id)}` : e + `&key=${encodeURIComponent(n.id)}`, "");
30043
30054
  }
30044
- function b5(t) {
30055
+ function w5(t) {
30045
30056
  return new Date(t).getFullYear();
30046
30057
  }
30047
- function w5(t) {
30058
+ function k5(t) {
30048
30059
  return Oe.fromISO(t, { setZone: !0 }).toFormat("dd LLLL, y, TT");
30049
30060
  }
30050
30061
  function LV(t) {
30051
30062
  return Oe.fromISO(t, { setZone: !0 }).toFormat("dd/LL/y");
30052
30063
  }
30053
- function k5(t) {
30064
+ function x5(t) {
30054
30065
  return [
30055
30066
  "January",
30056
30067
  "February",
@@ -30066,13 +30077,13 @@ function k5(t) {
30066
30077
  "December"
30067
30078
  ][new Date(t).getMonth()];
30068
30079
  }
30069
- function x5(t) {
30080
+ function S5(t) {
30070
30081
  return new Date(t).getDate();
30071
30082
  }
30072
30083
  function Kg(t) {
30073
30084
  return Oe.fromISO(t, { setZone: !0 }).toFormat("cccc");
30074
30085
  }
30075
- function S5(t) {
30086
+ function M5(t) {
30076
30087
  const e = new Date(t), s = /* @__PURE__ */ new Date() - e;
30077
30088
  return Math.floor(s / (1e3 * 3600 * 24));
30078
30089
  }
@@ -30105,7 +30116,7 @@ const ft = (t, e = {
30105
30116
  let s = Math.abs(t);
30106
30117
  return e.isFixed && (s = on(s)), e.isPercentage ? `${n}${s}%` : `${n}${Mu()}${on(s * Qf())}`;
30107
30118
  };
30108
- function M5(t, e) {
30119
+ function T5(t, e) {
30109
30120
  const n = +new Date(e) - +new Date(t), s = Math.floor(n / (1e3 * 60 * 60 * 24)), i = Math.floor(
30110
30121
  n % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)
30111
30122
  ), r = Math.floor(n % (1e3 * 60 * 60) / (1e3 * 60)), a = Math.floor(n % (1e3 * 60) / 1e3);
@@ -30207,23 +30218,24 @@ export {
30207
30218
  zf as WidgetChips,
30208
30219
  g5 as WinrateWidget,
30209
30220
  FV as addSlashToPair,
30210
- M5 as calculateTimeDifference,
30221
+ _5 as calculatePNL,
30222
+ T5 as calculateTimeDifference,
30211
30223
  y5 as firebaseConfig,
30212
30224
  LV as formatDate,
30213
30225
  Qf as getCurrencyRate,
30214
30226
  Mu as getCurrencySymbol,
30215
- x5 as getDate,
30227
+ S5 as getDate,
30216
30228
  Kg as getDay,
30217
- S5 as getDaysDifference,
30218
- b5 as getFullYear,
30219
- k5 as getMonth,
30229
+ M5 as getDaysDifference,
30230
+ w5 as getFullYear,
30231
+ x5 as getMonth,
30220
30232
  Be as maskData,
30221
30233
  Zg as numFormat,
30222
30234
  sh as scopeInstance,
30223
- w5 as toBaseDate,
30224
- _5 as toDynamicFix,
30235
+ k5 as toBaseDate,
30236
+ v5 as toDynamicFix,
30225
30237
  on as toFix,
30226
- v5 as transformKeysToQuery,
30238
+ b5 as transformKeysToQuery,
30227
30239
  Jb as useToast,
30228
30240
  ft as withSign
30229
30241
  };