@gbozee/ultimate 0.0.2-197 → 0.0.2-199

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
@@ -59331,7 +59331,9 @@ async function cancelAllOrders(client, symbol, payload) {
59331
59331
  console.log("cancelling", ordersToCancel);
59332
59332
  await cancelOrders({
59333
59333
  symbol,
59334
- orders: ordersToCancel.map((x) => ({ orderId: x.orderId })),
59334
+ orders: ordersToCancel.map((x) => ({
59335
+ clientOrderId: x.clientOrderId
59336
+ })),
59335
59337
  custom_client: client
59336
59338
  });
59337
59339
  }
@@ -61582,7 +61584,14 @@ class ExchangePosition {
61582
61584
  }
61583
61585
  }
61584
61586
  async triggerTradeFromConfig(payload) {
61585
- const { place = true, stop, use_current, ignore_config, risky } = payload;
61587
+ const {
61588
+ place = true,
61589
+ stop,
61590
+ use_current,
61591
+ ignore_config,
61592
+ risky,
61593
+ stop_ratio
61594
+ } = payload;
61586
61595
  const position2 = this.instance;
61587
61596
  const config2 = await this.getConfig();
61588
61597
  let condition = ignore_config ? true : position2?.config;
@@ -61599,12 +61608,13 @@ class ExchangePosition {
61599
61608
  use_current,
61600
61609
  stop_percent: config2.stop_percent || 100,
61601
61610
  distribution: config2.distribution,
61602
- hedge: payload.hedge
61611
+ hedge: payload.hedge,
61612
+ stop_ratio
61603
61613
  });
61604
61614
  }
61605
61615
  }
