@gbozee/ultimate 0.0.2-146 → 0.0.2-147

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.
@@ -10,12 +10,12 @@ function calculateTheoreticalKelly({
10
10
  confidence_factor = 0.6,
11
11
  volatility_adjustment = true
12
12
  } = config;
13
- const sorted_prices = kind === "long" ? zone_prices : zone_prices.reverse();
13
+ const sorted_prices = zone_prices;
14
14
  const current_index = sorted_prices.findIndex((price) => price === current_entry);
15
15
  if (current_index === -1)
16
16
  return 0.02;
17
- const win_zones = kind === "long" ? sorted_prices.slice(current_index + 1) : sorted_prices.slice(0, current_index);
18
- const lose_zones = kind === "long" ? sorted_prices.slice(0, current_index) : sorted_prices.slice(current_index + 1);
17
+ const win_zones = kind === "long" ? sorted_prices.filter((price) => price > current_entry) : sorted_prices.filter((price) => price < current_entry);
18
+ const lose_zones = kind === "long" ? sorted_prices.filter((price) => price < current_entry) : sorted_prices.filter((price) => price > current_entry);
19
19
  const { win_probability, avg_win_ratio, avg_loss_ratio } = calculateZoneProbabilities({
20
20
  current_entry,
21
21
  win_zones,
package/dist/index.cjs CHANGED
@@ -52882,12 +52882,12 @@ function calculateTheoreticalKelly({
52882
52882
  confidence_factor = 0.6,
52883
52883
  volatility_adjustment = true
52884
52884
  } = config2;
52885
- const sorted_prices = kind === "long" ? zone_prices : zone_prices.reverse();
52885
+ const sorted_prices = zone_prices;
52886
52886
  const current_index = sorted_prices.findIndex((price) => price === current_entry);
52887
52887
  if (current_index === -1)
52888
52888
  return 0.02;
52889
- const win_zones = kind === "long" ? sorted_prices.slice(current_index + 1) : sorted_prices.slice(0, current_index);
52890
- const lose_zones = kind === "long" ? sorted_prices.slice(0, current_index) : sorted_prices.slice(current_index + 1);
52889
+ const win_zones = kind === "long" ? sorted_prices.filter((price) => price > current_entry) : sorted_prices.filter((price) => price < current_entry);
52890
+ const lose_zones = kind === "long" ? sorted_prices.filter((price) => price < current_entry) : sorted_prices.filter((price) => price > current_entry);
52891
52891
  const { win_probability, avg_win_ratio, avg_loss_ratio } = calculateZoneProbabilities({
52892
52892
  current_entry,
52893
52893
  win_zones,
@@ -58271,7 +58271,7 @@ class ExchangeAccount {
58271
58271
  return app_config;
58272
58272
  }
58273
58273
  async tradeConfig(payload) {
58274
- const { symbol, kind } = payload;
58274
+ const { symbol, kind, override = {} } = payload;
58275
58275
  const config2 = await this.getPositionConfig({
58276
58276
  symbol,
58277
58277
  kind
@@ -58285,7 +58285,8 @@ class ExchangeAccount {
58285
58285
  use_kelly: config2.kelly?.use_kelly,
58286
58286
  kelly_confidence_factor: config2.kelly?.kelly_confidence_factor,
58287
58287
  kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
58288
- kelly_prediction_model: config2.kelly?.kelly_prediction_model
58288
+ kelly_prediction_model: config2.kelly?.kelly_prediction_model,
58289
+ ...override
58289
58290
  });
58290
58291
  return app_config;
58291
58292
  }
package/dist/index.d.ts CHANGED
@@ -1900,6 +1900,7 @@ declare class ExchangeAccount$1 {
1900
1900
  tradeConfig(payload: {
1901
1901
  symbol: string;
1902
1902
  kind: "long" | "short";
1903
+ override?: any;
1903
1904
  }): Promise<AppConfig>;
1904
1905
  justInTimeProfit(payload: {
1905
1906
  symbol: string;
package/dist/index.js CHANGED
@@ -52830,12 +52830,12 @@ function calculateTheoreticalKelly({
52830
52830
  confidence_factor = 0.6,
52831
52831
  volatility_adjustment = true
52832
52832
  } = config2;
52833
- const sorted_prices = kind === "long" ? zone_prices : zone_prices.reverse();
52833
+ const sorted_prices = zone_prices;
52834
52834
  const current_index = sorted_prices.findIndex((price) => price === current_entry);
52835
52835
  if (current_index === -1)
52836
52836
  return 0.02;
52837
- const win_zones = kind === "long" ? sorted_prices.slice(current_index + 1) : sorted_prices.slice(0, current_index);
52838
- const lose_zones = kind === "long" ? sorted_prices.slice(0, current_index) : sorted_prices.slice(current_index + 1);
52837
+ const win_zones = kind === "long" ? sorted_prices.filter((price) => price > current_entry) : sorted_prices.filter((price) => price < current_entry);
52838
+ const lose_zones = kind === "long" ? sorted_prices.filter((price) => price < current_entry) : sorted_prices.filter((price) => price > current_entry);
52839
52839
  const { win_probability, avg_win_ratio, avg_loss_ratio } = calculateZoneProbabilities({
52840
52840
  current_entry,
52841
52841
  win_zones,
@@ -58219,7 +58219,7 @@ class ExchangeAccount {
58219
58219
  return app_config;
58220
58220
  }
58221
58221
  async tradeConfig(payload) {
58222
- const { symbol, kind } = payload;
58222
+ const { symbol, kind, override = {} } = payload;
58223
58223
  const config2 = await this.getPositionConfig({
58224
58224
  symbol,
58225
58225
  kind
@@ -58233,7 +58233,8 @@ class ExchangeAccount {
58233
58233
  use_kelly: config2.kelly?.use_kelly,
58234
58234
  kelly_confidence_factor: config2.kelly?.kelly_confidence_factor,
58235
58235
  kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
58236
- kelly_prediction_model: config2.kelly?.kelly_prediction_model
58236
+ kelly_prediction_model: config2.kelly?.kelly_prediction_model,
58237
+ ...override
58237
58238
  });
58238
58239
  return app_config;
58239
58240
  }
@@ -59577,12 +59577,12 @@ function calculateTheoreticalKelly({
59577
59577
  confidence_factor = 0.6,
59578
59578
  volatility_adjustment = true
59579
59579
  } = config2;
59580
- const sorted_prices = kind === "long" ? zone_prices : zone_prices.reverse();
59580
+ const sorted_prices = zone_prices;
59581
59581
  const current_index = sorted_prices.findIndex((price) => price === current_entry);
59582
59582
  if (current_index === -1)
59583
59583
  return 0.02;
59584
- const win_zones = kind === "long" ? sorted_prices.slice(current_index + 1) : sorted_prices.slice(0, current_index);
59585
- const lose_zones = kind === "long" ? sorted_prices.slice(0, current_index) : sorted_prices.slice(current_index + 1);
59584
+ const win_zones = kind === "long" ? sorted_prices.filter((price) => price > current_entry) : sorted_prices.filter((price) => price < current_entry);
59585
+ const lose_zones = kind === "long" ? sorted_prices.filter((price) => price < current_entry) : sorted_prices.filter((price) => price > current_entry);
59586
59586
  const { win_probability, avg_win_ratio, avg_loss_ratio } = calculateZoneProbabilities({
59587
59587
  current_entry,
59588
59588
  win_zones,
@@ -64947,7 +64947,7 @@ class ExchangeAccount {
64947
64947
  return app_config;
64948
64948
  }
64949
64949
  async tradeConfig(payload) {
64950
- const { symbol, kind } = payload;
64950
+ const { symbol, kind, override = {} } = payload;
64951
64951
  const config2 = await this.getPositionConfig({
64952
64952
  symbol,
64953
64953
  kind
@@ -64961,7 +64961,8 @@ class ExchangeAccount {
64961
64961
  use_kelly: config2.kelly?.use_kelly,
64962
64962
  kelly_confidence_factor: config2.kelly?.kelly_confidence_factor,
64963
64963
  kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
64964
- kelly_prediction_model: config2.kelly?.kelly_prediction_model
64964
+ kelly_prediction_model: config2.kelly?.kelly_prediction_model,
64965
+ ...override
64965
64966
  });
64966
64967
  return app_config;
64967
64968
  }
@@ -59554,12 +59554,12 @@ function calculateTheoreticalKelly({
59554
59554
  confidence_factor = 0.6,
59555
59555
  volatility_adjustment = true
59556
59556
  } = config2;
59557
- const sorted_prices = kind === "long" ? zone_prices : zone_prices.reverse();
59557
+ const sorted_prices = zone_prices;
59558
59558
  const current_index = sorted_prices.findIndex((price) => price === current_entry);
59559
59559
  if (current_index === -1)
59560
59560
  return 0.02;
59561
- const win_zones = kind === "long" ? sorted_prices.slice(current_index + 1) : sorted_prices.slice(0, current_index);
59562
- const lose_zones = kind === "long" ? sorted_prices.slice(0, current_index) : sorted_prices.slice(current_index + 1);
59561
+ const win_zones = kind === "long" ? sorted_prices.filter((price) => price > current_entry) : sorted_prices.filter((price) => price < current_entry);
59562
+ const lose_zones = kind === "long" ? sorted_prices.filter((price) => price < current_entry) : sorted_prices.filter((price) => price > current_entry);
59563
59563
  const { win_probability, avg_win_ratio, avg_loss_ratio } = calculateZoneProbabilities({
59564
59564
  current_entry,
59565
59565
  win_zones,
@@ -64924,7 +64924,7 @@ class ExchangeAccount {
64924
64924
  return app_config;
64925
64925
  }
64926
64926
  async tradeConfig(payload) {
64927
- const { symbol, kind } = payload;
64927
+ const { symbol, kind, override = {} } = payload;
64928
64928
  const config2 = await this.getPositionConfig({
64929
64929
  symbol,
64930
64930
  kind
@@ -64938,7 +64938,8 @@ class ExchangeAccount {
64938
64938
  use_kelly: config2.kelly?.use_kelly,
64939
64939
  kelly_confidence_factor: config2.kelly?.kelly_confidence_factor,
64940
64940
  kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
64941
- kelly_prediction_model: config2.kelly?.kelly_prediction_model
64941
+ kelly_prediction_model: config2.kelly?.kelly_prediction_model,
64942
+ ...override
64942
64943
  });
64943
64944
  return app_config;
64944
64945
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-146",
4
+ "version": "0.0.2-147",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",