@gbozee/ultimate 0.0.2-87 → 0.0.2-89

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
@@ -51944,7 +51944,7 @@ class AppDatabase {
51944
51944
  profit: payload.profit !== undefined ? payload.profit : config2.profit
51945
51945
  });
51946
51946
  await this.update_db_position(db_position, {
51947
- config: config2.id
51947
+ config: null
51948
51948
  });
51949
51949
  for (const _config of configs) {
51950
51950
  if (_config.id !== config2.id) {
@@ -51966,7 +51966,7 @@ class AppDatabase {
51966
51966
  });
51967
51967
  }
51968
51968
  await this.pb.collection("positions").update(db_position.id, {
51969
- config: config2?.id
51969
+ config: null
51970
51970
  });
51971
51971
  return config2;
51972
51972
  }
@@ -58820,6 +58820,15 @@ class ExchangeAccount {
58820
58820
  let reverse_action = null;
58821
58821
  let reverse_orders_to_buy = [];
58822
58822
  let reverse_config = null;
58823
+ if (focus_position.avg_qty < last_value.avg_size) {
58824
+ console.log("Placing trade for ", symbol, kind);
58825
+ await this.placeTrade({
58826
+ symbol,
58827
+ kind,
58828
+ ignore_config: true,
58829
+ place: true
58830
+ });
58831
+ }
58823
58832
  console.log("Checking if focus position has quantity for ", symbol, kind);
58824
58833
  if (focus_position.quantity > 0) {
58825
58834
  console.log("Getting details for ", reverse_position.kind);
@@ -59184,8 +59193,7 @@ class App {
59184
59193
  symbol,
59185
59194
  kind: "long",
59186
59195
  tp: true,
59187
- limit: false,
59188
- place: true
59196
+ limit: false
59189
59197
  });
59190
59198
  await new Promise((resolve) => setTimeout(resolve, 500));
59191
59199
  }
@@ -59232,17 +59240,18 @@ class App {
59232
59240
  });
59233
59241
  return result;
59234
59242
  }
59235
- async runDbStrategyAccounts() {
59243
+ async runDbStrategyAccounts(callback) {
59236
59244
  const strategies = await this.app_db.getRunningAccountStrategies();
59237
59245
  for (const strategy of strategies) {
59238
59246
  console.log("Running strategy for ", strategy.symbol, "for account", strategy.expand.account.owner, strategy.expand.account.exchange);
59239
- await this.profitWithinGapStrategy({
59247
+ await callback({
59240
59248
  symbol: strategy.symbol,
59241
59249
  kind: strategy.kind,
59242
59250
  risk: strategy.risk,
59243
59251
  resistance: strategy.resistance,
59244
59252
  support: strategy.support,
59245
- account: strategy.expand.account
59253
+ account: strategy.expand.account,
59254
+ reward_factor: strategy.reward_factor
59246
59255
  });
59247
59256
  }
59248
59257
  }
package/dist/index.d.ts CHANGED
@@ -1888,7 +1888,13 @@ declare class App {
1888
1888
  cancel?: boolean;
1889
1889
  raw?: boolean;
1890
1890
  }): Promise<any>;
1891
- runDbStrategyAccounts(): Promise<void>;
1891
+ runDbStrategyAccounts(callback: (params: {
1892
+ symbol: string;
1893
+ account: ExchangeType;
1894
+ risk: number;
1895
+ resistance: number;
1896
+ support: number;
1897
+ }) => Promise<any>): Promise<void>;
1892
1898
  profitWithinGapStrategy(payload: {
1893
1899
  account: ExchangeType;
1894
1900
  symbol: string;
package/dist/index.js CHANGED
@@ -51899,7 +51899,7 @@ class AppDatabase {
51899
51899
  profit: payload.profit !== undefined ? payload.profit : config2.profit
51900
51900
  });
51901
51901
  await this.update_db_position(db_position, {
51902
- config: config2.id
51902
+ config: null
51903
51903
  });
51904
51904
  for (const _config of configs) {
51905
51905
  if (_config.id !== config2.id) {
@@ -51921,7 +51921,7 @@ class AppDatabase {
51921
51921
  });
51922
51922
  }
51923
51923
  await this.pb.collection("positions").update(db_position.id, {
51924
- config: config2?.id
51924
+ config: null
51925
51925
  });
51926
51926
  return config2;
51927
51927
  }
@@ -58775,6 +58775,15 @@ class ExchangeAccount {
58775
58775
  let reverse_action = null;
58776
58776
  let reverse_orders_to_buy = [];
58777
58777
  let reverse_config = null;
58778
+ if (focus_position.avg_qty < last_value.avg_size) {
58779
+ console.log("Placing trade for ", symbol, kind);
58780
+ await this.placeTrade({
58781
+ symbol,
58782
+ kind,
58783
+ ignore_config: true,
58784
+ place: true
58785
+ });
58786
+ }
58778
58787
  console.log("Checking if focus position has quantity for ", symbol, kind);
58779
58788
  if (focus_position.quantity > 0) {
58780
58789
  console.log("Getting details for ", reverse_position.kind);
@@ -59139,8 +59148,7 @@ class App {
59139
59148
  symbol,
59140
59149
  kind: "long",
59141
59150
  tp: true,
59142
- limit: false,
59143
- place: true
59151
+ limit: false
59144
59152
  });
59145
59153
  await new Promise((resolve) => setTimeout(resolve, 500));
59146
59154
  }
@@ -59187,17 +59195,18 @@ class App {
59187
59195
  });
59188
59196
  return result;
59189
59197
  }
