@gbozee/ultimate 0.0.2-151 → 0.0.2-152

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
@@ -58578,6 +58578,25 @@ class ExchangePosition {
58578
58578
  });
58579
58579
  return app_config;
58580
58580
  }
58581
+ async getOrCreatePositionConfig(payload) {
58582
+ const { risk = 50, risk_reward = 199 } = payload;
58583
+ const config2 = await this.getConfig();
58584
+ if (!config2) {
58585
+ const long_c = await this.buildConfigForSymbol({
58586
+ risk,
58587
+ risk_reward
58588
+ });
58589
+ return this.getConfig({
58590
+ params: {
58591
+ entry: config2.entry,
58592
+ stop: config2.stop,
58593
+ risk_reward: long_c.risk_reward,
58594
+ risk: long_c.risk
58595
+ }
58596
+ });
58597
+ }
58598
+ return config2;
58599
+ }
58581
58600
  }
58582
58601
 
58583
58602
  // src/exchange-account.ts
@@ -58897,29 +58916,8 @@ class ExchangeAccount {
58897
58916
  return result;
58898
58917
  }
58899
58918
  async getOrCreatePositionConfig(payload) {
58900
- const { symbol, kind, risk = 50, risk_reward = 199 } = payload;
58901
- const config2 = await this.getPositionConfig({
58902
- symbol: payload.symbol,
58903
- kind: payload.kind
58904
- });
58905
- if (!config2) {
58906
- const long_c = await this.buildConfigForSymbol({
58907
- symbol,
58908
- risk,
58909
- risk_reward
58910
- });
58911
- return this.getPositionConfig({
58912
- symbol,
58913
- kind,
58914
- params: {
58915
- entry: kind === "long" ? long_c.entry : long_c.stop,
58916
- stop: kind === "long" ? long_c.stop : long_c.entry,
58917
- risk_reward: long_c.risk_reward,
58918
- risk: long_c.risk
58919
- }
58920
- });
58921
- }
58922
- return config2;
58919
+ const focus_position = await this.getFocusPosition(payload);
58920
+ return await focus_position.getOrCreatePositionConfig(payload);
58923
58921
  }
