@gbozee/ultimate 0.0.2-next.77 → 0.0.2-next.78

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.cjs CHANGED
@@ -73728,7 +73728,13 @@ function buildPosition(position2, orders, options) {
73728
73728
  { price: entry, quantity },
73729
73729
  ...limitOrders.map((o) => ({ price: o.price, quantity: o.qty }))
73730
73730
  ], decimal_places, price_places);
73731
- const stopOrders = orders.filter((x) => x.kind === kind && x.isStop)[0];
73731
+ const stopOrders = orders.filter((x) => x.kind === kind && x.isStop).sort((a, b) => {
73732
+ if (kind === "long") {
73733
+ return b.triggerPrice - a.triggerPrice;
73734
+ } else {
73735
+ return a.triggerPrice - b.triggerPrice;
73736
+ }
73737
+ })[0];
73732
73738
  const tpOrders = orders.filter((x) => x.kind === kind && !x.isStop).filter((x) => x.kind === "long" ? x.side === "sell" : x.side === "buy")[0];
73733
73739
  const avg_entry = avg.entry;
73734
73740
  const stop_loss = stopOrders?.triggerPrice || 0;
@@ -78578,7 +78584,6 @@ class ExchangeAccount {
78578
78584
  refresh: live_refresh,
78579
78585
  symbol
78580
78586
  });
78581
- console.log("active_accounts", active_account, live_refresh);
78582
78587
  if (leverage) {
78583
78588
  this.exchange.setLeverage({ symbol, leverage });
78584
78589
  }
package/dist/index.js CHANGED
@@ -73626,7 +73626,13 @@ function buildPosition(position2, orders, options) {
73626
73626
  { price: entry, quantity },
73627
73627
  ...limitOrders.map((o) => ({ price: o.price, quantity: o.qty }))
73628
73628
  ], decimal_places, price_places);
73629
- const stopOrders = orders.filter((x) => x.kind === kind && x.isStop)[0];
73629
+ const stopOrders = orders.filter((x) => x.kind === kind && x.isStop).sort((a, b) => {
73630
+ if (kind === "long") {
73631
+ return b.triggerPrice - a.triggerPrice;
73632
+ } else {
73633
+ return a.triggerPrice - b.triggerPrice;
73634
+ }
73635
+ })[0];
73630
73636
  const tpOrders = orders.filter((x) => x.kind === kind && !x.isStop).filter((x) => x.kind === "long" ? x.side === "sell" : x.side === "buy")[0];
73631
73637
  const avg_entry = avg.entry;
73632
73638
  const stop_loss = stopOrders?.triggerPrice || 0;
@@ -78476,7 +78482,6 @@ class ExchangeAccount {
78476
78482
  refresh: live_refresh,
78477
78483
  symbol
78478
78484
  });
78479
- console.log("active_accounts", active_account, live_refresh);
78480
78485
  if (leverage) {
78481
78486
  this.exchange.setLeverage({ symbol, leverage });
78482
78487
  }
@@ -77448,7 +77448,13 @@ function buildPosition(position2, orders, options) {
77448
77448
  { price: entry, quantity },
77449
77449
  ...limitOrders.map((o) => ({ price: o.price, quantity: o.qty }))
77450
77450
  ], decimal_places, price_places);
77451
- const stopOrders = orders.filter((x) => x.kind === kind && x.isStop)[0];
77451
+ const stopOrders = orders.filter((x) => x.kind === kind && x.isStop).sort((a, b) => {
77452
+ if (kind === "long") {
77453
+ return b.triggerPrice - a.triggerPrice;
77454
+ } else {
77455
+ return a.triggerPrice - b.triggerPrice;
77456
+ }
77457
+ })[0];
77452
77458
  const tpOrders = orders.filter((x) => x.kind === kind && !x.isStop).filter((x) => x.kind === "long" ? x.side === "sell" : x.side === "buy")[0];
77453
77459
  const avg_entry = avg.entry;
77454
77460
  const stop_loss = stopOrders?.triggerPrice || 0;
@@ -82298,7 +82304,6 @@ class ExchangeAccount {
82298
82304
  refresh: live_refresh,
82299
82305
  symbol
82300
82306
  });
82301
- console.log("active_accounts", active_account, live_refresh);
82302
82307
  if (leverage) {
82303
82308
  this.exchange.setLeverage({ symbol, leverage });
82304
82309
  }
@@ -77407,7 +77407,13 @@ function buildPosition(position2, orders, options) {
77407
77407
  { price: entry, quantity },
77408
77408
  ...limitOrders.map((o) => ({ price: o.price, quantity: o.qty }))
77409
77409
  ], decimal_places, price_places);
77410
- const stopOrders = orders.filter((x) => x.kind === kind && x.isStop)[0];
77410
+ const stopOrders = orders.filter((x) => x.kind === kind && x.isStop).sort((a, b) => {
77411
+ if (kind === "long") {
77412
+ return b.triggerPrice - a.triggerPrice;
77413
+ } else {
77414
+ return a.triggerPrice - b.triggerPrice;
77415
+ }
77416
+ })[0];
77411
77417
  const tpOrders = orders.filter((x) => x.kind === kind && !x.isStop).filter((x) => x.kind === "long" ? x.side === "sell" : x.side === "buy")[0];
77412
77418
  const avg_entry = avg.entry;
77413
77419
  const stop_loss = stopOrders?.triggerPrice || 0;
@@ -82257,7 +82263,6 @@ class ExchangeAccount {
82257
82263
  refresh: live_refresh,
82258
82264
  symbol
82259
82265
  });
82260
- console.log("active_accounts", active_account, live_refresh);
82261
82266
  if (leverage) {
82262
82267
  this.exchange.setLeverage({ symbol, leverage });
82263
82268
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-next.77",
4
+ "version": "0.0.2-next.78",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",