@gbozee/ultimate 0.0.2-93 → 0.0.2-94

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
@@ -51603,7 +51603,7 @@ class AppDatabase {
51603
51603
  table: "positions_view",
51604
51604
  params: {
51605
51605
  filter: `symbol:lower="${symbol.toLowerCase()}" && account:lower="${account.owner.toLowerCase()} ${account.exchange.toLowerCase()}"`,
51606
- expand: "config"
51606
+ expand: "config, account_strategy, p_account"
51607
51607
  }
51608
51608
  } : {
51609
51609
  table: "positions",
@@ -58771,15 +58771,19 @@ class ExchangeAccount {
58771
58771
  async profitWithinGapStrategy(payload) {
58772
58772
  const { symbol } = payload;
58773
58773
  let reward_factor = 1;
58774
- const strategy = await this.getAccountStrategy({ symbol });
58775
- if (!strategy) {
58776
- return;
58777
- }
58778
58774
  console.log("Fetching positions for ", symbol);
58779
58775
  const positions = await this.syncAccount({
58780
58776
  symbol,
58781
58777
  as_view: true
58782
58778
  });
58779
+ const focus_position = positions.find((k) => k.expand?.account_strategy);
58780
+ if (!focus_position) {
58781
+ return;
58782
+ }
58783
+ const strategy = focus_position?.expand?.account_strategy;
58784
+ if (!strategy) {
58785
+ return;
58786
+ }
58783
58787
  const risk = strategy.risk;
58784
58788
  const kind = strategy.kind;
58785
58789
  const support = strategy.support;
@@ -58788,7 +58792,6 @@ class ExchangeAccount {
58788
58792
  const long_position = positions.find((k) => k.kind === "long");
58789
58793
  const short_position = positions.find((k) => k.kind === "short");
58790
58794
  console.log("Getting focus position for ", symbol, kind);
58791
- const focus_position = kind === "long" ? long_position : short_position;
58792
58795
  const reverse_position = kind === "long" ? short_position : long_position;
58793
58796
  if (strategy.max_reward_factor === 0) {
58794
58797
  reward_factor = strategy.reward_factor;
package/dist/index.d.ts CHANGED
@@ -1728,8 +1728,16 @@ declare class ExchangeAccount$1 {
1728
1728
  };
1729
1729
  reverse_orders_to_buy: any;
1730
1730
  positions: {
1731
- long: PositionsView;
1732
- short: PositionsView;
1731
+ long: PositionsView & {
1732
+ expand?: {
1733
+ account_strategy?: AccountStrategy;
1734
+ };
1735
+ };
1736
+ short: PositionsView & {
1737
+ expand?: {
1738
+ account_strategy?: AccountStrategy;
1739
+ };
1740
+ };
1733
1741
  };
1734
1742
  orders_to_place: any;
1735
1743
  config_details: {
@@ -1942,8 +1950,16 @@ declare class App {
1942
1950
  };
1943
1951
  reverse_orders_to_buy: any;
1944
1952
  positions: {
1945
- long: PositionsView;
1946
- short: PositionsView;
1953
+ long: PositionsView & {
1954
+ expand?: {
1955
+ account_strategy?: AccountStrategy;
1956
+ };
1957
+ };
1958
+ short: PositionsView & {
1959
+ expand?: {
1960
+ account_strategy?: AccountStrategy;
1961
+ };
1962
+ };
1947
1963
  };
1948
1964
  orders_to_place: any;
1949
1965
  config_details: {
package/dist/index.js CHANGED
@@ -51558,7 +51558,7 @@ class AppDatabase {
51558
51558
  table: "positions_view",
51559
51559
  params: {
51560
51560
  filter: `symbol:lower="${symbol.toLowerCase()}" && account:lower="${account.owner.toLowerCase()} ${account.exchange.toLowerCase()}"`,
51561
- expand: "config"
51561
+ expand: "config, account_strategy, p_account"
51562
51562
  }
51563
51563
  } : {
51564
51564
  table: "positions",
@@ -58726,15 +58726,19 @@ class ExchangeAccount {
58726
58726
  async profitWithinGapStrategy(payload) {
58727
58727
  const { symbol } = payload;
58728
58728
  let reward_factor = 1;
58729
- const strategy = await this.getAccountStrategy({ symbol });
58730
- if (!strategy) {
58731
- return;
58732
- }
58733
58729
  console.log("Fetching positions for ", symbol);
58734
58730
  const positions = await this.syncAccount({
58735
58731
  symbol,
58736
58732
  as_view: true
58737
58733
  });
58734
+ const focus_position = positions.find((k) => k.expand?.account_strategy);
58735
+ if (!focus_position) {
58736
+ return;
58737
+ }
58738
+ const strategy = focus_position?.expand?.account_strategy;
58739
+ if (!strategy) {
58740
+ return;
58741
+ }
58738
58742
  const risk = strategy.risk;
58739
58743
  const kind = strategy.kind;
58740
58744
  const support = strategy.support;
@@ -58743,7 +58747,6 @@ class ExchangeAccount {
58743
58747
  const long_position = positions.find((k) => k.kind === "long");
58744
58748
  const short_position = positions.find((k) => k.kind === "short");
58745
58749
  console.log("Getting focus position for ", symbol, kind);
58746
- const focus_position = kind === "long" ? long_position : short_position;
58747
58750
  const reverse_position = kind === "long" ? short_position : long_position;
58748
58751
  if (strategy.max_reward_factor === 0) {
58749
58752
  reward_factor = strategy.reward_factor;
@@ -58314,7 +58314,7 @@ class AppDatabase {
58314
58314
  table: "positions_view",
58315
58315
  params: {
58316
58316
  filter: `symbol:lower="${symbol.toLowerCase()}" && account:lower="${account.owner.toLowerCase()} ${account.exchange.toLowerCase()}"`,
58317
- expand: "config"
58317
+ expand: "config, account_strategy, p_account"
58318
58318
  }
58319
58319
  } : {
58320
58320
  table: "positions",
@@ -65462,15 +65462,19 @@ class ExchangeAccount {
65462
65462
  async profitWithinGapStrategy(payload) {
65463
65463
  const { symbol } = payload;
65464
65464
  let reward_factor = 1;
65465
- const strategy = await this.getAccountStrategy({ symbol });
65466
- if (!strategy) {
65467
- return;
65468
- }
65469
65465
  console.log("Fetching positions for ", symbol);
65470
65466
  const positions = await this.syncAccount({
65471
65467
  symbol,
65472
65468
  as_view: true
65473
65469
  });
65470
+ const focus_position = positions.find((k) => k.expand?.account_strategy);
65471
+ if (!focus_position) {
65472
+ return;
65473
+ }
65474
+ const strategy = focus_position?.expand?.account_strategy;
65475
+ if (!strategy) {
65476
+ return;
65477
+ }
65474
65478
  const risk = strategy.risk;
65475
65479
  const kind = strategy.kind;
65476
65480
  const support = strategy.support;
@@ -65479,7 +65483,6 @@ class ExchangeAccount {
65479
65483
  const long_position = positions.find((k) => k.kind === "long");
65480
65484
  const short_position = positions.find((k) => k.kind === "short");
65481
65485
  console.log("Getting focus position for ", symbol, kind);
65482
- const focus_position = kind === "long" ? long_position : short_position;
65483
65486
  const reverse_position = kind === "long" ? short_position : long_position;
65484
65487
  if (strategy.max_reward_factor === 0) {
65485
65488
  reward_factor = strategy.reward_factor;
@@ -58291,7 +58291,7 @@ class AppDatabase {
58291
58291
  table: "positions_view",
58292
58292
  params: {
58293
58293
  filter: `symbol:lower="${symbol.toLowerCase()}" && account:lower="${account.owner.toLowerCase()} ${account.exchange.toLowerCase()}"`,
58294
- expand: "config"
58294
+ expand: "config, account_strategy, p_account"
58295
58295
  }
58296
58296
  } : {
58297
58297
  table: "positions",
@@ -65439,15 +65439,19 @@ class ExchangeAccount {
65439
65439
  async profitWithinGapStrategy(payload) {
65440
65440
  const { symbol } = payload;
65441
65441
  let reward_factor = 1;
65442
- const strategy = await this.getAccountStrategy({ symbol });
65443
- if (!strategy) {
65444
- return;
65445
- }
65446
65442
  console.log("Fetching positions for ", symbol);
65447
65443
  const positions = await this.syncAccount({
65448
65444
  symbol,
65449
65445
  as_view: true
65450
65446
  });
65447
+ const focus_position = positions.find((k) => k.expand?.account_strategy);
65448
+ if (!focus_position) {
65449
+ return;
65450
+ }
65451
+ const strategy = focus_position?.expand?.account_strategy;
65452
+ if (!strategy) {
65453
+ return;
65454
+ }
65451
65455
  const risk = strategy.risk;
65452
65456
  const kind = strategy.kind;
65453
65457
  const support = strategy.support;
@@ -65456,7 +65460,6 @@ class ExchangeAccount {
65456
65460
  const long_position = positions.find((k) => k.kind === "long");
65457
65461
  const short_position = positions.find((k) => k.kind === "short");
65458
65462
  console.log("Getting focus position for ", symbol, kind);
65459
- const focus_position = kind === "long" ? long_position : short_position;
65460
65463
  const reverse_position = kind === "long" ? short_position : long_position;
65461
65464
  if (strategy.max_reward_factor === 0) {
65462
65465
  reward_factor = strategy.reward_factor;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-93",
4
+ "version": "0.0.2-94",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",