@gbozee/ultimate 0.0.2-132 → 0.0.2-134
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 +3 -0
- package/dist/frontend-index.js +5 -1
- package/dist/index.cjs +11 -4
- package/dist/index.d.ts +6 -0
- package/dist/index.js +11 -4
- package/dist/mcp-server.cjs +11 -4
- package/dist/mcp-server.js +11 -4
- package/package.json +1 -1
package/dist/frontend-index.d.ts
CHANGED
|
@@ -491,11 +491,13 @@ export declare function computeProfitDetail(payload: {
|
|
|
491
491
|
quantity: number;
|
|
492
492
|
};
|
|
493
493
|
};
|
|
494
|
+
full_ratio?: number;
|
|
494
495
|
price_places?: string;
|
|
495
496
|
decimal_places?: string;
|
|
496
497
|
}): {
|
|
497
498
|
pnl: number;
|
|
498
499
|
loss: number;
|
|
500
|
+
full_loss: number;
|
|
499
501
|
original_pnl: number;
|
|
500
502
|
reward_factor: number;
|
|
501
503
|
profit_percent: number;
|
|
@@ -854,6 +856,7 @@ export declare class Strategy {
|
|
|
854
856
|
}): {
|
|
855
857
|
pnl: number;
|
|
856
858
|
loss: number;
|
|
859
|
+
full_loss: number;
|
|
857
860
|
original_pnl: number;
|
|
858
861
|
reward_factor: number;
|
|
859
862
|
profit_percent: number;
|
package/dist/frontend-index.js
CHANGED
|
@@ -1895,13 +1895,15 @@ function computeProfitDetail(payload) {
|
|
|
1895
1895
|
price_places = "%.1f",
|
|
1896
1896
|
reduce_position,
|
|
1897
1897
|
decimal_places,
|
|
1898
|
-
reverse_position
|
|
1898
|
+
reverse_position,
|
|
1899
|
+
full_ratio = 1
|
|
1899
1900
|
} = payload;
|
|
1900
1901
|
let reward_factor = strategy.reward_factor;
|
|
1901
1902
|
const profit_percent = to_f(pnl * 100 / (focus_position.avg_price * focus_position.avg_qty), "%.4f");
|
|
1902
1903
|
const diff = pnl / focus_position.quantity;
|
|
1903
1904
|
const sell_price = to_f(focus_position.kind === "long" ? focus_position.entry + diff : focus_position.entry - diff, price_places);
|
|
1904
1905
|
let loss = 0;
|
|
1906
|
+
let full_loss = 0;
|
|
1905
1907
|
let expected_loss = 0;
|
|
1906
1908
|
let quantity = 0;
|
|
1907
1909
|
let new_pnl = pnl;
|
|
@@ -1910,6 +1912,7 @@ function computeProfitDetail(payload) {
|
|
|
1910
1912
|
const ratio = pnl / loss;
|
|
1911
1913
|
quantity = to_f(reduce_position.quantity * ratio, decimal_places);
|
|
1912
1914
|
expected_loss = to_f(Math.abs(reduce_position.entry - sell_price) * quantity, "%.2f");
|
|
1915
|
+
full_loss = Math.abs(reduce_position.avg_price - sell_price) * reduce_position.avg_qty * full_ratio;
|
|
1913
1916
|
}
|
|
1914
1917
|
if (reverse_position) {
|
|
1915
1918
|
expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
@@ -1918,6 +1921,7 @@ function computeProfitDetail(payload) {
|
|
|
1918
1921
|
return {
|
|
1919
1922
|
pnl: new_pnl,
|
|
1920
1923
|
loss: to_f(expected_loss, "%.2f"),
|
|
1924
|
+
full_loss: to_f(full_loss, "%.2f"),
|
|
1921
1925
|
original_pnl: pnl,
|
|
1922
1926
|
reward_factor,
|
|
1923
1927
|
profit_percent,
|
package/dist/index.cjs
CHANGED
|
@@ -54232,13 +54232,15 @@ function computeProfitDetail(payload) {
|
|
|
54232
54232
|
price_places = "%.1f",
|
|
54233
54233
|
reduce_position,
|
|
54234
54234
|
decimal_places,
|
|
54235
|
-
reverse_position
|
|
54235
|
+
reverse_position,
|
|
54236
|
+
full_ratio = 1
|
|
54236
54237
|
} = payload;
|
|
54237
54238
|
let reward_factor = strategy.reward_factor;
|
|
54238
54239
|
const profit_percent = to_f2(pnl * 100 / (focus_position.avg_price * focus_position.avg_qty), "%.4f");
|
|
54239
54240
|
const diff = pnl / focus_position.quantity;
|
|
54240
54241
|
const sell_price = to_f2(focus_position.kind === "long" ? focus_position.entry + diff : focus_position.entry - diff, price_places);
|
|
54241
54242
|
let loss = 0;
|
|
54243
|
+
let full_loss = 0;
|
|
54242
54244
|
let expected_loss = 0;
|
|
54243
54245
|
let quantity = 0;
|
|
54244
54246
|
let new_pnl = pnl;
|
|
@@ -54247,6 +54249,7 @@ function computeProfitDetail(payload) {
|
|
|
54247
54249
|
const ratio = pnl / loss;
|
|
54248
54250
|
quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
54249
54251
|
expected_loss = to_f2(Math.abs(reduce_position.entry - sell_price) * quantity, "%.2f");
|
|
54252
|
+
full_loss = Math.abs(reduce_position.avg_price - sell_price) * reduce_position.avg_qty * full_ratio;
|
|
54250
54253
|
}
|
|
54251
54254
|
if (reverse_position) {
|
|
54252
54255
|
expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
@@ -54255,6 +54258,7 @@ function computeProfitDetail(payload) {
|
|
|
54255
54258
|
return {
|
|
54256
54259
|
pnl: new_pnl,
|
|
54257
54260
|
loss: to_f2(expected_loss, "%.2f"),
|
|
54261
|
+
full_loss: to_f2(full_loss, "%.2f"),
|
|
54258
54262
|
original_pnl: pnl,
|
|
54259
54263
|
reward_factor,
|
|
54260
54264
|
profit_percent,
|
|
@@ -60144,7 +60148,7 @@ class ExchangeAccount {
|
|
|
60144
60148
|
});
|
|
60145
60149
|
}
|
|
60146
60150
|
async getSellPriceFromStrategy(payload) {
|
|
60147
|
-
const { symbol, reduce_position, kind } = payload;
|
|
60151
|
+
const { symbol, reduce_position, kind, full_ratio = 1 } = payload;
|
|
60148
60152
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
60149
60153
|
symbol
|
|
60150
60154
|
});
|
|
@@ -60194,7 +60198,8 @@ class ExchangeAccount {
|
|
|
60194
60198
|
stop_loss: reverse_position.stop_loss
|
|
60195
60199
|
},
|
|
60196
60200
|
price_places: symbol_config.price_places,
|
|
60197
|
-
decimal_places: symbol_config.decimal_places
|
|
60201
|
+
decimal_places: symbol_config.decimal_places,
|
|
60202
|
+
full_ratio
|
|
60198
60203
|
});
|
|
60199
60204
|
}
|
|
60200
60205
|
async placeCompoundShortTrade(payload) {
|
|
@@ -60613,6 +60618,7 @@ class App {
|
|
|
60613
60618
|
kind,
|
|
60614
60619
|
place,
|
|
60615
60620
|
increase,
|
|
60621
|
+
full_ratio = 1,
|
|
60616
60622
|
cancel_limit = true
|
|
60617
60623
|
} = payload;
|
|
60618
60624
|
const main_exchange_account = await this.getExchangeAccount(main_account);
|
|
@@ -60626,7 +60632,8 @@ class App {
|
|
|
60626
60632
|
const result = await main_exchange_account.getSellPriceFromStrategy({
|
|
60627
60633
|
symbol: main_account.symbol,
|
|
60628
60634
|
reduce_position,
|
|
60629
|
-
kind: main_account.kind || reverse_kind
|
|
60635
|
+
kind: main_account.kind || reverse_kind,
|
|
60636
|
+
full_ratio
|
|
60630
60637
|
});
|
|
60631
60638
|
if (place) {
|
|
60632
60639
|
if (cancel_limit) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1017,6 +1017,7 @@ export declare class Strategy {
|
|
|
1017
1017
|
}): {
|
|
1018
1018
|
pnl: number;
|
|
1019
1019
|
loss: number;
|
|
1020
|
+
full_loss: number;
|
|
1020
1021
|
original_pnl: number;
|
|
1021
1022
|
reward_factor: number;
|
|
1022
1023
|
profit_percent: number;
|
|
@@ -1427,11 +1428,13 @@ export declare function computeProfitDetail(payload: {
|
|
|
1427
1428
|
quantity: number;
|
|
1428
1429
|
};
|
|
1429
1430
|
};
|
|
1431
|
+
full_ratio?: number;
|
|
1430
1432
|
price_places?: string;
|
|
1431
1433
|
decimal_places?: string;
|
|
1432
1434
|
}): {
|
|
1433
1435
|
pnl: number;
|
|
1434
1436
|
loss: number;
|
|
1437
|
+
full_loss: number;
|
|
1435
1438
|
original_pnl: number;
|
|
1436
1439
|
reward_factor: number;
|
|
1437
1440
|
profit_percent: number;
|
|
@@ -2384,9 +2387,11 @@ declare class ExchangeAccount$1 {
|
|
|
2384
2387
|
symbol: string;
|
|
2385
2388
|
reduce_position: PositionsView;
|
|
2386
2389
|
kind?: "long" | "short";
|
|
2390
|
+
full_ratio?: number;
|
|
2387
2391
|
}): Promise<{
|
|
2388
2392
|
pnl: number;
|
|
2389
2393
|
loss: number;
|
|
2394
|
+
full_loss: number;
|
|
2390
2395
|
original_pnl: number;
|
|
2391
2396
|
reward_factor: number;
|
|
2392
2397
|
profit_percent: number;
|
|
@@ -2632,6 +2637,7 @@ declare class App {
|
|
|
2632
2637
|
kind: "long" | "short";
|
|
2633
2638
|
place?: boolean;
|
|
2634
2639
|
increase?: boolean;
|
|
2640
|
+
full_ratio?: number;
|
|
2635
2641
|
cancel_limit?: boolean;
|
|
2636
2642
|
}): Promise<any>;
|
|
2637
2643
|
}
|
package/dist/index.js
CHANGED
|
@@ -54180,13 +54180,15 @@ function computeProfitDetail(payload) {
|
|
|
54180
54180
|
price_places = "%.1f",
|
|
54181
54181
|
reduce_position,
|
|
54182
54182
|
decimal_places,
|
|
54183
|
-
reverse_position
|
|
54183
|
+
reverse_position,
|
|
54184
|
+
full_ratio = 1
|
|
54184
54185
|
} = payload;
|
|
54185
54186
|
let reward_factor = strategy.reward_factor;
|
|
54186
54187
|
const profit_percent = to_f2(pnl * 100 / (focus_position.avg_price * focus_position.avg_qty), "%.4f");
|
|
54187
54188
|
const diff = pnl / focus_position.quantity;
|
|
54188
54189
|
const sell_price = to_f2(focus_position.kind === "long" ? focus_position.entry + diff : focus_position.entry - diff, price_places);
|
|
54189
54190
|
let loss = 0;
|
|
54191
|
+
let full_loss = 0;
|
|
54190
54192
|
let expected_loss = 0;
|
|
54191
54193
|
let quantity = 0;
|
|
54192
54194
|
let new_pnl = pnl;
|
|
@@ -54195,6 +54197,7 @@ function computeProfitDetail(payload) {
|
|
|
54195
54197
|
const ratio = pnl / loss;
|
|
54196
54198
|
quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
54197
54199
|
expected_loss = to_f2(Math.abs(reduce_position.entry - sell_price) * quantity, "%.2f");
|
|
54200
|
+
full_loss = Math.abs(reduce_position.avg_price - sell_price) * reduce_position.avg_qty * full_ratio;
|
|
54198
54201
|
}
|
|
54199
54202
|
if (reverse_position) {
|
|
54200
54203
|
expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
@@ -54203,6 +54206,7 @@ function computeProfitDetail(payload) {
|
|
|
54203
54206
|
return {
|
|
54204
54207
|
pnl: new_pnl,
|
|
54205
54208
|
loss: to_f2(expected_loss, "%.2f"),
|
|
54209
|
+
full_loss: to_f2(full_loss, "%.2f"),
|
|
54206
54210
|
original_pnl: pnl,
|
|
54207
54211
|
reward_factor,
|
|
54208
54212
|
profit_percent,
|
|
@@ -60092,7 +60096,7 @@ class ExchangeAccount {
|
|
|
60092
60096
|
});
|
|
60093
60097
|
}
|
|
60094
60098
|
async getSellPriceFromStrategy(payload) {
|
|
60095
|
-
const { symbol, reduce_position, kind } = payload;
|
|
60099
|
+
const { symbol, reduce_position, kind, full_ratio = 1 } = payload;
|
|
60096
60100
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
60097
60101
|
symbol
|
|
60098
60102
|
});
|
|
@@ -60142,7 +60146,8 @@ class ExchangeAccount {
|
|
|
60142
60146
|
stop_loss: reverse_position.stop_loss
|
|
60143
60147
|
},
|
|
60144
60148
|
price_places: symbol_config.price_places,
|
|
60145
|
-
decimal_places: symbol_config.decimal_places
|
|
60149
|
+
decimal_places: symbol_config.decimal_places,
|
|
60150
|
+
full_ratio
|
|
60146
60151
|
});
|
|
60147
60152
|
}
|
|
60148
60153
|
async placeCompoundShortTrade(payload) {
|
|
@@ -60561,6 +60566,7 @@ class App {
|
|
|
60561
60566
|
kind,
|
|
60562
60567
|
place,
|
|
60563
60568
|
increase,
|
|
60569
|
+
full_ratio = 1,
|
|
60564
60570
|
cancel_limit = true
|
|
60565
60571
|
} = payload;
|
|
60566
60572
|
const main_exchange_account = await this.getExchangeAccount(main_account);
|
|
@@ -60574,7 +60580,8 @@ class App {
|
|
|
60574
60580
|
const result = await main_exchange_account.getSellPriceFromStrategy({
|
|
60575
60581
|
symbol: main_account.symbol,
|
|
60576
60582
|
reduce_position,
|
|
60577
|
-
kind: main_account.kind || reverse_kind
|
|
60583
|
+
kind: main_account.kind || reverse_kind,
|
|
60584
|
+
full_ratio
|
|
60578
60585
|
});
|
|
60579
60586
|
if (place) {
|
|
60580
60587
|
if (cancel_limit) {
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -60914,13 +60914,15 @@ function computeProfitDetail(payload) {
|
|
|
60914
60914
|
price_places = "%.1f",
|
|
60915
60915
|
reduce_position,
|
|
60916
60916
|
decimal_places,
|
|
60917
|
-
reverse_position
|
|
60917
|
+
reverse_position,
|
|
60918
|
+
full_ratio = 1
|
|
60918
60919
|
} = payload;
|
|
60919
60920
|
let reward_factor = strategy.reward_factor;
|
|
60920
60921
|
const profit_percent = to_f2(pnl * 100 / (focus_position.avg_price * focus_position.avg_qty), "%.4f");
|
|
60921
60922
|
const diff = pnl / focus_position.quantity;
|
|
60922
60923
|
const sell_price = to_f2(focus_position.kind === "long" ? focus_position.entry + diff : focus_position.entry - diff, price_places);
|
|
60923
60924
|
let loss = 0;
|
|
60925
|
+
let full_loss = 0;
|
|
60924
60926
|
let expected_loss = 0;
|
|
60925
60927
|
let quantity = 0;
|
|
60926
60928
|
let new_pnl = pnl;
|
|
@@ -60929,6 +60931,7 @@ function computeProfitDetail(payload) {
|
|
|
60929
60931
|
const ratio = pnl / loss;
|
|
60930
60932
|
quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
60931
60933
|
expected_loss = to_f2(Math.abs(reduce_position.entry - sell_price) * quantity, "%.2f");
|
|
60934
|
+
full_loss = Math.abs(reduce_position.avg_price - sell_price) * reduce_position.avg_qty * full_ratio;
|
|
60932
60935
|
}
|
|
60933
60936
|
if (reverse_position) {
|
|
60934
60937
|
expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
@@ -60937,6 +60940,7 @@ function computeProfitDetail(payload) {
|
|
|
60937
60940
|
return {
|
|
60938
60941
|
pnl: new_pnl,
|
|
60939
60942
|
loss: to_f2(expected_loss, "%.2f"),
|
|
60943
|
+
full_loss: to_f2(full_loss, "%.2f"),
|
|
60940
60944
|
original_pnl: pnl,
|
|
60941
60945
|
reward_factor,
|
|
60942
60946
|
profit_percent,
|
|
@@ -66820,7 +66824,7 @@ class ExchangeAccount {
|
|
|
66820
66824
|
});
|
|
66821
66825
|
}
|
|
66822
66826
|
async getSellPriceFromStrategy(payload) {
|
|
66823
|
-
const { symbol, reduce_position, kind } = payload;
|
|
66827
|
+
const { symbol, reduce_position, kind, full_ratio = 1 } = payload;
|
|
66824
66828
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
66825
66829
|
symbol
|
|
66826
66830
|
});
|
|
@@ -66870,7 +66874,8 @@ class ExchangeAccount {
|
|
|
66870
66874
|
stop_loss: reverse_position.stop_loss
|
|
66871
66875
|
},
|
|
66872
66876
|
price_places: symbol_config.price_places,
|
|
66873
|
-
decimal_places: symbol_config.decimal_places
|
|
66877
|
+
decimal_places: symbol_config.decimal_places,
|
|
66878
|
+
full_ratio
|
|
66874
66879
|
});
|
|
66875
66880
|
}
|
|
66876
66881
|
async placeCompoundShortTrade(payload) {
|
|
@@ -67289,6 +67294,7 @@ class App {
|
|
|
67289
67294
|
kind,
|
|
67290
67295
|
place,
|
|
67291
67296
|
increase,
|
|
67297
|
+
full_ratio = 1,
|
|
67292
67298
|
cancel_limit = true
|
|
67293
67299
|
} = payload;
|
|
67294
67300
|
const main_exchange_account = await this.getExchangeAccount(main_account);
|
|
@@ -67302,7 +67308,8 @@ class App {
|
|
|
67302
67308
|
const result = await main_exchange_account.getSellPriceFromStrategy({
|
|
67303
67309
|
symbol: main_account.symbol,
|
|
67304
67310
|
reduce_position,
|
|
67305
|
-
kind: main_account.kind || reverse_kind
|
|
67311
|
+
kind: main_account.kind || reverse_kind,
|
|
67312
|
+
full_ratio
|
|
67306
67313
|
});
|
|
67307
67314
|
if (place) {
|
|
67308
67315
|
if (cancel_limit) {
|
package/dist/mcp-server.js
CHANGED
|
@@ -60891,13 +60891,15 @@ function computeProfitDetail(payload) {
|
|
|
60891
60891
|
price_places = "%.1f",
|
|
60892
60892
|
reduce_position,
|
|
60893
60893
|
decimal_places,
|
|
60894
|
-
reverse_position
|
|
60894
|
+
reverse_position,
|
|
60895
|
+
full_ratio = 1
|
|
60895
60896
|
} = payload;
|
|
60896
60897
|
let reward_factor = strategy.reward_factor;
|
|
60897
60898
|
const profit_percent = to_f2(pnl * 100 / (focus_position.avg_price * focus_position.avg_qty), "%.4f");
|
|
60898
60899
|
const diff = pnl / focus_position.quantity;
|
|
60899
60900
|
const sell_price = to_f2(focus_position.kind === "long" ? focus_position.entry + diff : focus_position.entry - diff, price_places);
|
|
60900
60901
|
let loss = 0;
|
|
60902
|
+
let full_loss = 0;
|
|
60901
60903
|
let expected_loss = 0;
|
|
60902
60904
|
let quantity = 0;
|
|
60903
60905
|
let new_pnl = pnl;
|
|
@@ -60906,6 +60908,7 @@ function computeProfitDetail(payload) {
|
|
|
60906
60908
|
const ratio = pnl / loss;
|
|
60907
60909
|
quantity = to_f2(reduce_position.quantity * ratio, decimal_places);
|
|
60908
60910
|
expected_loss = to_f2(Math.abs(reduce_position.entry - sell_price) * quantity, "%.2f");
|
|
60911
|
+
full_loss = Math.abs(reduce_position.avg_price - sell_price) * reduce_position.avg_qty * full_ratio;
|
|
60909
60912
|
}
|
|
60910
60913
|
if (reverse_position) {
|
|
60911
60914
|
expected_loss = Math.abs(reverse_position.avg_price - sell_price) * reverse_position.avg_qty;
|
|
@@ -60914,6 +60917,7 @@ function computeProfitDetail(payload) {
|
|
|
60914
60917
|
return {
|
|
60915
60918
|
pnl: new_pnl,
|
|
60916
60919
|
loss: to_f2(expected_loss, "%.2f"),
|
|
60920
|
+
full_loss: to_f2(full_loss, "%.2f"),
|
|
60917
60921
|
original_pnl: pnl,
|
|
60918
60922
|
reward_factor,
|
|
60919
60923
|
profit_percent,
|
|
@@ -66797,7 +66801,7 @@ class ExchangeAccount {
|
|
|
66797
66801
|
});
|
|
66798
66802
|
}
|
|
66799
66803
|
async getSellPriceFromStrategy(payload) {
|
|
66800
|
-
const { symbol, reduce_position, kind } = payload;
|
|
66804
|
+
const { symbol, reduce_position, kind, full_ratio = 1 } = payload;
|
|
66801
66805
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
66802
66806
|
symbol
|
|
66803
66807
|
});
|
|
@@ -66847,7 +66851,8 @@ class ExchangeAccount {
|
|
|
66847
66851
|
stop_loss: reverse_position.stop_loss
|
|
66848
66852
|
},
|
|
66849
66853
|
price_places: symbol_config.price_places,
|
|
66850
|
-
decimal_places: symbol_config.decimal_places
|
|
66854
|
+
decimal_places: symbol_config.decimal_places,
|
|
66855
|
+
full_ratio
|
|
66851
66856
|
});
|
|
66852
66857
|
}
|
|
66853
66858
|
async placeCompoundShortTrade(payload) {
|
|
@@ -67266,6 +67271,7 @@ class App {
|
|
|
67266
67271
|
kind,
|
|
67267
67272
|
place,
|
|
67268
67273
|
increase,
|
|
67274
|
+
full_ratio = 1,
|
|
67269
67275
|
cancel_limit = true
|
|
67270
67276
|
} = payload;
|
|
67271
67277
|
const main_exchange_account = await this.getExchangeAccount(main_account);
|
|
@@ -67279,7 +67285,8 @@ class App {
|
|
|
67279
67285
|
const result = await main_exchange_account.getSellPriceFromStrategy({
|
|
67280
67286
|
symbol: main_account.symbol,
|
|
67281
67287
|
reduce_position,
|
|
67282
|
-
kind: main_account.kind || reverse_kind
|
|
67288
|
+
kind: main_account.kind || reverse_kind,
|
|
67289
|
+
full_ratio
|
|
67283
67290
|
});
|
|
67284
67291
|
if (place) {
|
|
67285
67292
|
if (cancel_limit) {
|