@gbozee/ultimate 0.0.2-161 → 0.0.2-163

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
@@ -61515,11 +61515,15 @@ class ExchangePosition {
61515
61515
  async placeMarketOrder(payload) {
61516
61516
  const { quantity, close } = payload;
61517
61517
  const symbol_config = this.symbol_config;
61518
+ let quantity_to_sell = quantity;
61519
+ if (close && !quantity) {
61520
+ quantity_to_sell = this.instance.quantity;
61521
+ }
61518
61522
  await this.exchange.placeMarketOrder({
61519
61523
  symbol: this.symbol,
61520
61524
  kind: this.kind,
61521
61525
  close,
61522
- quantity,
61526
+ quantity: quantity_to_sell,
61523
61527
  price_places: symbol_config.price_places,
61524
61528
  decimal_places: symbol_config.decimal_places
61525
61529
  });
@@ -62295,8 +62299,24 @@ class ExchangeAccount {
62295
62299
  }
62296
62300
  async placeMarketOrder(payload) {
62297
62301
  const { symbol, kind } = payload;
62298
- const focus_position = await this.getFocusPosition(payload);
62299
- await focus_position.placeMarketOrder(payload);
62302
+ const long_position = await this.getFocusPosition({
62303
+ symbol,
62304
+ kind: "long"
62305
+ });
62306
+ const short_position = await this.getFocusPosition({
62307
+ symbol,
62308
+ kind: "short"
62309
+ });
62310
+ const focus_position = kind === "long" ? long_position : short_position;
62311
+ const target_position = kind === "long" ? short_position : long_position;
62312
+ let _quantity = payload.quantity;
62313
+ if (!payload.close && !payload.quantity) {
62314
+ _quantity = target_position.getInstance().quantity;
62315
+ }
62316
+ await focus_position.placeMarketOrder({
62317
+ quantity: _quantity,
62318
+ close: payload.close
62319
+ });
62300
62320
  await this.initializePositions({
62301
62321
  symbol,
62302
62322
  kind,
package/dist/index.d.ts CHANGED
@@ -2297,7 +2297,8 @@ declare class ExchangeAccount$1 {
2297
2297
  placeMarketOrder(payload: {
2298
2298
  symbol: string;
2299
2299
  kind: "long" | "short";
2300
- quantity: number;
2300
+ quantity?: number;
2301
+ close?: boolean;
2301
2302
  }): Promise<void>;
2302
2303
  placeSingleOrder(payload: {
2303
2304
  symbol: string;
package/dist/index.js CHANGED
@@ -61461,11 +61461,15 @@ class ExchangePosition {
61461
61461
  async placeMarketOrder(payload) {
61462
61462
  const { quantity, close } = payload;
61463
61463
  const symbol_config = this.symbol_config;
61464
+ let quantity_to_sell = quantity;
61465
+ if (close && !quantity) {
61466
+ quantity_to_sell = this.instance.quantity;
61467
+ }
61464
61468
  await this.exchange.placeMarketOrder({
61465
61469
  symbol: this.symbol,
61466
61470
  kind: this.kind,
61467
61471
  close,
61468
- quantity,
61472
+ quantity: quantity_to_sell,
61469
61473
  price_places: symbol_config.price_places,
61470
61474
  decimal_places: symbol_config.decimal_places
61471
61475
  });
@@ -62241,8 +62245,24 @@ class ExchangeAccount {
62241
62245
  }
62242
62246
  async placeMarketOrder(payload) {
62243
62247
  const { symbol, kind } = payload;
62244
- const focus_position = await this.getFocusPosition(payload);
62245
- await focus_position.placeMarketOrder(payload);
62248
+ const long_position = await this.getFocusPosition({
62249
+ symbol,
62250
+ kind: "long"
62251
+ });
62252
+ const short_position = await this.getFocusPosition({
62253
+ symbol,
62254
+ kind: "short"
62255
+ });
62256
+ const focus_position = kind === "long" ? long_position : short_position;
62257
+ const target_position = kind === "long" ? short_position : long_position;
62258
+ let _quantity = payload.quantity;
62259
+ if (!payload.close && !payload.quantity) {
62260
+ _quantity = target_position.getInstance().quantity;
62261
+ }
62262
+ await focus_position.placeMarketOrder({
62263
+ quantity: _quantity,
62264
+ close: payload.close
62265
+ });
62246
62266
  await this.initializePositions({
62247
62267
  symbol,
62248
62268
  kind,
@@ -68189,11 +68189,15 @@ class ExchangePosition {
68189
68189
  async placeMarketOrder(payload) {
68190
68190
  const { quantity, close } = payload;
68191
68191
  const symbol_config = this.symbol_config;
68192
+ let quantity_to_sell = quantity;
68193
+ if (close && !quantity) {
68194
+ quantity_to_sell = this.instance.quantity;
68195
+ }
68192
68196
  await this.exchange.placeMarketOrder({
68193
68197
  symbol: this.symbol,
68194
68198
  kind: this.kind,
68195
68199
  close,
68196
- quantity,
68200
+ quantity: quantity_to_sell,
68197
68201
  price_places: symbol_config.price_places,
68198
68202
  decimal_places: symbol_config.decimal_places
68199
68203
  });
@@ -68969,8 +68973,24 @@ class ExchangeAccount {
68969
68973
  }
68970
68974
  async placeMarketOrder(payload) {
68971
68975
  const { symbol, kind } = payload;
68972
- const focus_position = await this.getFocusPosition(payload);
68973
- await focus_position.placeMarketOrder(payload);
68976
+ const long_position = await this.getFocusPosition({
68977
+ symbol,
68978
+ kind: "long"
68979
+ });
68980
+ const short_position = await this.getFocusPosition({
68981
+ symbol,
68982
+ kind: "short"
68983
+ });
68984
+ const focus_position = kind === "long" ? long_position : short_position;
68985
+ const target_position = kind === "long" ? short_position : long_position;
68986
+ let _quantity = payload.quantity;
68987
+ if (!payload.close && !payload.quantity) {
68988
+ _quantity = target_position.getInstance().quantity;
68989
+ }
68990
+ await focus_position.placeMarketOrder({
68991
+ quantity: _quantity,
68992
+ close: payload.close
68993
+ });
68974
68994
  await this.initializePositions({
68975
68995
  symbol,
68976
68996
  kind,
@@ -68166,11 +68166,15 @@ class ExchangePosition {
68166
68166
  async placeMarketOrder(payload) {
68167
68167
  const { quantity, close } = payload;
68168
68168
  const symbol_config = this.symbol_config;
68169
+ let quantity_to_sell = quantity;
68170
+ if (close && !quantity) {
68171
+ quantity_to_sell = this.instance.quantity;
68172
+ }
68169
68173
  await this.exchange.placeMarketOrder({
68170
68174
  symbol: this.symbol,
68171
68175
  kind: this.kind,
68172
68176
  close,
68173
- quantity,
68177
+ quantity: quantity_to_sell,
68174
68178
  price_places: symbol_config.price_places,
68175
68179
  decimal_places: symbol_config.decimal_places
68176
68180
  });
@@ -68946,8 +68950,24 @@ class ExchangeAccount {
68946
68950
  }
68947
68951
  async placeMarketOrder(payload) {
68948
68952
  const { symbol, kind } = payload;
68949
- const focus_position = await this.getFocusPosition(payload);
68950
- await focus_position.placeMarketOrder(payload);
68953
+ const long_position = await this.getFocusPosition({
68954
+ symbol,
68955
+ kind: "long"
68956
+ });
68957
+ const short_position = await this.getFocusPosition({
68958
+ symbol,
68959
+ kind: "short"
68960
+ });
68961
+ const focus_position = kind === "long" ? long_position : short_position;
68962
+ const target_position = kind === "long" ? short_position : long_position;
68963
+ let _quantity = payload.quantity;
68964
+ if (!payload.close && !payload.quantity) {
68965
+ _quantity = target_position.getInstance().quantity;
68966
+ }
68967
+ await focus_position.placeMarketOrder({
68968
+ quantity: _quantity,
68969
+ close: payload.close
68970
+ });
68951
68971
  await this.initializePositions({
68952
68972
  symbol,
68953
68973
  kind,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-161",
4
+ "version": "0.0.2-163",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",