61606
61616
  async placeSharedOrder(action, payload) {
61607
- const { stop_percent = 100 } = payload;
61617
+ const { stop_percent = 100, stop_ratio = 1 } = payload;
61608
61618
  const config2 = await this.getConfig();
61609
61619
  const app_config = await this.buildAppConfig({
61610
61620
  entry: payload.entry,
@@ -61691,7 +61701,7 @@ class ExchangePosition {
61691
61701
  const instance = this.instance;
61692
61702
  let result = await this.exchange.placeStopOrders({
61693
61703
  symbol: this.symbol,
61694
- quantity: payload.use_current ? instance.quantity : trades[0].avg_size,
61704
+ quantity: (payload.use_current ? instance.quantity : trades[0].avg_size) * stop_ratio,
61695
61705
  kind: app_config.kind,
61696
61706
  stop: payload.stop,
61697
61707
  price_places: app_config.price_places,
@@ -61878,7 +61888,8 @@ class ExchangePosition {
61878
61888
  risky,
61879
61889
  limit = true,
61880
61890
  target_pnl,
61881
- hedge
61891
+ hedge,
61892
+ stop_ratio
61882
61893
  } = payload;
61883
61894
  if (cancel) {
61884
61895
  await this.cancelOrders({
@@ -61903,7 +61914,8 @@ class ExchangePosition {
61903
61914
  ignore_config,
61904
61915
  risky,
61905
61916
  place,
61906
- hedge
61917
+ hedge,
61918
+ stop_ratio
61907
61919
  });
61908
61920
  }
61909
61921
  await this.updateConfigPnl();
package/dist/index.d.ts CHANGED
@@ -1897,6 +1897,7 @@ export declare class ExchangePosition {
1897
1897
  ignore_config?: boolean;
1898
1898
  risky?: boolean;
1899
1899
  hedge?: boolean;
1900
+ stop_ratio?: number;
1900
1901
  }): Promise<any>;
1901
1902
  placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders" | "dangerous_entry_orders", payload: {
1902
1903
  entry: number;
@@ -1910,6 +1911,7 @@ export declare class ExchangePosition {
1910
1911
  stop_percent?: number;
1911
1912
  distribution?: GetEntriesParams["distribution"];
1912
1913
  hedge?: boolean;
1914
+ stop_ratio?: number;
1913
1915
  }): Promise<any>;
1914
1916
  buildAppConfig(payload: {
1915
1917
  entry: number;
@@ -1987,6 +1989,7 @@ export declare class ExchangePosition {
1987
1989
  risky?: boolean;
1988
1990
  target_pnl?: number;
1989
1991
  hedge?: boolean;
1992
+ stop_ratio?: number;
1990
1993
  }): Promise<any>;
1991
1994
  placeStopLimit(payload: {
1992
1995
  place?: boolean;
package/dist/index.js CHANGED
@@ -59268,7 +59268,9 @@ async function cancelAllOrders(client, symbol, payload) {
59268
59268
  console.log("cancelling", ordersToCancel);
59269
59269
  await cancelOrders({
59270
59270
  symbol,
59271
- orders: ordersToCancel.map((x) => ({ orderId: x.orderId })),
59271
+ orders: ordersToCancel.map((x) => ({
59272
+ clientOrderId: x.clientOrderId
59273
+ })),
59272
59274
  custom_client: client
59273
59275
  });
59274
59276
  }
@@ -61519,7 +61521,14 @@ class ExchangePosition {
61519
61521
  }
61520
61522
  }
61521
61523
  async triggerTradeFromConfig(payload) {
61522
- const { place = true, stop, use_current, ignore_config, risky } = payload;
61524
+ const {
61525
+ place = true,
61526
+ stop,
61527
+ use_current,
61528
+ ignore_config,
61529
+ risky,
61530
+ stop_ratio
61531
+ } = payload;
61523
61532
  const position2 = this.instance;
61524
61533
  const config2 = await this.getConfig();
61525
61534
  let condition = ignore_config ? true : position2?.config;
@@ -61536,12 +61545,13 @@ class ExchangePosition {
61536
61545
  use_current,
61537
61546
  stop_percent: config2.stop_percent || 100,
61538
61547
  distribution: config2.distribution,
61539
- hedge: payload.hedge
61548
+ hedge: payload.hedge,
61549
+ stop_ratio
61540
61550
  });
61541
61551
  }
61542
61552
  }
61543
61553
  async placeSharedOrder(action, payload) {
61544
- const { stop_percent = 100 } = payload;
61554
+ const { stop_percent = 100, stop_ratio = 1 } = payload;
61545
61555
  const config2 = await this.getConfig();
61546
61556
  const app_config = await this.buildAppConfig({
61547
61557
  entry: payload.entry,
@@ -61628,7 +61638,7 @@ class ExchangePosition {
61628
61638
  const instance = this.instance;
61629
61639
  let result = await this.exchange.placeStopOrders({
61630
61640
  symbol: this.symbol,
61631
- quantity: payload.use_current ? instance.quantity : trades[0].avg_size,
61641
+ quantity: (payload.use_current ? instance.quantity : trades[0].avg_size) * stop_ratio,
61632
61642
  kind: app_config.kind,
61633
61643
  stop: payload.stop,
61634
61644
  price_places: app_config.price_places,
@@ -61815,7 +61825,8 @@ class ExchangePosition {
61815
61825
  risky,
61816
61826
  limit = true,
61817
61827
  target_pnl,
61818
- hedge
61828
+ hedge,
61829
+ stop_ratio
61819
61830
  } = payload;
61820
61831
  if (cancel) {
61821
61832
  await this.cancelOrders({
@@ -61840,7 +61851,8 @@ class ExchangePosition {
61840
61851
  ignore_config,
61841
61852
  risky,
61842
61853
  place,
61843
- hedge
61854
+ hedge,
61855
+ stop_ratio
61844
61856
  });
61845
61857
  }
61846
61858
  await this.updateConfigPnl();
@@ -65904,7 +65904,9 @@ async function cancelAllOrders(client, symbol, payload) {
65904
65904
  console.log("cancelling", ordersToCancel);
65905
65905
  await cancelOrders({
65906
65906
  symbol,
65907
- orders: ordersToCancel.map((x) => ({ orderId: x.orderId })),
65907
+ orders: ordersToCancel.map((x) => ({
65908
+ clientOrderId: x.clientOrderId
65909
+ })),
65908
65910
  custom_client: client
65909
65911
  });
65910
65912
  }
@@ -68155,7 +68157,14 @@ class ExchangePosition {
68155
68157
  }
68156
68158
  }
68157
68159
  async triggerTradeFromConfig(payload) {
68158
- const { place = true, stop, use_current, ignore_config, risky } = payload;
68160
+ const {
68161
+ place = true,
68162
+ stop,
68163
+ use_current,
68164
+ ignore_config,
68165
+ risky,
68166
+ stop_ratio
68167
+ } = payload;
68159
68168
  const position2 = this.instance;
68160
68169
  const config2 = await this.getConfig();
68161
68170
  let condition = ignore_config ? true : position2?.config;
@@ -68172,12 +68181,13 @@ class ExchangePosition {
68172
68181
  use_current,
68173
68182
  stop_percent: config2.stop_percent || 100,
68174
68183
  distribution: config2.distribution,
68175
- hedge: payload.hedge
68184
+ hedge: payload.hedge,
68185
+ stop_ratio
68176
68186
  });
68177
68187
  }
68178
68188
  }
68179
68189
  async placeSharedOrder(action, payload) {
68180
- const { stop_percent = 100 } = payload;
68190
+ const { stop_percent = 100, stop_ratio = 1 } = payload;
68181
68191
  const config2 = await this.getConfig();
68182
68192
  const app_config = await this.buildAppConfig({
68183
68193
  entry: payload.entry,
@@ -68264,7 +68274,7 @@ class ExchangePosition {
68264
68274
  const instance = this.instance;
68265
68275
  let result = await this.exchange.placeStopOrders({
68266
68276
  symbol: this.symbol,
68267
- quantity: payload.use_current ? instance.quantity : trades[0].avg_size,
68277
+ quantity: (payload.use_current ? instance.quantity : trades[0].avg_size) * stop_ratio,
68268
68278
  kind: app_config.kind,
68269
68279
  stop: payload.stop,
68270
68280
  price_places: app_config.price_places,
@@ -68451,7 +68461,8 @@ class ExchangePosition {
68451
68461
  risky,
68452
68462
  limit = true,
68453
68463
  target_pnl,
68454
- hedge
68464
+ hedge,
68465
+ stop_ratio
68455
68466
  } = payload;
68456
68467
  if (cancel) {
68457
68468
  await this.cancelOrders({
@@ -68476,7 +68487,8 @@ class ExchangePosition {
68476
68487
  ignore_config,
68477
68488
  risky,
68478
68489
  place,
68479
- hedge
68490
+ hedge,
68491
+ stop_ratio
68480
68492
  });
68481
68493
  }
68482
68494
  await this.updateConfigPnl();
@@ -65877,7 +65877,9 @@ async function cancelAllOrders(client, symbol, payload) {
65877
65877
  console.log("cancelling", ordersToCancel);
65878
65878
  await cancelOrders({
65879
65879
  symbol,
65880
- orders: ordersToCancel.map((x) => ({ orderId: x.orderId })),
65880
+ orders: ordersToCancel.map((x) => ({
65881
+ clientOrderId: x.clientOrderId
65882
+ })),
65881
65883
  custom_client: client
65882
65884
  });
65883
65885
  }
@@ -68128,7 +68130,14 @@ class ExchangePosition {
68128
68130
  }
68129
68131
  }
68130
68132
  async triggerTradeFromConfig(payload) {
68131
- const { place = true, stop, use_current, ignore_config, risky } = payload;
68133
+ const {
68134
+ place = true,
68135
+ stop,
68136
+ use_current,
68137
+ ignore_config,
68138
+ risky,
68139
+ stop_ratio
68140
+ } = payload;
68132
68141
  const position2 = this.instance;
68133
68142
  const config2 = await this.getConfig();
68134
68143
  let condition = ignore_config ? true : position2?.config;
@@ -68145,12 +68154,13 @@ class ExchangePosition {
68145
68154
  use_current,
68146
68155
  stop_percent: config2.stop_percent || 100,
68147
68156
  distribution: config2.distribution,
68148
- hedge: payload.hedge
68157
+ hedge: payload.hedge,
68158
+ stop_ratio
68149
68159
  });
68150
68160
  }
68151
68161
  }
68152
68162
  async placeSharedOrder(action, payload) {
68153
- const { stop_percent = 100 } = payload;
68163
+ const { stop_percent = 100, stop_ratio = 1 } = payload;
68154
68164
  const config2 = await this.getConfig();
68155
68165
  const app_config = await this.buildAppConfig({
68156
68166
  entry: payload.entry,
@@ -68237,7 +68247,7 @@ class ExchangePosition {
68237
68247
  const instance = this.instance;
68238
68248
  let result = await this.exchange.placeStopOrders({
68239
68249
  symbol: this.symbol,
68240
- quantity: payload.use_current ? instance.quantity : trades[0].avg_size,
68250
+ quantity: (payload.use_current ? instance.quantity : trades[0].avg_size) * stop_ratio,
68241
68251
  kind: app_config.kind,
68242
68252
  stop: payload.stop,
68243
68253
  price_places: app_config.price_places,
@@ -68424,7 +68434,8 @@ class ExchangePosition {
68424
68434
  risky,
68425
68435
  limit = true,
68426
68436
  target_pnl,
68427
- hedge
68437
+ hedge,
68438
+ stop_ratio
68428
68439
  } = payload;
68429
68440
  if (cancel) {
68430
68441
  await this.cancelOrders({
@@ -68449,7 +68460,8 @@ class ExchangePosition {
68449
68460
  ignore_config,
68450
68461
  risky,
68451
68462
  place,
68452
- hedge
68463
+ hedge,
68464
+ stop_ratio
68453
68465
  });
68454
68466
  }
68455
68467
  await this.updateConfigPnl();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-197",
4
+ "version": "0.0.2-199",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",