@gbozee/ultimate 0.0.2-162 → 0.0.2-164

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
@@ -62299,8 +62299,24 @@ class ExchangeAccount {
62299
62299
  }
62300
62300
  async placeMarketOrder(payload) {
62301
62301
  const { symbol, kind } = payload;
62302
- const focus_position = await this.getFocusPosition(payload);
62303
- 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 && target_position.getInstance().quantity > 0 && focus_position.getInstance().quantity === 0) {
62314
+ _quantity = target_position.getInstance().quantity;
62315
+ }
62316
+ await focus_position.placeMarketOrder({
62317
+ quantity: _quantity,
62318
+ close: payload.close
62319
+ });
62304
62320
  await this.initializePositions({
62305
62321
  symbol,
62306
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
@@ -62245,8 +62245,24 @@ class ExchangeAccount {
62245
62245
  }
62246
62246
  async placeMarketOrder(payload) {
62247
62247
  const { symbol, kind } = payload;
62248
- const focus_position = await this.getFocusPosition(payload);
62249
- 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 && target_position.getInstance().quantity > 0 && focus_position.getInstance().quantity === 0) {
62260
+ _quantity = target_position.getInstance().quantity;
62261
+ }
62262
+ await focus_position.placeMarketOrder({
62263
+ quantity: _quantity,
62264
+ close: payload.close
62265
+ });
62250
62266
  await this.initializePositions({
62251
62267
  symbol,
62252
62268
  kind,
@@ -68973,8 +68973,24 @@ class ExchangeAccount {
68973
68973
  }
68974
68974
  async placeMarketOrder(payload) {
68975
68975
  const { symbol, kind } = payload;
68976
- const focus_position = await this.getFocusPosition(payload);
68977
- 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 && target_position.getInstance().quantity > 0 && focus_position.getInstance().quantity === 0) {
68988
+ _quantity = target_position.getInstance().quantity;
68989
+ }
68990
+ await focus_position.placeMarketOrder({
68991
+ quantity: _quantity,
68992
+ close: payload.close
68993
+ });
68978
68994
  await this.initializePositions({
68979
68995
  symbol,
68980
68996
  kind,
@@ -68950,8 +68950,24 @@ class ExchangeAccount {
68950
68950
  }
68951
68951
  async placeMarketOrder(payload) {
68952
68952
  const { symbol, kind } = payload;
68953
- const focus_position = await this.getFocusPosition(payload);
68954
- 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 && target_position.getInstance().quantity > 0 && focus_position.getInstance().quantity === 0) {
68965
+ _quantity = target_position.getInstance().quantity;
68966
+ }
68967
+ await focus_position.placeMarketOrder({
68968
+ quantity: _quantity,
68969
+ close: payload.close
68970
+ });
68955
68971
  await this.initializePositions({
68956
68972
  symbol,
68957
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-162",
4
+ "version": "0.0.2-164",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",