@gbozee/ultimate 0.0.2-180 → 0.0.2-181
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 +37 -2
- package/dist/index.d.ts +14 -0
- package/dist/index.js +37 -2
- package/dist/mcp-server.cjs +37 -2
- package/dist/mcp-server.js +37 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -61758,7 +61758,12 @@ class ExchangePosition {
|
|
|
61758
61758
|
};
|
|
61759
61759
|
}
|
|
61760
61760
|
async increasePositionAtStop(payload) {
|
|
61761
|
-
const {
|
|
61761
|
+
const {
|
|
61762
|
+
place = false,
|
|
61763
|
+
increase = true,
|
|
61764
|
+
ratio_to_loose = 0,
|
|
61765
|
+
reverse_position
|
|
61766
|
+
} = payload;
|
|
61762
61767
|
const position2 = this.instance;
|
|
61763
61768
|
console.log(position2);
|
|
61764
61769
|
let price_params = {
|
|
@@ -61786,6 +61791,10 @@ class ExchangePosition {
|
|
|
61786
61791
|
});
|
|
61787
61792
|
}
|
|
61788
61793
|
}
|
|
61794
|
+
const _pnl = determine_pnl(position2.entry, price_params.price, price_params.quantity, this.kind);
|
|
61795
|
+
if (_pnl > 0 && ratio_to_loose) {
|
|
61796
|
+
await reverse_position.lockReduction({ pnl: _pnl * ratio_to_loose });
|
|
61797
|
+
}
|
|
61789
61798
|
return await this.exchange.customStopLoss({
|
|
61790
61799
|
symbol: this.symbol,
|
|
61791
61800
|
kind: this.kind,
|
|
@@ -61798,6 +61807,24 @@ class ExchangePosition {
|
|
|
61798
61807
|
});
|
|
61799
61808
|
}
|
|
61800
61809
|
}
|
|
61810
|
+
async lockReduction({
|
|
61811
|
+
pnl,
|
|
61812
|
+
place = true,
|
|
61813
|
+
pause_tp = true
|
|
61814
|
+
}) {
|
|
61815
|
+
if (pnl > 0 && this.instance.quantity > 0) {
|
|
61816
|
+
const diff = pnl / this.instance.quantity;
|
|
61817
|
+
const tp_price = this.kind === "long" ? diff + this.instance.entry : this.instance.entry - diff;
|
|
61818
|
+
return this.exchange_account.justInTimeProfit({
|
|
61819
|
+
symbol: this.symbol,
|
|
61820
|
+
kind: this.kind,
|
|
61821
|
+
take_profit: tp_price,
|
|
61822
|
+
target_pnl: pnl,
|
|
61823
|
+
place,
|
|
61824
|
+
pause_tp
|
|
61825
|
+
});
|
|
61826
|
+
}
|
|
61827
|
+
}
|
|
61801
61828
|
async placeSingleOrder(payload) {
|
|
61802
61829
|
const { long_position, short_position } = payload;
|
|
61803
61830
|
const kind = this.kind;
|
|
@@ -62849,8 +62876,16 @@ class ExchangeAccount {
|
|
|
62849
62876
|
});
|
|
62850
62877
|
}
|
|
62851
62878
|
async increasePositionAtStop(payload) {
|
|
62879
|
+
const { symbol, kind } = payload;
|
|
62880
|
+
const reverse_position = await this.getFocusPosition({
|
|
62881
|
+
symbol,
|
|
62882
|
+
kind: kind === "long" ? "short" : "long"
|
|
62883
|
+
});
|
|
62852
62884
|
const focus_position = await this.getFocusPosition(payload);
|
|
62853
|
-
return await focus_position.increasePositionAtStop(
|
|
62885
|
+
return await focus_position.increasePositionAtStop({
|
|
62886
|
+
...payload,
|
|
62887
|
+
reverse_position
|
|
62888
|
+
});
|
|
62854
62889
|
}
|
|
62855
62890
|
async triggerTradeFromConfig(payload) {
|
|
62856
62891
|
const focus_position = await this.getFocusPosition(payload);
|
package/dist/index.d.ts
CHANGED
|
@@ -2149,7 +2149,20 @@ export declare class ExchangePosition {
|
|
|
2149
2149
|
price?: number;
|
|
2150
2150
|
quantity?: number;
|
|
2151
2151
|
increase?: boolean;
|
|
2152
|
+
ratio_to_loose?: number;
|
|
2153
|
+
reverse_position?: ExchangePosition;
|
|
2152
2154
|
}): Promise<any>;
|
|
2155
|
+
lockReduction({ pnl, place, pause_tp, }: {
|
|
2156
|
+
pnl: number;
|
|
2157
|
+
place?: boolean;
|
|
2158
|
+
pause_tp?: boolean;
|
|
2159
|
+
}): Promise<{
|
|
2160
|
+
sell_ratio: number;
|
|
2161
|
+
current_pnl: number;
|
|
2162
|
+
profit_percent: number;
|
|
2163
|
+
current_price: number;
|
|
2164
|
+
notional_value: number;
|
|
2165
|
+
}>;
|
|
2153
2166
|
placeSingleOrder(payload: {
|
|
2154
2167
|
long_position: ExchangePosition;
|
|
2155
2168
|
short_position: ExchangePosition;
|
|
@@ -2621,6 +2634,7 @@ declare class ExchangeAccount$1 {
|
|
|
2621
2634
|
price?: number;
|
|
2622
2635
|
quantity?: number;
|
|
2623
2636
|
increase?: boolean;
|
|
2637
|
+
ratio_to_loose?: number;
|
|
2624
2638
|
}): Promise<any>;
|
|
2625
2639
|
triggerTradeFromConfig(payload: {
|
|
2626
2640
|
symbol: string;
|
package/dist/index.js
CHANGED
|
@@ -61696,7 +61696,12 @@ class ExchangePosition {
|
|
|
61696
61696
|
};
|
|
61697
61697
|
}
|
|
61698
61698
|
async increasePositionAtStop(payload) {
|
|
61699
|
-
const {
|
|
61699
|
+
const {
|
|
61700
|
+
place = false,
|
|
61701
|
+
increase = true,
|
|
61702
|
+
ratio_to_loose = 0,
|
|
61703
|
+
reverse_position
|
|
61704
|
+
} = payload;
|
|
61700
61705
|
const position2 = this.instance;
|
|
61701
61706
|
console.log(position2);
|
|
61702
61707
|
let price_params = {
|
|
@@ -61724,6 +61729,10 @@ class ExchangePosition {
|
|
|
61724
61729
|
});
|
|
61725
61730
|
}
|
|
61726
61731
|
}
|
|
61732
|
+
const _pnl = determine_pnl(position2.entry, price_params.price, price_params.quantity, this.kind);
|
|
61733
|
+
if (_pnl > 0 && ratio_to_loose) {
|
|
61734
|
+
await reverse_position.lockReduction({ pnl: _pnl * ratio_to_loose });
|
|
61735
|
+
}
|
|
61727
61736
|
return await this.exchange.customStopLoss({
|
|
61728
61737
|
symbol: this.symbol,
|
|
61729
61738
|
kind: this.kind,
|
|
@@ -61736,6 +61745,24 @@ class ExchangePosition {
|
|
|
61736
61745
|
});
|
|
61737
61746
|
}
|
|
61738
61747
|
}
|
|
61748
|
+
async lockReduction({
|
|
61749
|
+
pnl,
|
|
61750
|
+
place = true,
|
|
61751
|
+
pause_tp = true
|
|
61752
|
+
}) {
|
|
61753
|
+
if (pnl > 0 && this.instance.quantity > 0) {
|
|
61754
|
+
const diff = pnl / this.instance.quantity;
|
|
61755
|
+
const tp_price = this.kind === "long" ? diff + this.instance.entry : this.instance.entry - diff;
|
|
61756
|
+
return this.exchange_account.justInTimeProfit({
|
|
61757
|
+
symbol: this.symbol,
|
|
61758
|
+
kind: this.kind,
|
|
61759
|
+
take_profit: tp_price,
|
|
61760
|
+
target_pnl: pnl,
|
|
61761
|
+
place,
|
|
61762
|
+
pause_tp
|
|
61763
|
+
});
|
|
61764
|
+
}
|
|
61765
|
+
}
|
|
61739
61766
|
async placeSingleOrder(payload) {
|
|
61740
61767
|
const { long_position, short_position } = payload;
|
|
61741
61768
|
const kind = this.kind;
|
|
@@ -62787,8 +62814,16 @@ class ExchangeAccount {
|
|
|
62787
62814
|
});
|
|
62788
62815
|
}
|
|
62789
62816
|
async increasePositionAtStop(payload) {
|
|
62817
|
+
const { symbol, kind } = payload;
|
|
62818
|
+
const reverse_position = await this.getFocusPosition({
|
|
62819
|
+
symbol,
|
|
62820
|
+
kind: kind === "long" ? "short" : "long"
|
|
62821
|
+
});
|
|
62790
62822
|
const focus_position = await this.getFocusPosition(payload);
|
|
62791
|
-
return await focus_position.increasePositionAtStop(
|
|
62823
|
+
return await focus_position.increasePositionAtStop({
|
|
62824
|
+
...payload,
|
|
62825
|
+
reverse_position
|
|
62826
|
+
});
|
|
62792
62827
|
}
|
|
62793
62828
|
async triggerTradeFromConfig(payload) {
|
|
62794
62829
|
const focus_position = await this.getFocusPosition(payload);
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -68334,7 +68334,12 @@ class ExchangePosition {
|
|
|
68334
68334
|
};
|
|
68335
68335
|
}
|
|
68336
68336
|
async increasePositionAtStop(payload) {
|
|
68337
|
-
const {
|
|
68337
|
+
const {
|
|
68338
|
+
place = false,
|
|
68339
|
+
increase = true,
|
|
68340
|
+
ratio_to_loose = 0,
|
|
68341
|
+
reverse_position
|
|
68342
|
+
} = payload;
|
|
68338
68343
|
const position2 = this.instance;
|
|
68339
68344
|
console.log(position2);
|
|
68340
68345
|
let price_params = {
|
|
@@ -68362,6 +68367,10 @@ class ExchangePosition {
|
|
|
68362
68367
|
});
|
|
68363
68368
|
}
|
|
68364
68369
|
}
|
|
68370
|
+
const _pnl = determine_pnl(position2.entry, price_params.price, price_params.quantity, this.kind);
|
|
68371
|
+
if (_pnl > 0 && ratio_to_loose) {
|
|
68372
|
+
await reverse_position.lockReduction({ pnl: _pnl * ratio_to_loose });
|
|
68373
|
+
}
|
|
68365
68374
|
return await this.exchange.customStopLoss({
|
|
68366
68375
|
symbol: this.symbol,
|
|
68367
68376
|
kind: this.kind,
|
|
@@ -68374,6 +68383,24 @@ class ExchangePosition {
|
|
|
68374
68383
|
});
|
|
68375
68384
|
}
|
|
68376
68385
|
}
|
|
68386
|
+
async lockReduction({
|
|
68387
|
+
pnl,
|
|
68388
|
+
place = true,
|
|
68389
|
+
pause_tp = true
|
|
68390
|
+
}) {
|
|
68391
|
+
if (pnl > 0 && this.instance.quantity > 0) {
|
|
68392
|
+
const diff = pnl / this.instance.quantity;
|
|
68393
|
+
const tp_price = this.kind === "long" ? diff + this.instance.entry : this.instance.entry - diff;
|
|
68394
|
+
return this.exchange_account.justInTimeProfit({
|
|
68395
|
+
symbol: this.symbol,
|
|
68396
|
+
kind: this.kind,
|
|
68397
|
+
take_profit: tp_price,
|
|
68398
|
+
target_pnl: pnl,
|
|
68399
|
+
place,
|
|
68400
|
+
pause_tp
|
|
68401
|
+
});
|
|
68402
|
+
}
|
|
68403
|
+
}
|
|
68377
68404
|
async placeSingleOrder(payload) {
|
|
68378
68405
|
const { long_position, short_position } = payload;
|
|
68379
68406
|
const kind = this.kind;
|
|
@@ -69425,8 +69452,16 @@ class ExchangeAccount {
|
|
|
69425
69452
|
});
|
|
69426
69453
|
}
|
|
69427
69454
|
async increasePositionAtStop(payload) {
|
|
69455
|
+
const { symbol, kind } = payload;
|
|
69456
|
+
const reverse_position = await this.getFocusPosition({
|
|
69457
|
+
symbol,
|
|
69458
|
+
kind: kind === "long" ? "short" : "long"
|
|
69459
|
+
});
|
|
69428
69460
|
const focus_position = await this.getFocusPosition(payload);
|
|
69429
|
-
return await focus_position.increasePositionAtStop(
|
|
69461
|
+
return await focus_position.increasePositionAtStop({
|
|
69462
|
+
...payload,
|
|
69463
|
+
reverse_position
|
|
69464
|
+
});
|
|
69430
69465
|
}
|
|
69431
69466
|
async triggerTradeFromConfig(payload) {
|
|
69432
69467
|
const focus_position = await this.getFocusPosition(payload);
|
package/dist/mcp-server.js
CHANGED
|
@@ -68307,7 +68307,12 @@ class ExchangePosition {
|
|
|
68307
68307
|
};
|
|
68308
68308
|
}
|
|
68309
68309
|
async increasePositionAtStop(payload) {
|
|
68310
|
-
const {
|
|
68310
|
+
const {
|
|
68311
|
+
place = false,
|
|
68312
|
+
increase = true,
|
|
68313
|
+
ratio_to_loose = 0,
|
|
68314
|
+
reverse_position
|
|
68315
|
+
} = payload;
|
|
68311
68316
|
const position2 = this.instance;
|
|
68312
68317
|
console.log(position2);
|
|
68313
68318
|
let price_params = {
|
|
@@ -68335,6 +68340,10 @@ class ExchangePosition {
|
|
|
68335
68340
|
});
|
|
68336
68341
|
}
|
|
68337
68342
|
}
|
|
68343
|
+
const _pnl = determine_pnl(position2.entry, price_params.price, price_params.quantity, this.kind);
|
|
68344
|
+
if (_pnl > 0 && ratio_to_loose) {
|
|
68345
|
+
await reverse_position.lockReduction({ pnl: _pnl * ratio_to_loose });
|
|
68346
|
+
}
|
|
68338
68347
|
return await this.exchange.customStopLoss({
|
|
68339
68348
|
symbol: this.symbol,
|
|
68340
68349
|
kind: this.kind,
|
|
@@ -68347,6 +68356,24 @@ class ExchangePosition {
|
|
|
68347
68356
|
});
|
|
68348
68357
|
}
|
|
68349
68358
|
}
|
|
68359
|
+
async lockReduction({
|
|
68360
|
+
pnl,
|
|
68361
|
+
place = true,
|
|
68362
|
+
pause_tp = true
|
|
68363
|
+
}) {
|
|
68364
|
+
if (pnl > 0 && this.instance.quantity > 0) {
|
|
68365
|
+
const diff = pnl / this.instance.quantity;
|
|
68366
|
+
const tp_price = this.kind === "long" ? diff + this.instance.entry : this.instance.entry - diff;
|
|
68367
|
+
return this.exchange_account.justInTimeProfit({
|
|
68368
|
+
symbol: this.symbol,
|
|
68369
|
+
kind: this.kind,
|
|
68370
|
+
take_profit: tp_price,
|
|
68371
|
+
target_pnl: pnl,
|
|
68372
|
+
place,
|
|
68373
|
+
pause_tp
|
|
68374
|
+
});
|
|
68375
|
+
}
|
|
68376
|
+
}
|
|
68350
68377
|
async placeSingleOrder(payload) {
|
|
68351
68378
|
const { long_position, short_position } = payload;
|
|
68352
68379
|
const kind = this.kind;
|
|
@@ -69398,8 +69425,16 @@ class ExchangeAccount {
|
|
|
69398
69425
|
});
|
|
69399
69426
|
}
|
|
69400
69427
|
async increasePositionAtStop(payload) {
|
|
69428
|
+
const { symbol, kind } = payload;
|
|
69429
|
+
const reverse_position = await this.getFocusPosition({
|
|
69430
|
+
symbol,
|
|
69431
|
+
kind: kind === "long" ? "short" : "long"
|
|
69432
|
+
});
|
|
69401
69433
|
const focus_position = await this.getFocusPosition(payload);
|
|
69402
|
-
return await focus_position.increasePositionAtStop(
|
|
69434
|
+
return await focus_position.increasePositionAtStop({
|
|
69435
|
+
...payload,
|
|
69436
|
+
reverse_position
|
|
69437
|
+
});
|
|
69403
69438
|
}
|
|
69404
69439
|
async triggerTradeFromConfig(payload) {
|
|
69405
69440
|
const focus_position = await this.getFocusPosition(payload);
|