58924
58922
  async getPositionConfig(payload) {
58925
58923
  const focus_position = await this.getFocusPosition(payload);
@@ -59653,15 +59651,9 @@ class ExchangeAccount {
59653
59651
  const all_open_symbols = await this.exchange.getOpenPositions();
59654
59652
  await new Promise((resolve) => setTimeout(resolve, interval * 1000));
59655
59653
  for (const symbol of Array.from(new Set(symbols.concat(all_open_symbols)))) {
59656
- await this.getLiveExchangeInstance({ symbol, refresh: true });
59654
+ await this.initializePositions({ symbol, kind: "long", update: true });
59657
59655
  await new Promise((resolve) => setTimeout(resolve, 1000));
59658
59656
  }
59659
- for (const symbol of all_open_symbols) {
59660
- await this.syncAccount({
59661
- symbol,
59662
- update: true
59663
- });
59664
- }
59665
59657
  }
59666
59658
  async updateAllPositionsWithNoConfig(payload) {
59667
59659
  const { kind } = payload;
package/dist/index.d.ts CHANGED
@@ -1939,6 +1939,10 @@ declare class ExchangePosition {
1939
1939
  tradeConfig(payload: {
1940
1940
  override?: any;
1941
1941
  }): Promise<AppConfig>;
1942
+ getOrCreatePositionConfig(payload: {
1943
+ risk?: number;
1944
+ risk_reward?: number;
1945
+ }): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
1942
1946
  }
1943
1947
  declare class ExchangeAccount$1 {
1944
1948
  instance: {
package/dist/index.js CHANGED
@@ -58526,6 +58526,25 @@ class ExchangePosition {
58526
58526
  });
58527
58527
  return app_config;
58528
58528
  }
58529
+ async getOrCreatePositionConfig(payload) {
58530
+ const { risk = 50, risk_reward = 199 } = payload;
58531
+ const config2 = await this.getConfig();
58532
+ if (!config2) {
58533
+ const long_c = await this.buildConfigForSymbol({
58534
+ risk,
58535
+ risk_reward
58536
+ });
58537
+ return this.getConfig({
58538
+ params: {
58539
+ entry: config2.entry,
58540
+ stop: config2.stop,
58541
+ risk_reward: long_c.risk_reward,
58542
+ risk: long_c.risk
58543
+ }
58544
+ });
58545
+ }
58546
+ return config2;
58547
+ }
58529
58548
  }
58530
58549
 
58531
58550
  // src/exchange-account.ts
@@ -58845,29 +58864,8 @@ class ExchangeAccount {
58845
58864
  return result;
58846
58865
  }
58847
58866
  async getOrCreatePositionConfig(payload) {
58848
- const { symbol, kind, risk = 50, risk_reward = 199 } = payload;
58849
- const config2 = await this.getPositionConfig({
58850
- symbol: payload.symbol,
58851
- kind: payload.kind
58852
- });
58853
- if (!config2) {
58854
- const long_c = await this.buildConfigForSymbol({
58855
- symbol,
58856
- risk,
58857
- risk_reward
58858
- });
58859
- return this.getPositionConfig({
58860
- symbol,
58861
- kind,
58862
- params: {
58863
- entry: kind === "long" ? long_c.entry : long_c.stop,
58864
- stop: kind === "long" ? long_c.stop : long_c.entry,
58865
- risk_reward: long_c.risk_reward,
58866
- risk: long_c.risk
58867
- }
58868
- });
58869
- }
58870
- return config2;
58867
+ const focus_position = await this.getFocusPosition(payload);
58868
+ return await focus_position.getOrCreatePositionConfig(payload);
58871
58869
  }
58872
58870
  async getPositionConfig(payload) {
58873
58871
  const focus_position = await this.getFocusPosition(payload);
@@ -59601,15 +59599,9 @@ class ExchangeAccount {
59601
59599
  const all_open_symbols = await this.exchange.getOpenPositions();
59602
59600
  await new Promise((resolve) => setTimeout(resolve, interval * 1000));
59603
59601
  for (const symbol of Array.from(new Set(symbols.concat(all_open_symbols)))) {
59604
- await this.getLiveExchangeInstance({ symbol, refresh: true });
59602
+ await this.initializePositions({ symbol, kind: "long", update: true });
59605
59603
  await new Promise((resolve) => setTimeout(resolve, 1000));
59606
59604
  }
59607
- for (const symbol of all_open_symbols) {
59608
- await this.syncAccount({
59609
- symbol,
59610
- update: true
59611
- });
59612
- }
59613
59605
  }
59614
59606
  async updateAllPositionsWithNoConfig(payload) {
59615
59607
  const { kind } = payload;
@@ -65254,6 +65254,25 @@ class ExchangePosition {
65254
65254
  });
65255
65255
  return app_config;
65256
65256
  }
65257
+ async getOrCreatePositionConfig(payload) {
65258
+ const { risk = 50, risk_reward = 199 } = payload;
65259
+ const config2 = await this.getConfig();
65260
+ if (!config2) {
65261
+ const long_c = await this.buildConfigForSymbol({
65262
+ risk,
65263
+ risk_reward
65264
+ });
65265
+ return this.getConfig({
65266
+ params: {
65267
+ entry: config2.entry,
65268
+ stop: config2.stop,
65269
+ risk_reward: long_c.risk_reward,
65270
+ risk: long_c.risk
65271
+ }
65272
+ });
65273
+ }
65274
+ return config2;
65275
+ }
65257
65276
  }
65258
65277
 
65259
65278
  // src/exchange-account.ts
@@ -65573,29 +65592,8 @@ class ExchangeAccount {
65573
65592
  return result;
65574
65593
  }
65575
65594
  async getOrCreatePositionConfig(payload) {
65576
- const { symbol, kind, risk = 50, risk_reward = 199 } = payload;
65577
- const config2 = await this.getPositionConfig({
65578
- symbol: payload.symbol,
65579
- kind: payload.kind
65580
- });
65581
- if (!config2) {
65582
- const long_c = await this.buildConfigForSymbol({
65583
- symbol,
65584
- risk,
65585
- risk_reward
65586
- });
65587
- return this.getPositionConfig({
65588
- symbol,
65589
- kind,
65590
- params: {
65591
- entry: kind === "long" ? long_c.entry : long_c.stop,
65592
- stop: kind === "long" ? long_c.stop : long_c.entry,
65593
- risk_reward: long_c.risk_reward,
65594
- risk: long_c.risk
65595
- }
65596
- });
65597
- }
65598
- return config2;
65595
+ const focus_position = await this.getFocusPosition(payload);
65596
+ return await focus_position.getOrCreatePositionConfig(payload);
65599
65597
  }
