@gbozee/ultimate 0.0.2-95 → 0.0.2-97
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/frontend-index.d.ts +11 -0
- package/dist/frontend-index.js +7 -2
- package/dist/index.cjs +15 -2
- package/dist/index.d.ts +13 -0
- package/dist/index.js +15 -2
- package/dist/mcp-server.cjs +15 -2
- package/dist/mcp-server.js +15 -2
- package/package.json +1 -1
package/dist/frontend-index.d.ts
CHANGED
|
@@ -418,10 +418,21 @@ export declare function computeProfitDetail(payload: {
|
|
|
418
418
|
avg_qty: number;
|
|
419
419
|
avg_price: number;
|
|
420
420
|
};
|
|
421
|
+
reverse_position: {
|
|
422
|
+
kind: "long" | "short";
|
|
423
|
+
avg_qty: number;
|
|
424
|
+
avg_price: number;
|
|
425
|
+
stop_loss: {
|
|
426
|
+
price: number;
|
|
427
|
+
quantity: number;
|
|
428
|
+
};
|
|
429
|
+
};
|
|
421
430
|
price_places?: string;
|
|
422
431
|
decimal_places?: string;
|
|
423
432
|
}): {
|
|
424
433
|
pnl: number;
|
|
434
|
+
loss: number;
|
|
435
|
+
original_pnl: number;
|
|
425
436
|
reward_factor: number;
|
|
426
437
|
profit_percent: number;
|
|
427
438
|
kind: "long" | "short";
|
package/dist/frontend-index.js
CHANGED
|
@@ -1767,7 +1767,8 @@ function computeProfitDetail(payload) {
|
|
|
1767
1767
|
strategy,
|
|
1768
1768
|
price_places = "%.1f",
|
|
1769
1769
|
reduce_position,
|
|
1770
|
-
decimal_places
|
|
1770
|
+
decimal_places,
|
|
1771
|
+
reverse_position
|
|
1771
1772
|
} = payload;
|
|
1772
1773
|
let reward_factor = strategy.reward_factor;
|
|
1773
1774
|
let risk = strategy.risk;
|
|
@@ -1787,8 +1788,12 @@ function computeProfitDetail(payload) {
|
|
|
1787
1788
|
const loss = Math.abs(reduce_position.entry - sell_price) * reduce_position.quantity;
|
|
1788
1789
|
const ratio = pnl / loss;
|
|
1789
1790
|
const quantity = to_f(reduce_position.quantity * ratio, decimal_places);
|
|
1791
|
+
const expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
1792
|
+
const new_pnl = to_f(pnl - expected_loss, "%.2f");
|
|
1790
1793
|
return {
|
|
1791
|
-
pnl,
|
|
1794
|
+
pnl: new_pnl,
|
|
1795
|
+
loss: to_f(expected_loss, "%.2f"),
|
|
1796
|
+
original_pnl: pnl,
|
|
1792
1797
|
reward_factor,
|
|
1793
1798
|
profit_percent,
|
|
1794
1799
|
kind: focus_position.kind,
|
package/dist/index.cjs
CHANGED
|
@@ -53847,7 +53847,8 @@ function computeProfitDetail(payload) {
|
|
|
53847
53847
|
strategy,
|
|
53848
53848
|
price_places = "%.1f",
|
|
53849
53849
|
reduce_position,
|
|
53850
|
-
decimal_places
|
|
53850
|
+
decimal_places,
|
|
53851
|
+
reverse_position
|
|
53851
53852
|
} = payload;
|
|
53852
53853
|
let reward_factor = strategy.reward_factor;
|
|
53853
53854
|
let risk = strategy.risk;
|
|
@@ -53867,8 +53868,12 @@ function computeProfitDetail(payload) {
|
|
|
53867
53868
|
const loss = Math.abs(reduce_position.entry - sell_price) * reduce_position.quantity;
|
|
53868
53869
|
const ratio = pnl / loss;
|
|
53869
53870
|
const quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
53871
|
+
const expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
53872
|
+
const new_pnl = to_f2(pnl - expected_loss, "%.2f");
|
|
53870
53873
|
return {
|
|
53871
|
-
pnl,
|
|
53874
|
+
pnl: new_pnl,
|
|
53875
|
+
loss: to_f2(expected_loss, "%.2f"),
|
|
53876
|
+
original_pnl: pnl,
|
|
53872
53877
|
reward_factor,
|
|
53873
53878
|
profit_percent,
|
|
53874
53879
|
kind: focus_position.kind,
|
|
@@ -59080,6 +59085,8 @@ class ExchangeAccount {
|
|
|
59080
59085
|
if (!focus_position) {
|
|
59081
59086
|
return;
|
|
59082
59087
|
}
|
|
59088
|
+
const reverse_kind = focus_position.kind === "long" ? "short" : "long";
|
|
59089
|
+
const reverse_position = positions.find((k) => k.kind === reverse_kind);
|
|
59083
59090
|
const strategy = focus_position?.expand?.account_strategy;
|
|
59084
59091
|
if (!strategy) {
|
|
59085
59092
|
return;
|
|
@@ -59104,6 +59111,12 @@ class ExchangeAccount {
|
|
|
59104
59111
|
avg_price: reduce_position.avg_price,
|
|
59105
59112
|
avg_qty: reduce_position.avg_qty
|
|
59106
59113
|
},
|
|
59114
|
+
reverse_position: {
|
|
59115
|
+
kind: reverse_position.kind,
|
|
59116
|
+
avg_price: reverse_position.avg_price,
|
|
59117
|
+
avg_qty: reverse_position.avg_qty,
|
|
59118
|
+
stop_loss: reverse_position.stop_loss
|
|
59119
|
+
},
|
|
59107
59120
|
price_places: symbol_config.price_places,
|
|
59108
59121
|
decimal_places: symbol_config.decimal_places
|
|
59109
59122
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1075,10 +1075,21 @@ export declare function computeProfitDetail(payload: {
|
|
|
1075
1075
|
avg_qty: number;
|
|
1076
1076
|
avg_price: number;
|
|
1077
1077
|
};
|
|
1078
|
+
reverse_position: {
|
|
1079
|
+
kind: "long" | "short";
|
|
1080
|
+
avg_qty: number;
|
|
1081
|
+
avg_price: number;
|
|
1082
|
+
stop_loss: {
|
|
1083
|
+
price: number;
|
|
1084
|
+
quantity: number;
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1078
1087
|
price_places?: string;
|
|
1079
1088
|
decimal_places?: string;
|
|
1080
1089
|
}): {
|
|
1081
1090
|
pnl: number;
|
|
1091
|
+
loss: number;
|
|
1092
|
+
original_pnl: number;
|
|
1082
1093
|
reward_factor: number;
|
|
1083
1094
|
profit_percent: number;
|
|
1084
1095
|
kind: "long" | "short";
|
|
@@ -1850,6 +1861,8 @@ declare class ExchangeAccount$1 {
|
|
|
1850
1861
|
reduce_position: PositionsView;
|
|
1851
1862
|
}): Promise<{
|
|
1852
1863
|
pnl: number;
|
|
1864
|
+
loss: number;
|
|
1865
|
+
original_pnl: number;
|
|
1853
1866
|
reward_factor: number;
|
|
1854
1867
|
profit_percent: number;
|
|
1855
1868
|
kind: "long" | "short";
|
package/dist/index.js
CHANGED
|
@@ -53801,7 +53801,8 @@ function computeProfitDetail(payload) {
|
|
|
53801
53801
|
strategy,
|
|
53802
53802
|
price_places = "%.1f",
|
|
53803
53803
|
reduce_position,
|
|
53804
|
-
decimal_places
|
|
53804
|
+
decimal_places,
|
|
53805
|
+
reverse_position
|
|
53805
53806
|
} = payload;
|
|
53806
53807
|
let reward_factor = strategy.reward_factor;
|
|
53807
53808
|
let risk = strategy.risk;
|
|
@@ -53821,8 +53822,12 @@ function computeProfitDetail(payload) {
|
|
|
53821
53822
|
const loss = Math.abs(reduce_position.entry - sell_price) * reduce_position.quantity;
|
|
53822
53823
|
const ratio = pnl / loss;
|
|
53823
53824
|
const quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
53825
|
+
const expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
53826
|
+
const new_pnl = to_f2(pnl - expected_loss, "%.2f");
|
|
53824
53827
|
return {
|
|
53825
|
-
pnl,
|
|
53828
|
+
pnl: new_pnl,
|
|
53829
|
+
loss: to_f2(expected_loss, "%.2f"),
|
|
53830
|
+
original_pnl: pnl,
|
|
53826
53831
|
reward_factor,
|
|
53827
53832
|
profit_percent,
|
|
53828
53833
|
kind: focus_position.kind,
|
|
@@ -59034,6 +59039,8 @@ class ExchangeAccount {
|
|
|
59034
59039
|
if (!focus_position) {
|
|
59035
59040
|
return;
|
|
59036
59041
|
}
|
|
59042
|
+
const reverse_kind = focus_position.kind === "long" ? "short" : "long";
|
|
59043
|
+
const reverse_position = positions.find((k) => k.kind === reverse_kind);
|
|
59037
59044
|
const strategy = focus_position?.expand?.account_strategy;
|
|
59038
59045
|
if (!strategy) {
|
|
59039
59046
|
return;
|
|
@@ -59058,6 +59065,12 @@ class ExchangeAccount {
|
|
|
59058
59065
|
avg_price: reduce_position.avg_price,
|
|
59059
59066
|
avg_qty: reduce_position.avg_qty
|
|
59060
59067
|
},
|
|
59068
|
+
reverse_position: {
|
|
59069
|
+
kind: reverse_position.kind,
|
|
59070
|
+
avg_price: reverse_position.avg_price,
|
|
59071
|
+
avg_qty: reverse_position.avg_qty,
|
|
59072
|
+
stop_loss: reverse_position.stop_loss
|
|
59073
|
+
},
|
|
59061
59074
|
price_places: symbol_config.price_places,
|
|
59062
59075
|
decimal_places: symbol_config.decimal_places
|
|
59063
59076
|
});
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -60537,7 +60537,8 @@ function computeProfitDetail(payload) {
|
|
|
60537
60537
|
strategy,
|
|
60538
60538
|
price_places = "%.1f",
|
|
60539
60539
|
reduce_position,
|
|
60540
|
-
decimal_places
|
|
60540
|
+
decimal_places,
|
|
60541
|
+
reverse_position
|
|
60541
60542
|
} = payload;
|
|
60542
60543
|
let reward_factor = strategy.reward_factor;
|
|
60543
60544
|
let risk = strategy.risk;
|
|
@@ -60557,8 +60558,12 @@ function computeProfitDetail(payload) {
|
|
|
60557
60558
|
const loss = Math.abs(reduce_position.entry - sell_price) * reduce_position.quantity;
|
|
60558
60559
|
const ratio = pnl / loss;
|
|
60559
60560
|
const quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
60561
|
+
const expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
60562
|
+
const new_pnl = to_f2(pnl - expected_loss, "%.2f");
|
|
60560
60563
|
return {
|
|
60561
|
-
pnl,
|
|
60564
|
+
pnl: new_pnl,
|
|
60565
|
+
loss: to_f2(expected_loss, "%.2f"),
|
|
60566
|
+
original_pnl: pnl,
|
|
60562
60567
|
reward_factor,
|
|
60563
60568
|
profit_percent,
|
|
60564
60569
|
kind: focus_position.kind,
|
|
@@ -65770,6 +65775,8 @@ class ExchangeAccount {
|
|
|
65770
65775
|
if (!focus_position) {
|
|
65771
65776
|
return;
|
|
65772
65777
|
}
|
|
65778
|
+
const reverse_kind = focus_position.kind === "long" ? "short" : "long";
|
|
65779
|
+
const reverse_position = positions.find((k) => k.kind === reverse_kind);
|
|
65773
65780
|
const strategy = focus_position?.expand?.account_strategy;
|
|
65774
65781
|
if (!strategy) {
|
|
65775
65782
|
return;
|
|
@@ -65794,6 +65801,12 @@ class ExchangeAccount {
|
|
|
65794
65801
|
avg_price: reduce_position.avg_price,
|
|
65795
65802
|
avg_qty: reduce_position.avg_qty
|
|
65796
65803
|
},
|
|
65804
|
+
reverse_position: {
|
|
65805
|
+
kind: reverse_position.kind,
|
|
65806
|
+
avg_price: reverse_position.avg_price,
|
|
65807
|
+
avg_qty: reverse_position.avg_qty,
|
|
65808
|
+
stop_loss: reverse_position.stop_loss
|
|
65809
|
+
},
|
|
65797
65810
|
price_places: symbol_config.price_places,
|
|
65798
65811
|
decimal_places: symbol_config.decimal_places
|
|
65799
65812
|
});
|
package/dist/mcp-server.js
CHANGED
|
@@ -60514,7 +60514,8 @@ function computeProfitDetail(payload) {
|
|
|
60514
60514
|
strategy,
|
|
60515
60515
|
price_places = "%.1f",
|
|
60516
60516
|
reduce_position,
|
|
60517
|
-
decimal_places
|
|
60517
|
+
decimal_places,
|
|
60518
|
+
reverse_position
|
|
60518
60519
|
} = payload;
|
|
60519
60520
|
let reward_factor = strategy.reward_factor;
|
|
60520
60521
|
let risk = strategy.risk;
|
|
@@ -60534,8 +60535,12 @@ function computeProfitDetail(payload) {
|
|
|
60534
60535
|
const loss = Math.abs(reduce_position.entry - sell_price) * reduce_position.quantity;
|
|
60535
60536
|
const ratio = pnl / loss;
|
|
60536
60537
|
const quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
60538
|
+
const expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
60539
|
+
const new_pnl = to_f2(pnl - expected_loss, "%.2f");
|
|
60537
60540
|
return {
|
|
60538
|
-
pnl,
|
|
60541
|
+
pnl: new_pnl,
|
|
60542
|
+
loss: to_f2(expected_loss, "%.2f"),
|
|
60543
|
+
original_pnl: pnl,
|
|
60539
60544
|
reward_factor,
|
|
60540
60545
|
profit_percent,
|
|
60541
60546
|
kind: focus_position.kind,
|
|
@@ -65747,6 +65752,8 @@ class ExchangeAccount {
|
|
|
65747
65752
|
if (!focus_position) {
|
|
65748
65753
|
return;
|
|
65749
65754
|
}
|
|
65755
|
+
const reverse_kind = focus_position.kind === "long" ? "short" : "long";
|
|
65756
|
+
const reverse_position = positions.find((k) => k.kind === reverse_kind);
|
|
65750
65757
|
const strategy = focus_position?.expand?.account_strategy;
|
|
65751
65758
|
if (!strategy) {
|
|
65752
65759
|
return;
|
|
@@ -65771,6 +65778,12 @@ class ExchangeAccount {
|
|
|
65771
65778
|
avg_price: reduce_position.avg_price,
|
|
65772
65779
|
avg_qty: reduce_position.avg_qty
|
|
65773
65780
|
},
|
|
65781
|
+
reverse_position: {
|
|
65782
|
+
kind: reverse_position.kind,
|
|
65783
|
+
avg_price: reverse_position.avg_price,
|
|
65784
|
+
avg_qty: reverse_position.avg_qty,
|
|
65785
|
+
stop_loss: reverse_position.stop_loss
|
|
65786
|
+
},
|
|
65774
65787
|
price_places: symbol_config.price_places,
|
|
65775
65788
|
decimal_places: symbol_config.decimal_places
|
|
65776
65789
|
});
|