@tradecanvas/core 2.3.0 → 2.4.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.js CHANGED
@@ -21351,7 +21351,7 @@ function OC(e, t, n, r, i, a, o, s) {
21351
21351
  let l = n;
21352
21352
  t.cells.forEach((n, a) => {
21353
21353
  let u = i[a];
21354
- e.fillStyle = t.color, n.kind === "stamp" ? e.fillRect(l, r, u, 21) : a > 0 && e.fillRect(l, r, 1, 21), n.kind === "button" ? (vC(e, n.icon, l + (u - bC) / 2, r + (21 - bC) / 2, bC, o.text), s.push({
21354
+ e.fillStyle = t.color, n.kind === "stamp" ? e.fillRect(l, r, u, 21) : a > 0 && e.fillRect(l, r, 1, 21), n.kind === "button" ? (n.active && e.fillRect(l, r, u, 21), vC(e, n.icon, l + (u - bC) / 2, r + (21 - bC) / 2, bC, n.active ? un(t.color) : o.text), s.push({
21355
21355
  x: l,
21356
21356
  y: r,
21357
21357
  size: 21,
@@ -21447,7 +21447,7 @@ var zC = class {
21447
21447
  color: r === "stopLoss" ? i.loss : i.profit,
21448
21448
  cells: [{
21449
21449
  kind: "stamp",
21450
- text: r === "stopLoss" ? "SL" : "TP"
21450
+ text: r === "takeProfit" ? "TP" : typeof o.trailingStop == "number" && o.trailingStop > 0 ? "TSL" : "SL"
21451
21451
  }, {
21452
21452
  kind: "text",
21453
21453
  text: aC(l, lC(l, e, n.pricePrecision), t.numberLocale),
@@ -21602,7 +21602,8 @@ var ZC = class {
21602
21602
  type: "trailStop",
21603
21603
  positionId: e.id,
21604
21604
  distance: r
21605
- }
21605
+ },
21606
+ active: u
21606
21607
  });
21607
21608
  }
21608
21609
  return r.lineButtons?.removeStops !== !1 && JC(s, n) && !f && d.push({
@@ -22590,7 +22591,7 @@ var Mw = class {
22590
22591
  takeProfit: e.takeProfit,
22591
22592
  timeInForce: e.timeInForce
22592
22593
  };
22593
- return e.type === "market" ? this.fill(t, this.markPrice || e.price) : (this.orders = [...this.orders, t], this.emit("orders", this.orders)), t;
22594
+ return e.trailingStop !== void 0 && Number.isFinite(e.trailingStop) && e.trailingStop > 0 && (t.trailingStop = e.trailingStop), e.type === "market" ? this.fill(t, this.markPrice || e.price) : (this.orders = [...this.orders, t], this.emit("orders", this.orders)), t;
22594
22595
  }
22595
22596
  async modifyOrder(e) {
22596
22597
  this.orders = this.orders.map((t) => t.id === e.orderId ? {
@@ -22651,7 +22652,7 @@ var Mw = class {
22651
22652
  stopLoss: e.stopLoss,
22652
22653
  takeProfit: e.takeProfit
22653
22654
  };
22654
- this.positions = [...this.positions, n];
22655
+ e.trailingStop !== void 0 && (n.trailingStop = e.trailingStop), this.positions = [...this.positions, n];
22655
22656
  let r = {
22656
22657
  orderId: e.id,
22657
22658
  side: e.side,