@gbozee/ultimate 0.0.2-53 → 0.0.2-55

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.d.ts CHANGED
@@ -63,6 +63,7 @@ export interface AccountStrategy extends BaseSystemFields {
63
63
  short_tp_factor: number;
64
64
  fee_percent: number;
65
65
  budget: number;
66
+ risk_reward: number;
66
67
  }
67
68
  interface Proxy$1 extends BaseSystemFields {
68
69
  ip_address?: string;
@@ -1469,6 +1470,7 @@ export type Config = {
1469
1470
  short_tp_factor: number;
1470
1471
  fee_percent?: number;
1471
1472
  budget: number;
1473
+ risk_reward: number;
1472
1474
  global_config: GlobalConfig;
1473
1475
  };
1474
1476
  export declare class Strategy {
@@ -1496,10 +1498,10 @@ export declare class Strategy {
1496
1498
  get short_tp(): number;
1497
1499
  generateGapClosingAlgorithm(payload: {
1498
1500
  kind: "long" | "short";
1499
- risk_reward?: number;
1500
1501
  }): {
1501
1502
  [x: string]: any;
1502
1503
  risk: number;
1504
+ risk_reward: number;
1503
1505
  last_entry: any;
1504
1506
  first_entry: any;
1505
1507
  threshold: any;
@@ -1511,6 +1513,7 @@ export declare class Strategy {
1511
1513
  }): {
1512
1514
  [x: string]: any;
1513
1515
  risk: number;
1516
+ risk_reward: number;
1514
1517
  last_entry: any;
1515
1518
  first_entry: any;
1516
1519
  threshold: any;
package/dist/index.js CHANGED
@@ -58162,15 +58162,20 @@ class Strategy {
58162
58162
  return this.tp("short");
58163
58163
  }
58164
58164
  generateGapClosingAlgorithm(payload) {
58165
- const { kind, risk_reward = 199 } = payload;
58165
+ const { kind } = payload;
58166
58166
  const { entry, quantity } = this.position[kind];
58167
58167
  const focus_position = this.position[kind];
58168
58168
  const reverse_kind = kind == "long" ? "short" : "long";
58169
58169
  const reverse_position = this.position[reverse_kind];
58170
+ let _entry = this.tp(kind);
58171
+ let _stop = this.tp(reverse_kind);
58172
+ if (!_entry && !_stop) {
58173
+ return null;
58174
+ }
58170
58175
  const second_payload = {
58171
- entry: this.tp(kind),
58172
- stop: this.tp(reverse_kind),
58173
- risk_reward,
58176
+ entry: _entry,
58177
+ stop: _stop,
58178
+ risk_reward: this.config.risk_reward,
58174
58179
  start_risk: this.pnl(reverse_kind),
58175
58180
  max_risk: this.config.budget
58176
58181
  };
@@ -58247,6 +58252,7 @@ class Strategy {
58247
58252
  const remaining_quantity = this.to_df(avg.quantity - quantity_to_sell);
58248
58253
  return {
58249
58254
  risk,
58255
+ risk_reward: this.config.risk_reward,
58250
58256
  [kind]: {
58251
58257
  avg_entry: avg.entry,
58252
58258
  avg_size: avg.quantity,
@@ -58271,7 +58277,7 @@ class Strategy {
58271
58277
  };
58272
58278
  }
58273
58279
  runIterations(payload) {
58274
- const { kind, iterations, risk_reward = 199 } = payload;
58280
+ const { kind, iterations } = payload;
58275
58281
  const reverse_kind = kind == "long" ? "short" : "long";
58276
58282
  const result = [];
58277
58283
  let position2 = {
@@ -58288,8 +58294,7 @@ class Strategy {
58288
58294
  }
58289
58295
  });
58290
58296
  const algorithm = instance.generateGapClosingAlgorithm({
58291
- kind,
58292
- risk_reward
58297
+ kind
58293
58298
  });
58294
58299
  if (!algorithm) {
58295
58300
  console.log("No algorithm found");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-53",
4
+ "version": "0.0.2-55",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",