59190
- async runDbStrategyAccounts() {
59198
+ async runDbStrategyAccounts(callback) {
59191
59199
  const strategies = await this.app_db.getRunningAccountStrategies();
59192
59200
  for (const strategy of strategies) {
59193
59201
  console.log("Running strategy for ", strategy.symbol, "for account", strategy.expand.account.owner, strategy.expand.account.exchange);
59194
- await this.profitWithinGapStrategy({
59202
+ await callback({
59195
59203
  symbol: strategy.symbol,
59196
59204
  kind: strategy.kind,
59197
59205
  risk: strategy.risk,
59198
59206
  resistance: strategy.resistance,
59199
59207
  support: strategy.support,
59200
- account: strategy.expand.account
59208
+ account: strategy.expand.account,
59209
+ reward_factor: strategy.reward_factor
59201
59210
  });
59202
59211
  }
59203
59212
  }
@@ -58655,7 +58655,7 @@ class AppDatabase {
58655
58655
  profit: payload.profit !== undefined ? payload.profit : config2.profit
58656
58656
  });
58657
58657
  await this.update_db_position(db_position, {
58658
- config: config2.id
58658
+ config: null
58659
58659
  });
58660
58660
  for (const _config of configs) {
58661
58661
  if (_config.id !== config2.id) {
@@ -58677,7 +58677,7 @@ class AppDatabase {
58677
58677
  });
58678
58678
  }
58679
58679
  await this.pb.collection("positions").update(db_position.id, {
58680
- config: config2?.id
58680
+ config: null
58681
58681
  });
58682
58682
  return config2;
58683
58683
  }
@@ -65511,6 +65511,15 @@ class ExchangeAccount {
65511
65511
  let reverse_action = null;
65512
65512
  let reverse_orders_to_buy = [];
65513
65513
  let reverse_config = null;
65514
+ if (focus_position.avg_qty < last_value.avg_size) {
65515
+ console.log("Placing trade for ", symbol, kind);
65516
+ await this.placeTrade({
65517
+ symbol,
65518
+ kind,
65519
+ ignore_config: true,
65520
+ place: true
65521
+ });
65522
+ }
65514
65523
  console.log("Checking if focus position has quantity for ", symbol, kind);
65515
65524
  if (focus_position.quantity > 0) {
65516
65525
  console.log("Getting details for ", reverse_position.kind);
@@ -65922,17 +65931,18 @@ class App {
65922
65931
  });
65923
65932
  return result;
65924
65933
  }
65925
- async runDbStrategyAccounts() {
65934
+ async runDbStrategyAccounts(callback) {
65926
65935
  const strategies = await this.app_db.getRunningAccountStrategies();
65927
65936
  for (const strategy of strategies) {
65928
65937
  console.log("Running strategy for ", strategy.symbol, "for account", strategy.expand.account.owner, strategy.expand.account.exchange);
65929
- await this.profitWithinGapStrategy({
65938
+ await callback({
65930
65939
  symbol: strategy.symbol,
65931
65940
  kind: strategy.kind,
65932
65941
  risk: strategy.risk,
65933
65942
  resistance: strategy.resistance,
65934
65943
  support: strategy.support,
65935
- account: strategy.expand.account
65944
+ account: strategy.expand.account,
65945
+ reward_factor: strategy.reward_factor
65936
65946
  });
65937
65947
  }
65938
65948
  }
@@ -58632,7 +58632,7 @@ class AppDatabase {
58632
58632
  profit: payload.profit !== undefined ? payload.profit : config2.profit
58633
58633
  });
58634
58634
  await this.update_db_position(db_position, {
58635
- config: config2.id
58635
+ config: null
58636
58636
  });
58637
58637
  for (const _config of configs) {
58638
58638
  if (_config.id !== config2.id) {
@@ -58654,7 +58654,7 @@ class AppDatabase {
58654
58654
  });
58655
58655
  }
58656
58656
  await this.pb.collection("positions").update(db_position.id, {
58657
- config: config2?.id
58657
+ config: null
58658
58658
  });
58659
58659
  return config2;
58660
58660
  }
@@ -65488,6 +65488,15 @@ class ExchangeAccount {
65488
65488
  let reverse_action = null;
65489
65489
  let reverse_orders_to_buy = [];
65490
65490
  let reverse_config = null;
65491
+ if (focus_position.avg_qty < last_value.avg_size) {
65492
+ console.log("Placing trade for ", symbol, kind);
65493
+ await this.placeTrade({
65494
+ symbol,
65495
+ kind,
65496
+ ignore_config: true,
65497
+ place: true
65498
+ });
65499
+ }
65491
65500
  console.log("Checking if focus position has quantity for ", symbol, kind);
65492
65501
  if (focus_position.quantity > 0) {
65493
65502
  console.log("Getting details for ", reverse_position.kind);
@@ -65899,17 +65908,18 @@ class App {
65899
65908
  });
65900
65909
  return result;
65901
65910
  }
65902
- async runDbStrategyAccounts() {
65911
+ async runDbStrategyAccounts(callback) {
65903
65912
  const strategies = await this.app_db.getRunningAccountStrategies();
65904
65913
  for (const strategy of strategies) {
65905
65914
  console.log("Running strategy for ", strategy.symbol, "for account", strategy.expand.account.owner, strategy.expand.account.exchange);
65906
- await this.profitWithinGapStrategy({
65915
+ await callback({
65907
65916
  symbol: strategy.symbol,
65908
65917
  kind: strategy.kind,
65909
65918
  risk: strategy.risk,
65910
65919
  resistance: strategy.resistance,
65911
65920
  support: strategy.support,
65912
- account: strategy.expand.account
65921
+ account: strategy.expand.account,
65922
+ reward_factor: strategy.reward_factor
65913
65923
  });
65914
65924
  }
65915
65925
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-87",
4
+ "version": "0.0.2-89",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",