@gbozee/ultimate 0.0.2-28 → 0.0.2-29
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.d.ts +3 -0
- package/dist/index.js +17 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -616,6 +616,7 @@ declare class ExchangeAccount$1 {
|
|
|
616
616
|
place?: boolean;
|
|
617
617
|
update_db?: boolean;
|
|
618
618
|
raw?: boolean;
|
|
619
|
+
use_current?: boolean;
|
|
619
620
|
}): Promise<any>;
|
|
620
621
|
getPositionConfig(payload: {
|
|
621
622
|
symbol: string;
|
|
@@ -732,6 +733,7 @@ declare class ExchangeAccount$1 {
|
|
|
732
733
|
place?: boolean;
|
|
733
734
|
raw?: boolean;
|
|
734
735
|
tp?: boolean;
|
|
736
|
+
stop?: boolean;
|
|
735
737
|
}): Promise<any>;
|
|
736
738
|
verifyStopLoss(payload: {
|
|
737
739
|
symbol: string;
|
|
@@ -807,6 +809,7 @@ declare class ExchangeAccount$1 {
|
|
|
807
809
|
kind: "long" | "short";
|
|
808
810
|
place?: boolean;
|
|
809
811
|
tp?: boolean;
|
|
812
|
+
stop?: boolean;
|
|
810
813
|
raw?: boolean;
|
|
811
814
|
cancel?: boolean;
|
|
812
815
|
}): Promise<any>;
|
package/dist/index.js
CHANGED
|
@@ -35734,7 +35734,10 @@ function processPosition(codeNode, input, kind) {
|
|
|
35734
35734
|
}
|
|
35735
35735
|
async function reduceMajorPositionCalculation(input, exchange_instance) {
|
|
35736
35736
|
try {
|
|
35737
|
-
|
|
35737
|
+
let conditionsCheck = input.position.tp_quantity !== input.quantity || input.position.take_profit !== to_f(input.stop, input.price_places);
|
|
35738
|
+
if (input.opposite_position.stop_quantity) {
|
|
35739
|
+
conditionsCheck = conditionsCheck || input.opposite_position.stop_quantity !== input.to_place.quantity;
|
|
35740
|
+
}
|
|
35738
35741
|
console.log("conditionsCheck for ", input.position.kind, conditionsCheck);
|
|
35739
35742
|
console.log("opposite_check", {
|
|
35740
35743
|
kind: input.opposite_position.kind,
|
|
@@ -36550,9 +36553,13 @@ class ExchangeAccount {
|
|
|
36550
36553
|
return result;
|
|
36551
36554
|
}
|
|
36552
36555
|
if (action === "place_stop_orders" && payload.place) {
|
|
36556
|
+
const instance = await this.syncAccount({
|
|
36557
|
+
symbol: payload.symbol,
|
|
36558
|
+
kind: app_config.kind
|
|
36559
|
+
});
|
|
36553
36560
|
let result = await this.exchange.placeStopOrders({
|
|
36554
36561
|
symbol: payload.symbol,
|
|
36555
|
-
quantity: trades[0].avg_size,
|
|
36562
|
+
quantity: payload.use_current ? instance.quantity : trades[0].avg_size,
|
|
36556
36563
|
kind: app_config.kind,
|
|
36557
36564
|
stop: payload.stop,
|
|
36558
36565
|
price_places: app_config.price_places,
|
|
@@ -36896,7 +36903,7 @@ class ExchangeAccount {
|
|
|
36896
36903
|
return null;
|
|
36897
36904
|
}
|
|
36898
36905
|
async triggerTradeFromConfig(payload) {
|
|
36899
|
-
const { symbol, kind, place = true } = payload;
|
|
36906
|
+
const { symbol, kind, place = true, stop } = payload;
|
|
36900
36907
|
const position2 = await this.syncAccount({
|
|
36901
36908
|
symbol,
|
|
36902
36909
|
kind
|
|
@@ -36904,14 +36911,16 @@ class ExchangeAccount {
|
|
|
36904
36911
|
if (position2?.config) {
|
|
36905
36912
|
const config = position2.expand.config;
|
|
36906
36913
|
let entry = payload.tp ? position2.entry || config.entry : config.entry;
|
|
36907
|
-
|
|
36914
|
+
const v = stop ? "place_stop_orders" : "place_limit_orders";
|
|
36915
|
+
return await this.placeSharedOrder(v, {
|
|
36908
36916
|
symbol,
|
|
36909
36917
|
entry,
|
|
36910
36918
|
stop: config.stop,
|
|
36911
36919
|
risk_reward: config.risk_reward,
|
|
36912
36920
|
risk: config.risk,
|
|
36913
36921
|
place,
|
|
36914
|
-
raw: payload.raw
|
|
36922
|
+
raw: payload.raw,
|
|
36923
|
+
use_current: Boolean(stop)
|
|
36915
36924
|
});
|
|
36916
36925
|
}
|
|
36917
36926
|
}
|
|
@@ -37657,7 +37666,7 @@ class ExchangeAccount {
|
|
|
37657
37666
|
return 0;
|
|
37658
37667
|
}
|
|
37659
37668
|
async placeTrade(payload) {
|
|
37660
|
-
const { symbol, kind, place, tp, raw: _raw, cancel } = payload;
|
|
37669
|
+
const { symbol, kind, place, tp, raw: _raw, cancel, stop } = payload;
|
|
37661
37670
|
if (cancel) {
|
|
37662
37671
|
await this.cancelOrders({
|
|
37663
37672
|
symbol,
|
|
@@ -37668,7 +37677,8 @@ class ExchangeAccount {
|
|
|
37668
37677
|
return await this.triggerTradeFromConfig({
|
|
37669
37678
|
symbol,
|
|
37670
37679
|
kind,
|
|
37671
|
-
raw: payload.raw
|
|
37680
|
+
raw: payload.raw,
|
|
37681
|
+
stop
|
|
37672
37682
|
});
|
|
37673
37683
|
}
|
|
37674
37684
|
await this.syncAccount({
|