65600
65598
  async getPositionConfig(payload) {
65601
65599
  const focus_position = await this.getFocusPosition(payload);
@@ -66329,15 +66327,9 @@ class ExchangeAccount {
66329
66327
  const all_open_symbols = await this.exchange.getOpenPositions();
66330
66328
  await new Promise((resolve) => setTimeout(resolve, interval * 1000));
66331
66329
  for (const symbol of Array.from(new Set(symbols.concat(all_open_symbols)))) {
66332
- await this.getLiveExchangeInstance({ symbol, refresh: true });
66330
+ await this.initializePositions({ symbol, kind: "long", update: true });
66333
66331
  await new Promise((resolve) => setTimeout(resolve, 1000));
66334
66332
  }
66335
- for (const symbol of all_open_symbols) {
66336
- await this.syncAccount({
66337
- symbol,
66338
- update: true
66339
- });
66340
- }
66341
66333
  }
66342
66334
  async updateAllPositionsWithNoConfig(payload) {
66343
66335
  const { kind } = payload;
@@ -65231,6 +65231,25 @@ class ExchangePosition {
65231
65231
  });
65232
65232
  return app_config;
65233
65233
  }
65234
+ async getOrCreatePositionConfig(payload) {
65235
+ const { risk = 50, risk_reward = 199 } = payload;
65236
+ const config2 = await this.getConfig();
65237
+ if (!config2) {
65238
+ const long_c = await this.buildConfigForSymbol({
65239
+ risk,
65240
+ risk_reward
65241
+ });
65242
+ return this.getConfig({
65243
+ params: {
65244
+ entry: config2.entry,
65245
+ stop: config2.stop,
65246
+ risk_reward: long_c.risk_reward,
65247
+ risk: long_c.risk
65248
+ }
65249
+ });
65250
+ }
65251
+ return config2;
65252
+ }
65234
65253
  }
65235
65254
 
65236
65255
  // src/exchange-account.ts
@@ -65550,29 +65569,8 @@ class ExchangeAccount {
65550
65569
  return result;
65551
65570
  }
65552
65571
  async getOrCreatePositionConfig(payload) {
65553
- const { symbol, kind, risk = 50, risk_reward = 199 } = payload;
65554
- const config2 = await this.getPositionConfig({
65555
- symbol: payload.symbol,
65556
- kind: payload.kind
65557
- });
65558
- if (!config2) {
65559
- const long_c = await this.buildConfigForSymbol({
65560
- symbol,
65561
- risk,
65562
- risk_reward
65563
- });
65564
- return this.getPositionConfig({
65565
- symbol,
65566
- kind,
65567
- params: {
65568
- entry: kind === "long" ? long_c.entry : long_c.stop,
65569
- stop: kind === "long" ? long_c.stop : long_c.entry,
65570
- risk_reward: long_c.risk_reward,
65571
- risk: long_c.risk
65572
- }
65573
- });
65574
- }
65575
- return config2;
65572
+ const focus_position = await this.getFocusPosition(payload);
65573
+ return await focus_position.getOrCreatePositionConfig(payload);
65576
65574
  }
65577
65575
  async getPositionConfig(payload) {
65578
65576
  const focus_position = await this.getFocusPosition(payload);
@@ -66306,15 +66304,9 @@ class ExchangeAccount {
66306
66304
  const all_open_symbols = await this.exchange.getOpenPositions();
66307
66305
  await new Promise((resolve) => setTimeout(resolve, interval * 1000));
66308
66306
  for (const symbol of Array.from(new Set(symbols.concat(all_open_symbols)))) {
66309
- await this.getLiveExchangeInstance({ symbol, refresh: true });
66307
+ await this.initializePositions({ symbol, kind: "long", update: true });
66310
66308
  await new Promise((resolve) => setTimeout(resolve, 1000));
66311
66309
  }
66312
- for (const symbol of all_open_symbols) {
66313
- await this.syncAccount({
66314
- symbol,
66315
- update: true
66316
- });
66317
- }
66318
66310
  }
66319
66311
  async updateAllPositionsWithNoConfig(payload) {
66320
66312
  const { kind } = payload;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-151",
4
+ "version": "0.0.2-152",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",