@gbozee/ultimate 0.0.2-159 → 0.0.2-161

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
@@ -58598,8 +58598,12 @@ class BaseExchange {
58598
58598
  });
58599
58599
  }
58600
58600
  async placeMarketOrder(payload) {
58601
- const { symbol, kind, quantity, price_places, decimal_places } = payload;
58601
+ const { symbol, kind, quantity, price_places, decimal_places, close } = payload;
58602
58602
  const currentPrice = await this.get_current_price(symbol);
58603
+ let side = kind === "long" ? "buy" : "sell";
58604
+ if (close) {
58605
+ side = kind === "long" ? "sell" : "buy";
58606
+ }
58603
58607
  return this._createLimitPurchaseOrders({
58604
58608
  symbol,
58605
58609
  price_places,
@@ -58607,7 +58611,7 @@ class BaseExchange {
58607
58611
  orders: [
58608
58612
  {
58609
58613
  force_market: true,
58610
- side: kind === "long" ? "buy" : "sell",
58614
+ side,
58611
58615
  kind,
58612
58616
  quantity,
58613
58617
  price: currentPrice
@@ -61096,7 +61100,7 @@ class ExchangePosition {
61096
61100
  };
61097
61101
  }
61098
61102
  async buildAppConfig(payload) {
61099
- let config2 = await this.app_db.getSymbolConfigFromDB(this.symbol);
61103
+ let config2 = this.symbol_config;
61100
61104
  const app_config = buildAppConfig(config2, {
61101
61105
  ...payload,
61102
61106
  symbol: this.symbol
@@ -61509,11 +61513,12 @@ class ExchangePosition {
61509
61513
  }
61510
61514
  }
61511
61515
  async placeMarketOrder(payload) {
61512
- const { quantity } = payload;
61516
+ const { quantity, close } = payload;
61513
61517
  const symbol_config = this.symbol_config;
61514
61518
  await this.exchange.placeMarketOrder({
61515
61519
  symbol: this.symbol,
61516
61520
  kind: this.kind,
61521
+ close,
61517
61522
  quantity,
61518
61523
  price_places: symbol_config.price_places,
61519
61524
  decimal_places: symbol_config.decimal_places
@@ -63221,7 +63226,7 @@ class ExchangeAccount {
63221
63226
  }
63222
63227
  }
63223
63228
  async profitWithinGapStrategy(payload) {
63224
- const { symbol } = payload;
63229
+ const { symbol, callback } = payload;
63225
63230
  console.log("Fetching positions for ", symbol);
63226
63231
  const positions = await this.syncAccount({
63227
63232
  symbol,
@@ -63263,10 +63268,18 @@ class ExchangeAccount {
63263
63268
  });
63264
63269
  }
63265
63270
  console.log("Checking if focus position has quantity for ", symbol, kind);
63266
- await this.oppositeGapExists({
63267
- symbol,
63268
- kind
63269
- });
63271
+ if (callback) {
63272
+ await callback({
63273
+ symbol,
63274
+ account: this.instance,
63275
+ kind
63276
+ });
63277
+ } else {
63278
+ await this.oppositeGapExists({
63279
+ symbol,
63280
+ kind
63281
+ });
63282
+ }
63270
63283
  return {
63271
63284
  config_details: {
63272
63285
  app_config,
package/dist/index.d.ts CHANGED
@@ -508,6 +508,7 @@ declare abstract class BaseExchange {
508
508
  quantity: number;
509
509
  price_places?: string;
510
510
  decimal_places?: string;
511
+ close?: boolean;
511
512
  }): Promise<any>;
512
513
  customStopLoss(payload: {
513
514
  price_places: string;
@@ -1948,7 +1949,8 @@ declare class ExchangePosition {
1948
1949
  short_position: ExchangePosition;
1949
1950
  }): Promise<string>;
1950
1951
  placeMarketOrder(payload: {
1951
- quantity: number;
1952
+ quantity?: number;
1953
+ close?: boolean;
1952
1954
  }): Promise<void>;
1953
1955
  generate_config_params(payload: {
1954
1956
  entry: number;
@@ -2577,6 +2579,11 @@ declare class ExchangeAccount$1 {
2577
2579
  }): Promise<void>;
2578
2580
  profitWithinGapStrategy(payload: {
2579
2581
  symbol: string;
2582
+ callback?: (params: {
2583
+ symbol: string;
2584
+ account: ExchangeType;
2585
+ kind: "long" | "short";
2586
+ }) => Promise<any>;
2580
2587
  }): Promise<{
2581
2588
  config_details: {
2582
2589
  app_config: {
package/dist/index.js CHANGED
@@ -58544,8 +58544,12 @@ class BaseExchange {
58544
58544
  });
58545
58545
  }
58546
58546
  async placeMarketOrder(payload) {
58547
- const { symbol, kind, quantity, price_places, decimal_places } = payload;
58547
+ const { symbol, kind, quantity, price_places, decimal_places, close } = payload;
58548
58548
  const currentPrice = await this.get_current_price(symbol);
58549
+ let side = kind === "long" ? "buy" : "sell";
58550
+ if (close) {
58551
+ side = kind === "long" ? "sell" : "buy";
58552
+ }
58549
58553
  return this._createLimitPurchaseOrders({
58550
58554
  symbol,
58551
58555
  price_places,
@@ -58553,7 +58557,7 @@ class BaseExchange {
58553
58557
  orders: [
58554
58558
  {
58555
58559
  force_market: true,
58556
- side: kind === "long" ? "buy" : "sell",
58560
+ side,
58557
58561
  kind,
58558
58562
  quantity,
58559
58563
  price: currentPrice
@@ -61042,7 +61046,7 @@ class ExchangePosition {
61042
61046
  };
61043
61047
  }
61044
61048
  async buildAppConfig(payload) {
61045
- let config2 = await this.app_db.getSymbolConfigFromDB(this.symbol);
61049
+ let config2 = this.symbol_config;
61046
61050
  const app_config = buildAppConfig(config2, {
61047
61051
  ...payload,
61048
61052
  symbol: this.symbol
@@ -61455,11 +61459,12 @@ class ExchangePosition {
61455
61459
  }
61456
61460
  }
61457
61461
  async placeMarketOrder(payload) {
61458
- const { quantity } = payload;
61462
+ const { quantity, close } = payload;
61459
61463
  const symbol_config = this.symbol_config;
61460
61464
  await this.exchange.placeMarketOrder({
61461
61465
  symbol: this.symbol,
61462
61466
  kind: this.kind,
61467
+ close,
61463
61468
  quantity,
61464
61469
  price_places: symbol_config.price_places,
61465
61470
  decimal_places: symbol_config.decimal_places
@@ -63167,7 +63172,7 @@ class ExchangeAccount {
63167
63172
  }
63168
63173
  }
63169
63174
  async profitWithinGapStrategy(payload) {
63170
- const { symbol } = payload;
63175
+ const { symbol, callback } = payload;
63171
63176
  console.log("Fetching positions for ", symbol);
63172
63177
  const positions = await this.syncAccount({
63173
63178
  symbol,
@@ -63209,10 +63214,18 @@ class ExchangeAccount {
63209
63214
  });
63210
63215
  }
63211
63216
  console.log("Checking if focus position has quantity for ", symbol, kind);
63212
- await this.oppositeGapExists({
63213
- symbol,
63214
- kind
63215
- });
63217
+ if (callback) {
63218
+ await callback({
63219
+ symbol,
63220
+ account: this.instance,
63221
+ kind
63222
+ });
63223
+ } else {
63224
+ await this.oppositeGapExists({
63225
+ symbol,
63226
+ kind
63227
+ });
63228
+ }
63216
63229
  return {
63217
63230
  config_details: {
63218
63231
  app_config,
@@ -65272,8 +65272,12 @@ class BaseExchange {
65272
65272
  });
65273
65273
  }
65274
65274
  async placeMarketOrder(payload) {
65275
- const { symbol, kind, quantity, price_places, decimal_places } = payload;
65275
+ const { symbol, kind, quantity, price_places, decimal_places, close } = payload;
65276
65276
  const currentPrice = await this.get_current_price(symbol);
65277
+ let side = kind === "long" ? "buy" : "sell";
65278
+ if (close) {
65279
+ side = kind === "long" ? "sell" : "buy";
65280
+ }
65277
65281
  return this._createLimitPurchaseOrders({
65278
65282
  symbol,
65279
65283
  price_places,
@@ -65281,7 +65285,7 @@ class BaseExchange {
65281
65285
  orders: [
65282
65286
  {
65283
65287
  force_market: true,
65284
- side: kind === "long" ? "buy" : "sell",
65288
+ side,
65285
65289
  kind,
65286
65290
  quantity,
65287
65291
  price: currentPrice
@@ -67770,7 +67774,7 @@ class ExchangePosition {
67770
67774
  };
67771
67775
  }
67772
67776
  async buildAppConfig(payload) {
67773
- let config2 = await this.app_db.getSymbolConfigFromDB(this.symbol);
67777
+ let config2 = this.symbol_config;
67774
67778
  const app_config = buildAppConfig(config2, {
67775
67779
  ...payload,
67776
67780
  symbol: this.symbol
@@ -68183,11 +68187,12 @@ class ExchangePosition {
68183
68187
  }
68184
68188
  }
68185
68189
  async placeMarketOrder(payload) {
68186
- const { quantity } = payload;
68190
+ const { quantity, close } = payload;
68187
68191
  const symbol_config = this.symbol_config;
68188
68192
  await this.exchange.placeMarketOrder({
68189
68193
  symbol: this.symbol,
68190
68194
  kind: this.kind,
68195
+ close,
68191
68196
  quantity,
68192
68197
  price_places: symbol_config.price_places,
68193
68198
  decimal_places: symbol_config.decimal_places
@@ -69895,7 +69900,7 @@ class ExchangeAccount {
69895
69900
  }
69896
69901
  }
69897
69902
  async profitWithinGapStrategy(payload) {
69898
- const { symbol } = payload;
69903
+ const { symbol, callback } = payload;
69899
69904
  console.log("Fetching positions for ", symbol);
69900
69905
  const positions = await this.syncAccount({
69901
69906
  symbol,
@@ -69937,10 +69942,18 @@ class ExchangeAccount {
69937
69942
  });
69938
69943
  }
69939
69944
  console.log("Checking if focus position has quantity for ", symbol, kind);
69940
- await this.oppositeGapExists({
69941
- symbol,
69942
- kind
69943
- });
69945
+ if (callback) {
69946
+ await callback({
69947
+ symbol,
69948
+ account: this.instance,
69949
+ kind
69950
+ });
69951
+ } else {
69952
+ await this.oppositeGapExists({
69953
+ symbol,
69954
+ kind
69955
+ });
69956
+ }
69944
69957
  return {
69945
69958
  config_details: {
69946
69959
  app_config,
@@ -65249,8 +65249,12 @@ class BaseExchange {
65249
65249
  });
65250
65250
  }
65251
65251
  async placeMarketOrder(payload) {
65252
- const { symbol, kind, quantity, price_places, decimal_places } = payload;
65252
+ const { symbol, kind, quantity, price_places, decimal_places, close } = payload;
65253
65253
  const currentPrice = await this.get_current_price(symbol);
65254
+ let side = kind === "long" ? "buy" : "sell";
65255
+ if (close) {
65256
+ side = kind === "long" ? "sell" : "buy";
65257
+ }
65254
65258
  return this._createLimitPurchaseOrders({
65255
65259
  symbol,
65256
65260
  price_places,
@@ -65258,7 +65262,7 @@ class BaseExchange {
65258
65262
  orders: [
65259
65263
  {
65260
65264
  force_market: true,
65261
- side: kind === "long" ? "buy" : "sell",
65265
+ side,
65262
65266
  kind,
65263
65267
  quantity,
65264
65268
  price: currentPrice
@@ -67747,7 +67751,7 @@ class ExchangePosition {
67747
67751
  };
67748
67752
  }
67749
67753
  async buildAppConfig(payload) {
67750
- let config2 = await this.app_db.getSymbolConfigFromDB(this.symbol);
67754
+ let config2 = this.symbol_config;
67751
67755
  const app_config = buildAppConfig(config2, {
67752
67756
  ...payload,
67753
67757
  symbol: this.symbol
@@ -68160,11 +68164,12 @@ class ExchangePosition {
68160
68164
  }
68161
68165
  }
68162
68166
  async placeMarketOrder(payload) {
68163
- const { quantity } = payload;
68167
+ const { quantity, close } = payload;
68164
68168
  const symbol_config = this.symbol_config;
68165
68169
  await this.exchange.placeMarketOrder({
68166
68170
  symbol: this.symbol,
68167
68171
  kind: this.kind,
68172
+ close,
68168
68173
  quantity,
68169
68174
  price_places: symbol_config.price_places,
68170
68175
  decimal_places: symbol_config.decimal_places
@@ -69872,7 +69877,7 @@ class ExchangeAccount {
69872
69877
  }
69873
69878
  }
69874
69879
  async profitWithinGapStrategy(payload) {
69875
- const { symbol } = payload;
69880
+ const { symbol, callback } = payload;
69876
69881
  console.log("Fetching positions for ", symbol);
69877
69882
  const positions = await this.syncAccount({
69878
69883
  symbol,
@@ -69914,10 +69919,18 @@ class ExchangeAccount {
69914
69919
  });
69915
69920
  }
69916
69921
  console.log("Checking if focus position has quantity for ", symbol, kind);
69917
- await this.oppositeGapExists({
69918
- symbol,
69919
- kind
69920
- });
69922
+ if (callback) {
69923
+ await callback({
69924
+ symbol,
69925
+ account: this.instance,
69926
+ kind
69927
+ });
69928
+ } else {
69929
+ await this.oppositeGapExists({
69930
+ symbol,
69931
+ kind
69932
+ });
69933
+ }
69921
69934
  return {
69922
69935
  config_details: {
69923
69936
  app_config,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-159",
4
+ "version": "0.0.2-161",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",