@gbozee/ultimate 0.0.2-next.61 → 0.0.2-next.64

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.
@@ -63,7 +63,8 @@ function generateExponential(payload) {
63
63
  risk_reward,
64
64
  kind,
65
65
  price_places = "%.1f",
66
- lambda
66
+ lambda,
67
+ reverse = false
67
68
  } = payload;
68
69
  const range = Math.abs(margin_range[1] - margin_range[0]);
69
70
  const effectiveLambda = lambda || 2.5;
@@ -72,7 +73,10 @@ function generateExponential(payload) {
72
73
  const t = i / risk_reward;
73
74
  const rawProgress = 1 - Math.exp(-effectiveLambda * t);
74
75
  const exponentialProgress = rawProgress / normalizationFactor;
75
- const price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
76
+ let price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
77
+ if (reverse) {
78
+ price = kind === "long" ? margin_range[0] + range * exponentialProgress : margin_range[1] - range * exponentialProgress;
79
+ }
76
80
  return to_f(price, price_places);
77
81
  });
78
82
  }
@@ -82,13 +86,17 @@ function generateInverseExponential(payload) {
82
86
  risk_reward,
83
87
  kind,
84
88
  price_places = "%.1f",
85
- curveFactor = 2
89
+ curveFactor = 2,
90
+ reverse = false
86
91
  } = payload;
87
92
  const range = Math.abs(margin_range[1] - margin_range[0]);
88
93
  return Array.from({ length: risk_reward + 1 }, (_, i) => {
89
94
  const t = i / risk_reward;
90
95
  const progress = (Math.exp(curveFactor * t) - 1) / (Math.exp(curveFactor) - 1);
91
- const price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
96
+ let price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
97
+ if (reverse) {
98
+ price = kind === "long" ? margin_range[0] + range * progress : margin_range[1] - range * progress;
99
+ }
92
100
  return to_f(price, price_places);
93
101
  });
94
102
  }
@@ -138,6 +146,16 @@ function getEntries(params) {
138
146
  lambda: distribution_params?.lambda
139
147
  });
140
148
  break;
149
+ case "reverse-exponential":
150
+ entries = generateExponential({
151
+ margin_range,
152
+ risk_reward,
153
+ kind,
154
+ price_places,
155
+ lambda: distribution_params?.lambda,
156
+ reverse: true
157
+ });
158
+ break;
141
159
  case "inverse-exponential":
142
160
  entries = generateInverseExponential({
143
161
  margin_range,
@@ -147,6 +165,16 @@ function getEntries(params) {
147
165
  curveFactor: distribution_params?.curveFactor
148
166
  });
149
167
  break;
168
+ case "reverse-inverse-exponential":
169
+ entries = generateInverseExponential({
170
+ margin_range,
171
+ risk_reward,
172
+ kind,
173
+ price_places,
174
+ curveFactor: distribution_params?.curveFactor,
175
+ reverse: true
176
+ });
177
+ break;
150
178
  case "lognormal":
151
179
  entries = generateLognormal({
152
180
  margin_range,
package/dist/index.cjs CHANGED
@@ -67616,7 +67616,8 @@ function generateExponential(payload) {
67616
67616
  risk_reward,
67617
67617
  kind,
67618
67618
  price_places = "%.1f",
67619
- lambda
67619
+ lambda,
67620
+ reverse = false
67620
67621
  } = payload;
67621
67622
  const range = Math.abs(margin_range[1] - margin_range[0]);
67622
67623
  const effectiveLambda = lambda || 2.5;
@@ -67625,7 +67626,10 @@ function generateExponential(payload) {
67625
67626
  const t2 = i2 / risk_reward;
67626
67627
  const rawProgress = 1 - Math.exp(-effectiveLambda * t2);
67627
67628
  const exponentialProgress = rawProgress / normalizationFactor;
67628
- const price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
67629
+ let price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
67630
+ if (reverse) {
67631
+ price = kind === "long" ? margin_range[0] + range * exponentialProgress : margin_range[1] - range * exponentialProgress;
67632
+ }
67629
67633
  return to_f(price, price_places);
67630
67634
  });
67631
67635
  }
@@ -67635,13 +67639,17 @@ function generateInverseExponential(payload) {
67635
67639
  risk_reward,
67636
67640
  kind,
67637
67641
  price_places = "%.1f",
67638
- curveFactor = 2
67642
+ curveFactor = 2,
67643
+ reverse = false
67639
67644
  } = payload;
67640
67645
  const range = Math.abs(margin_range[1] - margin_range[0]);
67641
67646
  return Array.from({ length: risk_reward + 1 }, (_, i2) => {
67642
67647
  const t2 = i2 / risk_reward;
67643
67648
  const progress = (Math.exp(curveFactor * t2) - 1) / (Math.exp(curveFactor) - 1);
67644
- const price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
67649
+ let price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
67650
+ if (reverse) {
67651
+ price = kind === "long" ? margin_range[0] + range * progress : margin_range[1] - range * progress;
67652
+ }
67645
67653
  return to_f(price, price_places);
67646
67654
  });
67647
67655
  }
