@gbozee/ultimate 0.0.2-187 → 0.0.2-188

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
@@ -54936,7 +54936,8 @@ class AppDatabase {
54936
54936
  side: order.side,
54937
54937
  stop: order.stop || order.triggerPrice || 0,
54938
54938
  order_id: order.order_id.toString(),
54939
- account: account.id
54939
+ account: account.id,
54940
+ client_order_id: order.clientOrderId || ""
54940
54941
  };
54941
54942
  batch2.collection("orders").create(order_data);
54942
54943
  }
@@ -54959,7 +54960,7 @@ class AppDatabase {
54959
54960
  const existing_stop_orders = await this.pb.collection("orders").getFullList({
54960
54961
  filter: `symbol:lower="${symbol.toLowerCase()}" && account.owner:lower="${account.owner.toLowerCase()}" && account.exchange:lower="${account.exchange.toLowerCase()}" && kind="${kind}" && side:lower="${stop_side}" && stop > 0`
54961
54962
  });
54962
- const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : parseInt(o.order_id, 10));
54963
+ const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : symbol.startsWith("ETH") ? o.client_order_id : parseInt(o.order_id, 10));
54963
54964
  if (raw) {
54964
54965
  return exchange_order_ids;
54965
54966
  }
@@ -58696,6 +58697,7 @@ class Strategy {
58696
58697
  // src/types/index.ts
58697
58698
  class BaseExchange {
58698
58699
  client;
58700
+ name;
58699
58701
  getCredentials;
58700
58702
  proxyAgent;
58701
58703
  constructor(client) {
@@ -58799,7 +58801,13 @@ class BaseExchange {
58799
58801
  async cancelOrders(payload) {
58800
58802
  return await this._cancelOrders({
58801
58803
  symbol: payload.symbol,
58802
- orders: payload.orders.map((x) => ({ orderId: x }))
58804
+ orders: payload.orders.map((x) => {
58805
+ let key = "orderId";
58806
+ if (payload.symbol.startsWith("ETH") && this.name === "binance") {
58807
+ key = "clientOrderId";
58808
+ }
58809
+ return { [key]: x };
58810
+ })
58803
58811
  });
58804
58812
  }
58805
58813
  async placeTpOrder(payload) {
@@ -59841,6 +59849,7 @@ class BinanceExchange extends BaseExchange {
59841
59849
  main_client;
59842
59850
  constructor(client, main_client) {
59843
59851
  super(client);
59852
+ this.name = "binance";
59844
59853
  this.client = client;
59845
59854
  this.main_client = main_client;
59846
59855
  }
@@ -60124,10 +60133,14 @@ async function cancelOrdersParallel(payload) {
60124
60133
  const limit = import_p_limit.default(ORDERS_PER_SECOND);
60125
60134
  const results = await Promise.all(batches.map((batch2) => limit(async () => {
60126
60135
  try {
60127
- const result = await Promise.all(batch2.map((x) => client.cancelOrder({
60128
- symbol: payload.symbol,
60129
- orderId: x.orderId
60130
- })));
60136
+ const result = await Promise.all(batch2.map((x) => {
60137
+ let key = x.orderId ? "orderId" : "origClientOrderId";
60138
+ let value2 = x.orderId ? x.orderId : x.clientOrderId;
60139
+ return client.cancelOrder({
60140
+ symbol: payload.symbol,
60141
+ [key]: value2
60142
+ });
60143
+ }));
60131
60144
  console.log("Cancel batch result:", result);
60132
60145
  return result;
60133
60146
  } catch (error) {
@@ -60663,6 +60676,7 @@ class BybitExchange extends BaseExchange {
60663
60676
  main_client;
60664
60677
  constructor(client, main_client) {
60665
60678
  super(client);
60679
+ this.name = "bybit";
60666
60680
  this.client = client;
60667
60681
  this.main_client = main_client;
60668
60682
  }
@@ -62186,7 +62200,7 @@ class ExchangePosition {
62186
62200
  const orders = this.getOrders({ type });
62187
62201
  const result = await this.exchange.cancelOrders({
62188
62202
  symbol: this.symbol,
62189
- orders: orders.map((x) => x.order_id)
62203
+ orders: orders.map((x) => this.symbol.startsWith("ETH") ? x.client_order_id : x.order_id)
62190
62204
  });
62191
62205
  if (refresh) {
62192
62206
  await this.refresh(true);
@@ -62284,7 +62298,8 @@ function convert_to_exchange_order(order) {
62284
62298
  side: order.side,
62285
62299
  stop: order.stop,
62286
62300
  order_id: order.order_id,
62287
- triggerPrice: order.triggerPrice
62301
+ triggerPrice: order.triggerPrice,
62302
+ client_order_id: order.clientOrderId
62288
62303
  };
62289
62304
  }
62290
62305
 
package/dist/index.d.ts CHANGED
@@ -372,6 +372,7 @@ export interface CandlestickAnalysisResult {
372
372
  }
373
373
  declare abstract class BaseExchange {
374
374
  client: any;
375
+ name: string;
375
376
  getCredentials: (payload: {
376
377
  account: string;
377
378
  }) => Promise<{
@@ -446,7 +447,8 @@ declare abstract class BaseExchange {
446
447
  protected abstract _cancelOrders(payload: {
447
448
  symbol: string;
448
449
  orders: Array<{
449
- orderId: number;
450
+ orderId?: any;
451
+ clientOrderId?: any;
450
452
  }>;
451
453
  }): Promise<any>;
452
454
  cancelOrders(payload: {
@@ -740,6 +742,7 @@ export declare class AppDatabase {
740
742
  stop: number;
741
743
  order_id: string;
742
744
  triggerPrice?: number;
745
+ clientOrderId?: string;
743
746
  }>;
744
747
  }): Promise<void>;
745
748
  cancelLimitOrders(payload: {
@@ -2302,6 +2305,7 @@ export declare class ExchangePosition {
2302
2305
  stop: any;
2303
2306
  order_id: any;
2304
2307
  triggerPrice: any;
2308
+ client_order_id: any;
2305
2309
  }[];
2306
2310
  cancelExchangeOrder(payload: {
2307
2311
  type: "limit" | "stop" | "tp";
package/dist/index.js CHANGED
@@ -54874,7 +54874,8 @@ class AppDatabase {
54874
54874
  side: order.side,
54875
54875
  stop: order.stop || order.triggerPrice || 0,
54876
54876
  order_id: order.order_id.toString(),
54877
- account: account.id
54877
+ account: account.id,
54878
+ client_order_id: order.clientOrderId || ""
54878
54879
  };
54879
54880
  batch2.collection("orders").create(order_data);
54880
54881
  }
@@ -54897,7 +54898,7 @@ class AppDatabase {
54897
54898
  const existing_stop_orders = await this.pb.collection("orders").getFullList({
54898
54899
  filter: `symbol:lower="${symbol.toLowerCase()}" && account.owner:lower="${account.owner.toLowerCase()}" && account.exchange:lower="${account.exchange.toLowerCase()}" && kind="${kind}" && side:lower="${stop_side}" && stop > 0`
54899
54900
  });
54900
- const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : parseInt(o.order_id, 10));
54901
+ const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : symbol.startsWith("ETH") ? o.client_order_id : parseInt(o.order_id, 10));
54901
54902
  if (raw) {
54902
54903
  return exchange_order_ids;
54903
54904
  }
@@ -58634,6 +58635,7 @@ class Strategy {
58634
58635
  // src/types/index.ts
58635
58636
  class BaseExchange {
58636
58637
  client;
58638
+ name;
58637
58639
  getCredentials;
58638
58640
  proxyAgent;
58639
58641
  constructor(client) {
@@ -58737,7 +58739,13 @@ class BaseExchange {
58737
58739
  async cancelOrders(payload) {
58738
58740
  return await this._cancelOrders({
58739
58741
  symbol: payload.symbol,
58740
- orders: payload.orders.map((x) => ({ orderId: x }))
58742
+ orders: payload.orders.map((x) => {
58743
+ let key = "orderId";
58744
+ if (payload.symbol.startsWith("ETH") && this.name === "binance") {
58745
+ key = "clientOrderId";
58746
+ }
58747
+ return { [key]: x };
58748
+ })
58741
58749
  });
58742
58750
  }
58743
58751
  async placeTpOrder(payload) {
@@ -59779,6 +59787,7 @@ class BinanceExchange extends BaseExchange {
59779
59787
  main_client;
59780
59788
  constructor(client, main_client) {
59781
59789
  super(client);
59790
+ this.name = "binance";
59782
59791
  this.client = client;
59783
59792
  this.main_client = main_client;
59784
59793
  }
@@ -60062,10 +60071,14 @@ async function cancelOrdersParallel(payload) {
60062
60071
  const limit = import_p_limit.default(ORDERS_PER_SECOND);
60063
60072
  const results = await Promise.all(batches.map((batch2) => limit(async () => {
60064
60073
  try {
60065
- const result = await Promise.all(batch2.map((x) => client.cancelOrder({
60066
- symbol: payload.symbol,
60067
- orderId: x.orderId
60068
- })));
60074
+ const result = await Promise.all(batch2.map((x) => {
60075
+ let key = x.orderId ? "orderId" : "origClientOrderId";
60076
+ let value2 = x.orderId ? x.orderId : x.clientOrderId;
60077
+ return client.cancelOrder({
60078
+ symbol: payload.symbol,
60079
+ [key]: value2
60080
+ });
60081
+ }));
60069
60082
  console.log("Cancel batch result:", result);
60070
60083
  return result;
60071
60084
  } catch (error) {
@@ -60601,6 +60614,7 @@ class BybitExchange extends BaseExchange {
60601
60614
  main_client;
60602
60615
  constructor(client, main_client) {
60603
60616
  super(client);
60617
+ this.name = "bybit";
60604
60618
  this.client = client;
60605
60619
  this.main_client = main_client;
60606
60620
  }
@@ -62124,7 +62138,7 @@ class ExchangePosition {
62124
62138
  const orders = this.getOrders({ type });
62125
62139
  const result = await this.exchange.cancelOrders({
62126
62140
  symbol: this.symbol,
62127
- orders: orders.map((x) => x.order_id)
62141
+ orders: orders.map((x) => this.symbol.startsWith("ETH") ? x.client_order_id : x.order_id)
62128
62142
  });
62129
62143
  if (refresh) {
62130
62144
  await this.refresh(true);
@@ -62222,7 +62236,8 @@ function convert_to_exchange_order(order) {
62222
62236
  side: order.side,
62223
62237
  stop: order.stop,
62224
62238
  order_id: order.order_id,
62225
- triggerPrice: order.triggerPrice
62239
+ triggerPrice: order.triggerPrice,
62240
+ client_order_id: order.clientOrderId
62226
62241
  };
62227
62242
  }
62228
62243
 
@@ -61630,7 +61630,8 @@ class AppDatabase {
61630
61630
  side: order.side,
61631
61631
  stop: order.stop || order.triggerPrice || 0,
61632
61632
  order_id: order.order_id.toString(),
61633
- account: account.id
61633
+ account: account.id,
61634
+ client_order_id: order.clientOrderId || ""
61634
61635
  };
61635
61636
  batch2.collection("orders").create(order_data);
61636
61637
  }
@@ -61653,7 +61654,7 @@ class AppDatabase {
61653
61654
  const existing_stop_orders = await this.pb.collection("orders").getFullList({
61654
61655
  filter: `symbol:lower="${symbol.toLowerCase()}" && account.owner:lower="${account.owner.toLowerCase()}" && account.exchange:lower="${account.exchange.toLowerCase()}" && kind="${kind}" && side:lower="${stop_side}" && stop > 0`
61655
61656
  });
61656
- const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : parseInt(o.order_id, 10));
61657
+ const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : symbol.startsWith("ETH") ? o.client_order_id : parseInt(o.order_id, 10));
61657
61658
  if (raw) {
61658
61659
  return exchange_order_ids;
61659
61660
  }
@@ -65272,6 +65273,7 @@ class Strategy {
65272
65273
  // src/types/index.ts
65273
65274
  class BaseExchange {
65274
65275
  client;
65276
+ name;
65275
65277
  getCredentials;
65276
65278
  proxyAgent;
65277
65279
  constructor(client) {
@@ -65375,7 +65377,13 @@ class BaseExchange {
65375
65377
  async cancelOrders(payload) {
65376
65378
  return await this._cancelOrders({
65377
65379
  symbol: payload.symbol,
65378
- orders: payload.orders.map((x) => ({ orderId: x }))
65380
+ orders: payload.orders.map((x) => {
65381
+ let key = "orderId";
65382
+ if (payload.symbol.startsWith("ETH") && this.name === "binance") {
65383
+ key = "clientOrderId";
65384
+ }
65385
+ return { [key]: x };
65386
+ })
65379
65387
  });
65380
65388
  }
65381
65389
  async placeTpOrder(payload) {
@@ -66417,6 +66425,7 @@ class BinanceExchange extends BaseExchange {
66417
66425
  main_client;
66418
66426
  constructor(client, main_client) {
66419
66427
  super(client);
66428
+ this.name = "binance";
66420
66429
  this.client = client;
66421
66430
  this.main_client = main_client;
66422
66431
  }
@@ -66700,10 +66709,14 @@ async function cancelOrdersParallel(payload) {
66700
66709
  const limit = import_p_limit.default(ORDERS_PER_SECOND);
66701
66710
  const results = await Promise.all(batches.map((batch2) => limit(async () => {
66702
66711
  try {
66703
- const result = await Promise.all(batch2.map((x) => client.cancelOrder({
66704
- symbol: payload.symbol,
66705
- orderId: x.orderId
66706
- })));
66712
+ const result = await Promise.all(batch2.map((x) => {
66713
+ let key = x.orderId ? "orderId" : "origClientOrderId";
66714
+ let value2 = x.orderId ? x.orderId : x.clientOrderId;
66715
+ return client.cancelOrder({
66716
+ symbol: payload.symbol,
66717
+ [key]: value2
66718
+ });
66719
+ }));
66707
66720
  console.log("Cancel batch result:", result);
66708
66721
  return result;
66709
66722
  } catch (error) {
@@ -67239,6 +67252,7 @@ class BybitExchange extends BaseExchange {
67239
67252
  main_client;
67240
67253
  constructor(client, main_client) {
67241
67254
  super(client);
67255
+ this.name = "bybit";
67242
67256
  this.client = client;
67243
67257
  this.main_client = main_client;
67244
67258
  }
@@ -68762,7 +68776,7 @@ class ExchangePosition {
68762
68776
  const orders = this.getOrders({ type });
68763
68777
  const result = await this.exchange.cancelOrders({
68764
68778
  symbol: this.symbol,
68765
- orders: orders.map((x) => x.order_id)
68779
+ orders: orders.map((x) => this.symbol.startsWith("ETH") ? x.client_order_id : x.order_id)
68766
68780
  });
68767
68781
  if (refresh) {
68768
68782
  await this.refresh(true);
@@ -68860,7 +68874,8 @@ function convert_to_exchange_order(order) {
68860
68874
  side: order.side,
68861
68875
  stop: order.stop,
68862
68876
  order_id: order.order_id,
68863
- triggerPrice: order.triggerPrice
68877
+ triggerPrice: order.triggerPrice,
68878
+ client_order_id: order.clientOrderId
68864
68879
  };
68865
68880
  }
68866
68881
 
@@ -61603,7 +61603,8 @@ class AppDatabase {
61603
61603
  side: order.side,
61604
61604
  stop: order.stop || order.triggerPrice || 0,
61605
61605
  order_id: order.order_id.toString(),
61606
- account: account.id
61606
+ account: account.id,
61607
+ client_order_id: order.clientOrderId || ""
61607
61608
  };
61608
61609
  batch2.collection("orders").create(order_data);
61609
61610
  }
@@ -61626,7 +61627,7 @@ class AppDatabase {
61626
61627
  const existing_stop_orders = await this.pb.collection("orders").getFullList({
61627
61628
  filter: `symbol:lower="${symbol.toLowerCase()}" && account.owner:lower="${account.owner.toLowerCase()}" && account.exchange:lower="${account.exchange.toLowerCase()}" && kind="${kind}" && side:lower="${stop_side}" && stop > 0`
61628
61629
  });
61629
- const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : parseInt(o.order_id, 10));
61630
+ const exchange_order_ids = orders.concat(existing_stop_orders).map((o) => account.exchange === "bybit" ? o.order_id : symbol.startsWith("ETH") ? o.client_order_id : parseInt(o.order_id, 10));
61630
61631
  if (raw) {
61631
61632
  return exchange_order_ids;
61632
61633
  }
@@ -65245,6 +65246,7 @@ class Strategy {
65245
65246
  // src/types/index.ts
65246
65247
  class BaseExchange {
65247
65248
  client;
65249
+ name;
65248
65250
  getCredentials;
65249
65251
  proxyAgent;
65250
65252
  constructor(client) {
@@ -65348,7 +65350,13 @@ class BaseExchange {
65348
65350
  async cancelOrders(payload) {
65349
65351
  return await this._cancelOrders({
65350
65352
  symbol: payload.symbol,
65351
- orders: payload.orders.map((x) => ({ orderId: x }))
65353
+ orders: payload.orders.map((x) => {
65354
+ let key = "orderId";
65355
+ if (payload.symbol.startsWith("ETH") && this.name === "binance") {
65356
+ key = "clientOrderId";
65357
+ }
65358
+ return { [key]: x };
65359
+ })
65352
65360
  });
65353
65361
  }
65354
65362
  async placeTpOrder(payload) {
@@ -66390,6 +66398,7 @@ class BinanceExchange extends BaseExchange {
66390
66398
  main_client;
66391
66399
  constructor(client, main_client) {
66392
66400
  super(client);
66401
+ this.name = "binance";
66393
66402
  this.client = client;
66394
66403
  this.main_client = main_client;
66395
66404
  }
@@ -66673,10 +66682,14 @@ async function cancelOrdersParallel(payload) {
66673
66682
  const limit = import_p_limit.default(ORDERS_PER_SECOND);
66674
66683
  const results = await Promise.all(batches.map((batch2) => limit(async () => {
66675
66684
  try {
66676
- const result = await Promise.all(batch2.map((x) => client.cancelOrder({
66677
- symbol: payload.symbol,
66678
- orderId: x.orderId
66679
- })));
66685
+ const result = await Promise.all(batch2.map((x) => {
66686
+ let key = x.orderId ? "orderId" : "origClientOrderId";
66687
+ let value2 = x.orderId ? x.orderId : x.clientOrderId;
66688
+ return client.cancelOrder({
66689
+ symbol: payload.symbol,
66690
+ [key]: value2
66691
+ });
66692
+ }));
66680
66693
  console.log("Cancel batch result:", result);
66681
66694
  return result;
66682
66695
  } catch (error) {
@@ -67212,6 +67225,7 @@ class BybitExchange extends BaseExchange {
67212
67225
  main_client;
67213
67226
  constructor(client, main_client) {
67214
67227
  super(client);
67228
+ this.name = "bybit";
67215
67229
  this.client = client;
67216
67230
  this.main_client = main_client;
67217
67231
  }
@@ -68735,7 +68749,7 @@ class ExchangePosition {
68735
68749
  const orders = this.getOrders({ type });
68736
68750
  const result = await this.exchange.cancelOrders({
68737
68751
  symbol: this.symbol,
68738
- orders: orders.map((x) => x.order_id)
68752
+ orders: orders.map((x) => this.symbol.startsWith("ETH") ? x.client_order_id : x.order_id)
68739
68753
  });
68740
68754
  if (refresh) {
68741
68755
  await this.refresh(true);
@@ -68833,7 +68847,8 @@ function convert_to_exchange_order(order) {
68833
68847
  side: order.side,
68834
68848
  stop: order.stop,
68835
68849
  order_id: order.order_id,
68836
- triggerPrice: order.triggerPrice
68850
+ triggerPrice: order.triggerPrice,
68851
+ client_order_id: order.clientOrderId
68837
68852
  };
68838
68853
  }
68839
68854
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-187",
4
+ "version": "0.0.2-188",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",