@gbozee/ultimate 0.0.2-109 → 0.0.2-110
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 +19 -0
- package/dist/frontend-index.js +29 -0
- package/dist/index.cjs +41 -3
- package/dist/index.d.ts +19 -0
- package/dist/index.js +41 -3
- package/dist/mcp-server.cjs +12 -3
- package/dist/mcp-server.js +12 -3
- package/package.json +1 -1
package/dist/frontend-index.d.ts
CHANGED
|
@@ -531,6 +531,25 @@ export declare function determineRewardFactor(payload: {
|
|
|
531
531
|
minimum_pnl: number;
|
|
532
532
|
risk: number;
|
|
533
533
|
}): number;
|
|
534
|
+
export declare function getHedgeZone(payload: {
|
|
535
|
+
symbol_config: GlobalConfig;
|
|
536
|
+
risk: number;
|
|
537
|
+
position: {
|
|
538
|
+
kind: "long" | "short";
|
|
539
|
+
entry: number;
|
|
540
|
+
quantity: number;
|
|
541
|
+
tp: {
|
|
542
|
+
price: number;
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
reward_factor: number;
|
|
546
|
+
risk_factor?: number;
|
|
547
|
+
}): {
|
|
548
|
+
support: number;
|
|
549
|
+
resistance: number;
|
|
550
|
+
risk: number;
|
|
551
|
+
profit_percent: number;
|
|
552
|
+
};
|
|
534
553
|
export type StrategyPosition = {
|
|
535
554
|
entry: number;
|
|
536
555
|
quantity: number;
|
package/dist/frontend-index.js
CHANGED
|
@@ -1946,6 +1946,34 @@ function determineRewardFactor(payload) {
|
|
|
1946
1946
|
const quantity_ratio = quantity / avg_qty;
|
|
1947
1947
|
return to_f(reward_factor / quantity_ratio, "%.4f");
|
|
1948
1948
|
}
|
|
1949
|
+
function getHedgeZone(payload) {
|
|
1950
|
+
const {
|
|
1951
|
+
reward_factor,
|
|
1952
|
+
symbol_config,
|
|
1953
|
+
risk,
|
|
1954
|
+
position: position2,
|
|
1955
|
+
risk_factor = 1
|
|
1956
|
+
} = payload;
|
|
1957
|
+
const kind = position2.kind;
|
|
1958
|
+
const take_profit = position2.tp?.price;
|
|
1959
|
+
const tp_diff = Math.abs(take_profit - position2.entry);
|
|
1960
|
+
const quantity = position2.quantity;
|
|
1961
|
+
const diff = risk / quantity;
|
|
1962
|
+
let new_take_profit = kind === "long" ? to_f(position2.entry + diff, symbol_config.price_places) : to_f(position2.entry - diff, symbol_config.price_places);
|
|
1963
|
+
let base_factor = to_f(Math.max(tp_diff, diff) / (Math.min(tp_diff, diff) || 1), "%.3f");
|
|
1964
|
+
let factor = reward_factor || base_factor;
|
|
1965
|
+
const new_risk = risk * factor * risk_factor;
|
|
1966
|
+
const stop_loss_diff = new_risk / quantity;
|
|
1967
|
+
new_take_profit = kind === "long" ? to_f(position2.entry + stop_loss_diff, symbol_config.price_places) : to_f(position2.entry - stop_loss_diff, symbol_config.price_places);
|
|
1968
|
+
const stop_loss = kind === "long" ? to_f(position2.entry - stop_loss_diff, symbol_config.price_places) : to_f(position2.entry + stop_loss_diff, symbol_config.price_places);
|
|
1969
|
+
const profit_percent = new_risk * 100 / (position2.entry * position2.quantity);
|
|
1970
|
+
return {
|
|
1971
|
+
support: Math.min(new_take_profit, stop_loss),
|
|
1972
|
+
resistance: Math.max(new_take_profit, stop_loss),
|
|
1973
|
+
risk: to_f(new_risk, "%.2f"),
|
|
1974
|
+
profit_percent: to_f(profit_percent, "%.2f")
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1949
1977
|
// src/helpers/strategy.ts
|
|
1950
1978
|
class Strategy {
|
|
1951
1979
|
position;
|
|
@@ -2459,6 +2487,7 @@ export {
|
|
|
2459
2487
|
getRiskReward,
|
|
2460
2488
|
getParamForField,
|
|
2461
2489
|
getOptimumStopAndRisk,
|
|
2490
|
+
getHedgeZone,
|
|
2462
2491
|
getDecimalPlaces,
|
|
2463
2492
|
generate_config_params,
|
|
2464
2493
|
generateOptimumAppConfig,
|
package/dist/index.cjs
CHANGED
|
@@ -41894,6 +41894,7 @@ __export(exports_src, {
|
|
|
41894
41894
|
get_app_config_and_max_size: () => get_app_config_and_max_size,
|
|
41895
41895
|
getRiskReward: () => getRiskReward,
|
|
41896
41896
|
getOptimumStopAndRisk: () => getOptimumStopAndRisk,
|
|
41897
|
+
getHedgeZone: () => getHedgeZone,
|
|
41897
41898
|
generate_config_params: () => generate_config_params,
|
|
41898
41899
|
generateOptimumAppConfig: () => generateOptimumAppConfig,
|
|
41899
41900
|
generateGapTp: () => generateGapTp,
|
|
@@ -54166,6 +54167,34 @@ function determineRewardFactor(payload) {
|
|
|
54166
54167
|
const quantity_ratio = quantity / avg_qty;
|
|
54167
54168
|
return to_f2(reward_factor / quantity_ratio, "%.4f");
|
|
54168
54169
|
}
|
|
54170
|
+
function getHedgeZone(payload) {
|
|
54171
|
+
const {
|
|
54172
|
+
reward_factor,
|
|
54173
|
+
symbol_config,
|
|
54174
|
+
risk,
|
|
54175
|
+
position: position2,
|
|
54176
|
+
risk_factor = 1
|
|
54177
|
+
} = payload;
|
|
54178
|
+
const kind = position2.kind;
|
|
54179
|
+
const take_profit = position2.tp?.price;
|
|
54180
|
+
const tp_diff = Math.abs(take_profit - position2.entry);
|
|
54181
|
+
const quantity = position2.quantity;
|
|
54182
|
+
const diff = risk / quantity;
|
|
54183
|
+
let new_take_profit = kind === "long" ? to_f2(position2.entry + diff, symbol_config.price_places) : to_f2(position2.entry - diff, symbol_config.price_places);
|
|
54184
|
+
let base_factor = to_f2(Math.max(tp_diff, diff) / (Math.min(tp_diff, diff) || 1), "%.3f");
|
|
54185
|
+
let factor = reward_factor || base_factor;
|
|
54186
|
+
const new_risk = risk * factor * risk_factor;
|
|
54187
|
+
const stop_loss_diff = new_risk / quantity;
|
|
54188
|
+
new_take_profit = kind === "long" ? to_f2(position2.entry + stop_loss_diff, symbol_config.price_places) : to_f2(position2.entry - stop_loss_diff, symbol_config.price_places);
|
|
54189
|
+
const stop_loss = kind === "long" ? to_f2(position2.entry - stop_loss_diff, symbol_config.price_places) : to_f2(position2.entry + stop_loss_diff, symbol_config.price_places);
|
|
54190
|
+
const profit_percent = new_risk * 100 / (position2.entry * position2.quantity);
|
|
54191
|
+
return {
|
|
54192
|
+
support: Math.min(new_take_profit, stop_loss),
|
|
54193
|
+
resistance: Math.max(new_take_profit, stop_loss),
|
|
54194
|
+
risk: to_f2(new_risk, "%.2f"),
|
|
54195
|
+
profit_percent: to_f2(profit_percent, "%.2f")
|
|
54196
|
+
};
|
|
54197
|
+
}
|
|
54169
54198
|
|
|
54170
54199
|
// src/helpers/strategy.ts
|
|
54171
54200
|
class Strategy {
|
|
@@ -55348,13 +55377,21 @@ var emptyPosition = {
|
|
|
55348
55377
|
tp_quantity: 0,
|
|
55349
55378
|
stop_quantity: 0
|
|
55350
55379
|
};
|
|
55380
|
+
async function getLeverage(client, symbol) {
|
|
55381
|
+
const response = await client.getPositions({
|
|
55382
|
+
symbol
|
|
55383
|
+
});
|
|
55384
|
+
const leverage = response[0]?.leverage;
|
|
55385
|
+
return leverage ? to_f2(leverage, "%0f") : 0;
|
|
55386
|
+
}
|
|
55351
55387
|
async function fetchBinanceAccount(client, json, options) {
|
|
55352
|
-
const [position2, balance, orders, current_price, all_balances] = await Promise.all([
|
|
55388
|
+
const [position2, balance, orders, current_price, all_balances, leverage] = await Promise.all([
|
|
55353
55389
|
getPositionInfo(client, json.symbol),
|
|
55354
55390
|
getWalletBalance(client, json.symbol.toLowerCase().endsWith("usdt") ? "USDT" : "USDC"),
|
|
55355
55391
|
getOpenOrders(client, json.symbol),
|
|
55356
55392
|
getCurrentPrice(client, json.symbol),
|
|
55357
|
-
allWalletBalances(client)
|
|
55393
|
+
allWalletBalances(client),
|
|
55394
|
+
getLeverage(client, json.symbol)
|
|
55358
55395
|
]);
|
|
55359
55396
|
const limitOrders = orders.filter((x) => !x.isStop).filter((o) => {
|
|
55360
55397
|
return o.kind === "long" ? o.side === "buy" : o.side === "sell";
|
|
@@ -55390,7 +55427,8 @@ async function fetchBinanceAccount(client, json, options) {
|
|
|
55390
55427
|
orders: limitOrders,
|
|
55391
55428
|
entries: [],
|
|
55392
55429
|
stop_orders: stopOrders,
|
|
55393
|
-
symbol: json.symbol
|
|
55430
|
+
symbol: json.symbol,
|
|
55431
|
+
leverage
|
|
55394
55432
|
};
|
|
55395
55433
|
result.config.trades = {
|
|
55396
55434
|
exchange_info: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1369,6 +1369,25 @@ export declare function determineRewardFactor(payload: {
|
|
|
1369
1369
|
minimum_pnl: number;
|
|
1370
1370
|
risk: number;
|
|
1371
1371
|
}): number;
|
|
1372
|
+
export declare function getHedgeZone(payload: {
|
|
1373
|
+
symbol_config: GlobalConfig;
|
|
1374
|
+
risk: number;
|
|
1375
|
+
position: {
|
|
1376
|
+
kind: "long" | "short";
|
|
1377
|
+
entry: number;
|
|
1378
|
+
quantity: number;
|
|
1379
|
+
tp: {
|
|
1380
|
+
price: number;
|
|
1381
|
+
};
|
|
1382
|
+
};
|
|
1383
|
+
reward_factor: number;
|
|
1384
|
+
risk_factor?: number;
|
|
1385
|
+
}): {
|
|
1386
|
+
support: number;
|
|
1387
|
+
resistance: number;
|
|
1388
|
+
risk: number;
|
|
1389
|
+
profit_percent: number;
|
|
1390
|
+
};
|
|
1372
1391
|
declare class ExchangePosition {
|
|
1373
1392
|
exchange: BaseExchange;
|
|
1374
1393
|
exchange_account: ExchangeAccount$1;
|
package/dist/index.js
CHANGED
|
@@ -54118,6 +54118,34 @@ function determineRewardFactor(payload) {
|
|
|
54118
54118
|
const quantity_ratio = quantity / avg_qty;
|
|
54119
54119
|
return to_f2(reward_factor / quantity_ratio, "%.4f");
|
|
54120
54120
|
}
|
|
54121
|
+
function getHedgeZone(payload) {
|
|
54122
|
+
const {
|
|
54123
|
+
reward_factor,
|
|
54124
|
+
symbol_config,
|
|
54125
|
+
risk,
|
|
54126
|
+
position: position2,
|
|
54127
|
+
risk_factor = 1
|
|
54128
|
+
} = payload;
|
|
54129
|
+
const kind = position2.kind;
|
|
54130
|
+
const take_profit = position2.tp?.price;
|
|
54131
|
+
const tp_diff = Math.abs(take_profit - position2.entry);
|
|
54132
|
+
const quantity = position2.quantity;
|
|
54133
|
+
const diff = risk / quantity;
|
|
54134
|
+
let new_take_profit = kind === "long" ? to_f2(position2.entry + diff, symbol_config.price_places) : to_f2(position2.entry - diff, symbol_config.price_places);
|
|
54135
|
+
let base_factor = to_f2(Math.max(tp_diff, diff) / (Math.min(tp_diff, diff) || 1), "%.3f");
|
|
54136
|
+
let factor = reward_factor || base_factor;
|
|
54137
|
+
const new_risk = risk * factor * risk_factor;
|
|
54138
|
+
const stop_loss_diff = new_risk / quantity;
|
|
54139
|
+
new_take_profit = kind === "long" ? to_f2(position2.entry + stop_loss_diff, symbol_config.price_places) : to_f2(position2.entry - stop_loss_diff, symbol_config.price_places);
|
|
54140
|
+
const stop_loss = kind === "long" ? to_f2(position2.entry - stop_loss_diff, symbol_config.price_places) : to_f2(position2.entry + stop_loss_diff, symbol_config.price_places);
|
|
54141
|
+
const profit_percent = new_risk * 100 / (position2.entry * position2.quantity);
|
|
54142
|
+
return {
|
|
54143
|
+
support: Math.min(new_take_profit, stop_loss),
|
|
54144
|
+
resistance: Math.max(new_take_profit, stop_loss),
|
|
54145
|
+
risk: to_f2(new_risk, "%.2f"),
|
|
54146
|
+
profit_percent: to_f2(profit_percent, "%.2f")
|
|
54147
|
+
};
|
|
54148
|
+
}
|
|
54121
54149
|
|
|
54122
54150
|
// src/helpers/strategy.ts
|
|
54123
54151
|
class Strategy {
|
|
@@ -55300,13 +55328,21 @@ var emptyPosition = {
|
|
|
55300
55328
|
tp_quantity: 0,
|
|
55301
55329
|
stop_quantity: 0
|
|
55302
55330
|
};
|
|
55331
|
+
async function getLeverage(client, symbol) {
|
|
55332
|
+
const response = await client.getPositions({
|
|
55333
|
+
symbol
|
|
55334
|
+
});
|
|
55335
|
+
const leverage = response[0]?.leverage;
|
|
55336
|
+
return leverage ? to_f2(leverage, "%0f") : 0;
|
|
55337
|
+
}
|
|
55303
55338
|
async function fetchBinanceAccount(client, json, options) {
|
|
55304
|
-
const [position2, balance, orders, current_price, all_balances] = await Promise.all([
|
|
55339
|
+
const [position2, balance, orders, current_price, all_balances, leverage] = await Promise.all([
|
|
55305
55340
|
getPositionInfo(client, json.symbol),
|
|
55306
55341
|
getWalletBalance(client, json.symbol.toLowerCase().endsWith("usdt") ? "USDT" : "USDC"),
|
|
55307
55342
|
getOpenOrders(client, json.symbol),
|
|
55308
55343
|
getCurrentPrice(client, json.symbol),
|
|
55309
|
-
allWalletBalances(client)
|
|
55344
|
+
allWalletBalances(client),
|
|
55345
|
+
getLeverage(client, json.symbol)
|
|
55310
55346
|
]);
|
|
55311
55347
|
const limitOrders = orders.filter((x) => !x.isStop).filter((o) => {
|
|
55312
55348
|
return o.kind === "long" ? o.side === "buy" : o.side === "sell";
|
|
@@ -55342,7 +55378,8 @@ async function fetchBinanceAccount(client, json, options) {
|
|
|
55342
55378
|
orders: limitOrders,
|
|
55343
55379
|
entries: [],
|
|
55344
55380
|
stop_orders: stopOrders,
|
|
55345
|
-
symbol: json.symbol
|
|
55381
|
+
symbol: json.symbol,
|
|
55382
|
+
leverage
|
|
55346
55383
|
};
|
|
55347
55384
|
result.config.trades = {
|
|
55348
55385
|
exchange_info: {
|
|
@@ -60078,6 +60115,7 @@ export {
|
|
|
60078
60115
|
get_app_config_and_max_size,
|
|
60079
60116
|
getRiskReward,
|
|
60080
60117
|
getOptimumStopAndRisk,
|
|
60118
|
+
getHedgeZone,
|
|
60081
60119
|
generate_config_params,
|
|
60082
60120
|
generateOptimumAppConfig,
|
|
60083
60121
|
generateGapTp,
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -62030,13 +62030,21 @@ var emptyPosition = {
|
|
|
62030
62030
|
tp_quantity: 0,
|
|
62031
62031
|
stop_quantity: 0
|
|
62032
62032
|
};
|
|
62033
|
+
async function getLeverage(client, symbol) {
|
|
62034
|
+
const response = await client.getPositions({
|
|
62035
|
+
symbol
|
|
62036
|
+
});
|
|
62037
|
+
const leverage = response[0]?.leverage;
|
|
62038
|
+
return leverage ? to_f2(leverage, "%0f") : 0;
|
|
62039
|
+
}
|
|
62033
62040
|
async function fetchBinanceAccount(client, json, options) {
|
|
62034
|
-
const [position2, balance, orders, current_price, all_balances] = await Promise.all([
|
|
62041
|
+
const [position2, balance, orders, current_price, all_balances, leverage] = await Promise.all([
|
|
62035
62042
|
getPositionInfo(client, json.symbol),
|
|
62036
62043
|
getWalletBalance(client, json.symbol.toLowerCase().endsWith("usdt") ? "USDT" : "USDC"),
|
|
62037
62044
|
getOpenOrders(client, json.symbol),
|
|
62038
62045
|
getCurrentPrice(client, json.symbol),
|
|
62039
|
-
allWalletBalances(client)
|
|
62046
|
+
allWalletBalances(client),
|
|
62047
|
+
getLeverage(client, json.symbol)
|
|
62040
62048
|
]);
|
|
62041
62049
|
const limitOrders = orders.filter((x) => !x.isStop).filter((o) => {
|
|
62042
62050
|
return o.kind === "long" ? o.side === "buy" : o.side === "sell";
|
|
@@ -62072,7 +62080,8 @@ async function fetchBinanceAccount(client, json, options) {
|
|
|
62072
62080
|
orders: limitOrders,
|
|
62073
62081
|
entries: [],
|
|
62074
62082
|
stop_orders: stopOrders,
|
|
62075
|
-
symbol: json.symbol
|
|
62083
|
+
symbol: json.symbol,
|
|
62084
|
+
leverage
|
|
62076
62085
|
};
|
|
62077
62086
|
result.config.trades = {
|
|
62078
62087
|
exchange_info: {
|
package/dist/mcp-server.js
CHANGED
|
@@ -62007,13 +62007,21 @@ var emptyPosition = {
|
|
|
62007
62007
|
tp_quantity: 0,
|
|
62008
62008
|
stop_quantity: 0
|
|
62009
62009
|
};
|
|
62010
|
+
async function getLeverage(client, symbol) {
|
|
62011
|
+
const response = await client.getPositions({
|
|
62012
|
+
symbol
|
|
62013
|
+
});
|
|
62014
|
+
const leverage = response[0]?.leverage;
|
|
62015
|
+
return leverage ? to_f2(leverage, "%0f") : 0;
|
|
62016
|
+
}
|
|
62010
62017
|
async function fetchBinanceAccount(client, json, options) {
|
|
62011
|
-
const [position2, balance, orders, current_price, all_balances] = await Promise.all([
|
|
62018
|
+
const [position2, balance, orders, current_price, all_balances, leverage] = await Promise.all([
|
|
62012
62019
|
getPositionInfo(client, json.symbol),
|
|
62013
62020
|
getWalletBalance(client, json.symbol.toLowerCase().endsWith("usdt") ? "USDT" : "USDC"),
|
|
62014
62021
|
getOpenOrders(client, json.symbol),
|
|
62015
62022
|
getCurrentPrice(client, json.symbol),
|
|
62016
|
-
allWalletBalances(client)
|
|
62023
|
+
allWalletBalances(client),
|
|
62024
|
+
getLeverage(client, json.symbol)
|
|
62017
62025
|
]);
|
|
62018
62026
|
const limitOrders = orders.filter((x) => !x.isStop).filter((o) => {
|
|
62019
62027
|
return o.kind === "long" ? o.side === "buy" : o.side === "sell";
|
|
@@ -62049,7 +62057,8 @@ async function fetchBinanceAccount(client, json, options) {
|
|
|
62049
62057
|
orders: limitOrders,
|
|
62050
62058
|
entries: [],
|
|
62051
62059
|
stop_orders: stopOrders,
|
|
62052
|
-
symbol: json.symbol
|
|
62060
|
+
symbol: json.symbol,
|
|
62061
|
+
leverage
|
|
62053
62062
|
};
|
|
62054
62063
|
result.config.trades = {
|
|
62055
62064
|
exchange_info: {
|