@@ -67691,6 +67699,16 @@ function getEntries(params) {
67691
67699
  lambda: distribution_params?.lambda
67692
67700
  });
67693
67701
  break;
67702
+ case "reverse-exponential":
67703
+ entries = generateExponential({
67704
+ margin_range,
67705
+ risk_reward,
67706
+ kind,
67707
+ price_places,
67708
+ lambda: distribution_params?.lambda,
67709
+ reverse: true
67710
+ });
67711
+ break;
67694
67712
  case "inverse-exponential":
67695
67713
  entries = generateInverseExponential({
67696
67714
  margin_range,
@@ -67700,6 +67718,16 @@ function getEntries(params) {
67700
67718
  curveFactor: distribution_params?.curveFactor
67701
67719
  });
67702
67720
  break;
67721
+ case "reverse-inverse-exponential":
67722
+ entries = generateInverseExponential({
67723
+ margin_range,
67724
+ risk_reward,
67725
+ kind,
67726
+ price_places,
67727
+ curveFactor: distribution_params?.curveFactor,
67728
+ reverse: true
67729
+ });
67730
+ break;
67703
67731
  case "lognormal":
67704
67732
  entries = generateLognormal({
67705
67733
  margin_range,
@@ -74054,8 +74082,8 @@ async function cancelOrdersParallel(payload) {
74054
74082
  const batchResults = await Promise.all(batches.map((batch2) => limit(async () => {
74055
74083
  try {
74056
74084
  const result = await Promise.all(batch2.map((x) => {
74057
- let key = x.orderId ? "orderId" : "origClientOrderId";
74058
- let value2 = x.orderId ? x.orderId : x.clientOrderId;
74085
+ let key = x.clientOrderId ? "origClientOrderId" : "orderId";
74086
+ let value2 = x.clientOrderId ? x.clientOrderId : x.orderId;
74059
74087
  console.log("Cancelling regular order:", { [key]: value2 });
74060
74088
  return client.cancelOrder({
74061
74089
  symbol: payload.symbol,
@@ -75772,7 +75800,8 @@ class ExchangePosition {
75772
75800
  await this.exchange_account.placeProfitAndStop({
75773
75801
  symbol: this.symbol,
75774
75802
  trigger: true,
75775
- target_pnl
75803
+ target_pnl,
75804
+ kind: this.kind
75776
75805
  });
75777
75806
  }
75778
75807
  return [];
package/dist/index.js CHANGED
@@ -67528,7 +67528,8 @@ function generateExponential(payload) {
67528
67528
  risk_reward,
67529
67529
  kind,
67530
67530
  price_places = "%.1f",
67531
- lambda
67531
+ lambda,
67532
+ reverse = false
67532
67533
  } = payload;
67533
67534
  const range = Math.abs(margin_range[1] - margin_range[0]);
67534
67535
  const effectiveLambda = lambda || 2.5;
@@ -67537,7 +67538,10 @@ function generateExponential(payload) {
67537
67538
  const t2 = i2 / risk_reward;
67538
67539
  const rawProgress = 1 - Math.exp(-effectiveLambda * t2);
67539
67540
  const exponentialProgress = rawProgress / normalizationFactor;
67540
- const price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
67541
+ let price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
67542
+ if (reverse) {
67543
+ price = kind === "long" ? margin_range[0] + range * exponentialProgress : margin_range[1] - range * exponentialProgress;
67544
+ }
67541
67545
  return to_f(price, price_places);
67542
67546
  });
67543
67547
  }
@@ -67547,13 +67551,17 @@ function generateInverseExponential(payload) {
67547
67551
  risk_reward,
67548
67552
  kind,
67549
67553
  price_places = "%.1f",
67550
- curveFactor = 2
67554
+ curveFactor = 2,
67555
+ reverse = false
67551
67556
  } = payload;
67552
67557
  const range = Math.abs(margin_range[1] - margin_range[0]);
67553
67558
  return Array.from({ length: risk_reward + 1 }, (_, i2) => {
67554
67559
  const t2 = i2 / risk_reward;
67555
67560
  const progress = (Math.exp(curveFactor * t2) - 1) / (Math.exp(curveFactor) - 1);
67556
- const price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
67561
+ let price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
67562
+ if (reverse) {
67563
+ price = kind === "long" ? margin_range[0] + range * progress : margin_range[1] - range * progress;
67564
+ }
67557
67565
  return to_f(price, price_places);
67558
67566
  });
67559
67567
  }
@@ -67603,6 +67611,16 @@ function getEntries(params) {
67603
67611
  lambda: distribution_params?.lambda
67604
67612
  });
67605
67613
  break;
67614
+ case "reverse-exponential":
67615
+ entries = generateExponential({
67616
+ margin_range,
67617
+ risk_reward,
67618
+ kind,
67619
+ price_places,
67620
+ lambda: distribution_params?.lambda,
67621
+ reverse: true
67622
+ });
67623
+ break;
67606
67624
  case "inverse-exponential":
67607
67625
  entries = generateInverseExponential({
67608
67626
  margin_range,
@@ -67612,6 +67630,16 @@ function getEntries(params) {
67612
67630
  curveFactor: distribution_params?.curveFactor
67613
67631
  });
67614
67632
  break;
67633
+ case "reverse-inverse-exponential":
67634
+ entries = generateInverseExponential({
67635
+ margin_range,
67636
+ risk_reward,
67637
+ kind,
67638
+ price_places,
67639
+ curveFactor: distribution_params?.curveFactor,
67640
+ reverse: true
67641
+ });
67642
+ break;
67615
67643
  case "lognormal":
67616
67644
  entries = generateLognormal({
67617
67645
  margin_range,
@@ -73966,8 +73994,8 @@ async function cancelOrdersParallel(payload) {
73966
73994
  const batchResults = await Promise.all(batches.map((batch2) => limit(async () => {
73967
73995
  try {
73968
73996
  const result = await Promise.all(batch2.map((x) => {
73969
- let key = x.orderId ? "orderId" : "origClientOrderId";
73970
- let value2 = x.orderId ? x.orderId : x.clientOrderId;
73997
+ let key = x.clientOrderId ? "origClientOrderId" : "orderId";
73998
+ let value2 = x.clientOrderId ? x.clientOrderId : x.orderId;
73971
73999
  console.log("Cancelling regular order:", { [key]: value2 });
73972
74000
  return client.cancelOrder({
73973
74001
  symbol: payload.symbol,
@@ -75684,7 +75712,8 @@ class ExchangePosition {
75684
75712
  await this.exchange_account.placeProfitAndStop({
75685
75713
  symbol: this.symbol,
75686
75714
  trigger: true,
75687
- target_pnl
75715
+ target_pnl,
75716
+ kind: this.kind
75688
75717
  });
75689
75718
  }
75690
75719
  return [];
@@ -71449,7 +71449,8 @@ function generateExponential(payload) {
71449
71449
  risk_reward,
71450
71450
  kind,
71451
71451
  price_places = "%.1f",
71452
- lambda
71452
+ lambda,
71453
+ reverse = false
71453
71454
  } = payload;
71454
71455
  const range = Math.abs(margin_range[1] - margin_range[0]);
71455
71456
  const effectiveLambda = lambda || 2.5;
@@ -71458,7 +71459,10 @@ function generateExponential(payload) {
71458
71459
  const t2 = i2 / risk_reward;
71459
71460
  const rawProgress = 1 - Math.exp(-effectiveLambda * t2);
71460
71461
  const exponentialProgress = rawProgress / normalizationFactor;
71461
- const price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
71462
+ let price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
71463
+ if (reverse) {
71464
+ price = kind === "long" ? margin_range[0] + range * exponentialProgress : margin_range[1] - range * exponentialProgress;
71465
+ }
71462
71466
  return to_f(price, price_places);
71463
71467
  });
71464
71468
  }
@@ -71468,13 +71472,17 @@ function generateInverseExponential(payload) {
71468
71472
  risk_reward,
71469
71473
  kind,
71470
71474
  price_places = "%.1f",
71471
- curveFactor = 2
71475
+ curveFactor = 2,
71476
+ reverse = false
71472
71477
  } = payload;
71473
71478
  const range = Math.abs(margin_range[1] - margin_range[0]);
71474
71479
  return Array.from({ length: risk_reward + 1 }, (_, i2) => {
71475
71480
  const t2 = i2 / risk_reward;
71476
71481
  const progress = (Math.exp(curveFactor * t2) - 1) / (Math.exp(curveFactor) - 1);
71477
- const price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
71482
+ let price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
71483
+ if (reverse) {
71484
+ price = kind === "long" ? margin_range[0] + range * progress : margin_range[1] - range * progress;
71485
+ }
71478
71486
  return to_f(price, price_places);
71479
71487
  });
71480
71488
  }
@@ -71524,6 +71532,16 @@ function getEntries(params) {
71524
71532
  lambda: distribution_params?.lambda
71525
71533
  });
71526
71534
  break;
71535
+ case "reverse-exponential":
71536
+ entries = generateExponential({
71537
+ margin_range,
71538
+ risk_reward,
71539
+ kind,
71540
+ price_places,
71541
+ lambda: distribution_params?.lambda,
71542
+ reverse: true
71543
+ });
71544
+ break;
71527
71545
  case "inverse-exponential":
71528
71546
  entries = generateInverseExponential({
71529
71547
  margin_range,
@@ -71533,6 +71551,16 @@ function getEntries(params) {
71533
71551
  curveFactor: distribution_params?.curveFactor
71534
71552
  });
71535
71553
  break;
71554
+ case "reverse-inverse-exponential":
71555
+ entries = generateInverseExponential({
71556
+ margin_range,
71557
+ risk_reward,
71558
+ kind,
71559
+ price_places,
71560
+ curveFactor: distribution_params?.curveFactor,
71561
+ reverse: true
71562
+ });
71563
+ break;
71536
71564
  case "lognormal":
71537
71565
  entries = generateLognormal({
71538
71566
  margin_range,
@@ -77776,8 +77804,8 @@ async function cancelOrdersParallel(payload) {
77776
77804
  const batchResults = await Promise.all(batches.map((batch2) => limit(async () => {
77777
77805
  try {
77778
77806
  const result = await Promise.all(batch2.map((x) => {
77779
- let key = x.orderId ? "orderId" : "origClientOrderId";
77780
- let value2 = x.orderId ? x.orderId : x.clientOrderId;
77807
+ let key = x.clientOrderId ? "origClientOrderId" : "orderId";
77808
+ let value2 = x.clientOrderId ? x.clientOrderId : x.orderId;
77781
77809
  console.log("Cancelling regular order:", { [key]: value2 });
77782
77810
  return client.cancelOrder({
77783
77811
  symbol: payload.symbol,
@@ -79494,7 +79522,8 @@ class ExchangePosition {
79494
79522
  await this.exchange_account.placeProfitAndStop({
79495
79523
  symbol: this.symbol,
79496
79524
  trigger: true,
79497
- target_pnl
79525
+ target_pnl,
79526
+ kind: this.kind
79498
79527
  });
79499
79528
  }
79500
79529
  return [];
@@ -71422,7 +71422,8 @@ function generateExponential(payload) {
71422
71422
  risk_reward,
71423
71423
  kind,
71424
71424
  price_places = "%.1f",
71425
- lambda
71425
+ lambda,
71426
+ reverse = false
71426
71427
  } = payload;
71427
71428
  const range = Math.abs(margin_range[1] - margin_range[0]);
71428
71429
  const effectiveLambda = lambda || 2.5;
@@ -71431,7 +71432,10 @@ function generateExponential(payload) {
71431
71432
  const t2 = i2 / risk_reward;
71432
71433
  const rawProgress = 1 - Math.exp(-effectiveLambda * t2);
71433
71434
  const exponentialProgress = rawProgress / normalizationFactor;
71434
- const price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
71435
+ let price = kind === "long" ? margin_range[1] - range * exponentialProgress : margin_range[0] + range * exponentialProgress;
71436
+ if (reverse) {
71437
+ price = kind === "long" ? margin_range[0] + range * exponentialProgress : margin_range[1] - range * exponentialProgress;
71438
+ }
71435
71439
  return to_f(price, price_places);
71436
71440
  });
71437
71441
  }
@@ -71441,13 +71445,17 @@ function generateInverseExponential(payload) {
71441
71445
  risk_reward,
71442
71446
  kind,
71443
71447
  price_places = "%.1f",
71444
- curveFactor = 2
71448
+ curveFactor = 2,
71449
+ reverse = false
71445
71450
  } = payload;
71446
71451
  const range = Math.abs(margin_range[1] - margin_range[0]);
71447
71452
  return Array.from({ length: risk_reward + 1 }, (_, i2) => {
71448
71453
  const t2 = i2 / risk_reward;
71449
71454
  const progress = (Math.exp(curveFactor * t2) - 1) / (Math.exp(curveFactor) - 1);
71450
- const price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
71455
+ let price = kind === "long" ? margin_range[1] - range * progress : margin_range[0] + range * progress;
71456
+ if (reverse) {
71457
+ price = kind === "long" ? margin_range[0] + range * progress : margin_range[1] - range * progress;
71458
+ }
71451
71459
  return to_f(price, price_places);
71452
71460
  });
71453
71461
  }
@@ -71497,6 +71505,16 @@ function getEntries(params) {
71497
71505
  lambda: distribution_params?.lambda
71498
71506
  });
71499
71507
  break;
71508
+ case "reverse-exponential":
71509
+ entries = generateExponential({
71510
+ margin_range,
71511
+ risk_reward,
71512
+ kind,
71513
+ price_places,
71514
+ lambda: distribution_params?.lambda,
71515
+ reverse: true
71516
+ });
71517
+ break;
71500
71518
  case "inverse-exponential":
71501
71519
  entries = generateInverseExponential({
71502
71520
  margin_range,
@@ -71506,6 +71524,16 @@ function getEntries(params) {
71506
71524
  curveFactor: distribution_params?.curveFactor
71507
71525
  });
71508
71526
  break;
71527
+ case "reverse-inverse-exponential":
71528
+ entries = generateInverseExponential({
71529
+ margin_range,
71530
+ risk_reward,
71531
+ kind,
71532
+ price_places,
71533
+ curveFactor: distribution_params?.curveFactor,
71534
+ reverse: true
71535
+ });
71536
+ break;
71509
71537
  case "lognormal":
71510
71538
  entries = generateLognormal({
71511
71539
  margin_range,
@@ -77749,8 +77777,8 @@ async function cancelOrdersParallel(payload) {
77749
77777
  const batchResults = await Promise.all(batches.map((batch2) => limit(async () => {
77750
77778
  try {
77751
77779
  const result = await Promise.all(batch2.map((x) => {
77752
- let key = x.orderId ? "orderId" : "origClientOrderId";
77753
- let value2 = x.orderId ? x.orderId : x.clientOrderId;
77780
+ let key = x.clientOrderId ? "origClientOrderId" : "orderId";
77781
+ let value2 = x.clientOrderId ? x.clientOrderId : x.orderId;
77754
77782
  console.log("Cancelling regular order:", { [key]: value2 });
77755
77783
  return client.cancelOrder({
77756
77784
  symbol: payload.symbol,
@@ -79467,7 +79495,8 @@ class ExchangePosition {
79467
79495
  await this.exchange_account.placeProfitAndStop({
79468
79496
  symbol: this.symbol,
79469
79497
  trigger: true,
79470
- target_pnl
79498
+ target_pnl,
79499
+ kind: this.kind
79471
79500
  });
79472
79501
  }
79473
79502
  return [];
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.61",
4
+ "version": "0.0.2-next.64",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",