@gbozee/ultimate 0.0.2-204 → 0.0.2-207
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 +170 -6
- package/dist/frontend-index.js +96 -25
- package/dist/index.cjs +164 -32
- package/dist/index.d.ts +224 -7
- package/dist/index.js +164 -32
- package/dist/mcp-server.cjs +164 -32
- package/dist/mcp-server.js +164 -32
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55810,6 +55810,7 @@ class Signal {
|
|
|
55810
55810
|
budget;
|
|
55811
55811
|
percent_change = 0.02;
|
|
55812
55812
|
price_places = "%.5f";
|
|
55813
|
+
distribution_params = {};
|
|
55813
55814
|
decimal_places = "%.0f";
|
|
55814
55815
|
zone_risk = 1;
|
|
55815
55816
|
fee = 0.08 / 100;
|
|
@@ -55865,11 +55866,13 @@ class Signal {
|
|
|
55865
55866
|
kelly_minimum_risk = 0.2,
|
|
55866
55867
|
kelly_func = "theoretical",
|
|
55867
55868
|
full_distribution,
|
|
55868
|
-
max_quantity = 0.03
|
|
55869
|
+
max_quantity = 0.03,
|
|
55870
|
+
distribution_params = {}
|
|
55869
55871
|
}) {
|
|
55870
55872
|
if (full_distribution) {
|
|
55871
55873
|
this.distribution = full_distribution;
|
|
55872
55874
|
}
|
|
55875
|
+
this.distribution_params = distribution_params;
|
|
55873
55876
|
this.symbol = symbol;
|
|
55874
55877
|
this.minimum_size = minimum_size;
|
|
55875
55878
|
this.first_order_size = first_order_size;
|
|
@@ -55907,7 +55910,8 @@ class Signal {
|
|
|
55907
55910
|
risk,
|
|
55908
55911
|
no_of_trades = 1,
|
|
55909
55912
|
take_profit,
|
|
55910
|
-
distribution
|
|
55913
|
+
distribution,
|
|
55914
|
+
distribution_params = {}
|
|
55911
55915
|
}) {
|
|
55912
55916
|
let _stop_loss = stop_loss;
|
|
55913
55917
|
if (!_stop_loss && stop_percent) {
|
|
@@ -55931,7 +55935,8 @@ class Signal {
|
|
|
55931
55935
|
full_distribution: distribution ? {
|
|
55932
55936
|
...this.distribution,
|
|
55933
55937
|
[kind]: distribution
|
|
55934
|
-
} : undefined
|
|
55938
|
+
} : undefined,
|
|
55939
|
+
distribution_params
|
|
55935
55940
|
};
|
|
55936
55941
|
const instance = new Signal(derivedConfig);
|
|
55937
55942
|
if (kind === "short") {}
|
|
@@ -56159,7 +56164,8 @@ class Signal {
|
|
|
56159
56164
|
kind: _kind,
|
|
56160
56165
|
distribution,
|
|
56161
56166
|
risk_reward: this.risk_reward,
|
|
56162
|
-
price_places: this.price_places
|
|
56167
|
+
price_places: this.price_places,
|
|
56168
|
+
distribution_params: this.distribution_params
|
|
56163
56169
|
});
|
|
56164
56170
|
return entries.sort((a, b) => a - b);
|
|
56165
56171
|
}
|
|
@@ -56829,7 +56835,8 @@ function buildConfig(app_config, {
|
|
|
56829
56835
|
kelly_prediction_model = "exponential",
|
|
56830
56836
|
kelly_func = "theoretical",
|
|
56831
56837
|
min_avg_size = 0,
|
|
56832
|
-
distribution
|
|
56838
|
+
distribution,
|
|
56839
|
+
distribution_params
|
|
56833
56840
|
}) {
|
|
56834
56841
|
let fee = app_config.fee / 100;
|
|
56835
56842
|
let working_risk = risk || app_config.risk_per_trade;
|
|
@@ -56860,7 +56867,8 @@ function buildConfig(app_config, {
|
|
|
56860
56867
|
kelly_prediction_model: kelly_prediction_model || app_config.kelly?.kelly_prediction_model,
|
|
56861
56868
|
kelly_func: kelly_func || app_config.kelly?.kelly_func,
|
|
56862
56869
|
symbol: app_config.symbol,
|
|
56863
|
-
max_quantity: app_config.max_quantity
|
|
56870
|
+
max_quantity: app_config.max_quantity,
|
|
56871
|
+
distribution_params: distribution_params || app_config.distribution_params
|
|
56864
56872
|
};
|
|
56865
56873
|
const instance = new Signal(config2);
|
|
56866
56874
|
if (raw_instance) {
|
|
@@ -56877,7 +56885,8 @@ function buildConfig(app_config, {
|
|
|
56877
56885
|
risk: working_risk,
|
|
56878
56886
|
kind: kind || app_config.kind,
|
|
56879
56887
|
no_of_trades: trade_no,
|
|
56880
|
-
distribution
|
|
56888
|
+
distribution,
|
|
56889
|
+
distribution_params
|
|
56881
56890
|
}) || [] : [];
|
|
56882
56891
|
const new_trades = computeTotalAverageForEachTrade(result, config2);
|
|
56883
56892
|
let filtered = new_trades.filter((o) => o.avg_size > min_avg_size);
|
|
@@ -56947,7 +56956,8 @@ function get_app_config_and_max_size(config2, payload) {
|
|
|
56947
56956
|
kelly_minimum_risk: payload.kelly_minimum_risk,
|
|
56948
56957
|
kelly_prediction_model: payload.kelly_prediction_model,
|
|
56949
56958
|
kelly_func: payload.kelly_func,
|
|
56950
|
-
distribution: payload.distribution
|
|
56959
|
+
distribution: payload.distribution,
|
|
56960
|
+
distribution_params: payload.distribution_params
|
|
56951
56961
|
});
|
|
56952
56962
|
const max_size = initialResult[0]?.avg_size;
|
|
56953
56963
|
const last_value = initialResult[0];
|
|
@@ -56986,7 +56996,8 @@ function buildAppConfig(config2, payload) {
|
|
|
56986
56996
|
kelly_minimum_risk: payload.kelly_minimum_risk,
|
|
56987
56997
|
kelly_prediction_model: payload.kelly_prediction_model,
|
|
56988
56998
|
kelly_func: payload.kelly_func,
|
|
56989
|
-
distribution: payload.distribution
|
|
56999
|
+
distribution: payload.distribution,
|
|
57000
|
+
distribution_params: payload.distribution_params
|
|
56990
57001
|
});
|
|
56991
57002
|
app_config.max_size = max_size;
|
|
56992
57003
|
app_config.entry = payload.entry || app_config.entry;
|
|
@@ -57000,10 +57011,12 @@ function buildAppConfig(config2, payload) {
|
|
|
57000
57011
|
kelly_prediction_model: payload.kelly_prediction_model,
|
|
57001
57012
|
kelly_func: payload.kelly_func
|
|
57002
57013
|
};
|
|
57014
|
+
app_config.distribution = payload.distribution;
|
|
57015
|
+
app_config.distribution_params = payload.distribution_params;
|
|
57003
57016
|
return app_config;
|
|
57004
57017
|
}
|
|
57005
57018
|
function getOptimumStopAndRisk(app_config, params) {
|
|
57006
|
-
const { max_size, target_stop, distribution } = params;
|
|
57019
|
+
const { max_size, target_stop, distribution, distribution_params: _distribution_params } = params;
|
|
57007
57020
|
const isLong = app_config.kind === "long";
|
|
57008
57021
|
const stopRange = Math.abs(app_config.entry - target_stop) * 0.5;
|
|
57009
57022
|
let low_stop = isLong ? target_stop - stopRange : Math.max(target_stop - stopRange, app_config.entry);
|
|
@@ -57027,7 +57040,8 @@ function getOptimumStopAndRisk(app_config, params) {
|
|
|
57027
57040
|
gap: app_config.gap,
|
|
57028
57041
|
price_places: app_config.price_places,
|
|
57029
57042
|
decimal_places: app_config.decimal_places,
|
|
57030
|
-
distribution
|
|
57043
|
+
distribution,
|
|
57044
|
+
distribution_params: _distribution_params
|
|
57031
57045
|
});
|
|
57032
57046
|
if (result.length === 0) {
|
|
57033
57047
|
if (isLong) {
|
|
@@ -57082,7 +57096,8 @@ function getOptimumStopAndRisk(app_config, params) {
|
|
|
57082
57096
|
gap: app_config.gap,
|
|
57083
57097
|
price_places: app_config.price_places,
|
|
57084
57098
|
decimal_places: app_config.decimal_places,
|
|
57085
|
-
distribution
|
|
57099
|
+
distribution,
|
|
57100
|
+
distribution_params: _distribution_params
|
|
57086
57101
|
});
|
|
57087
57102
|
if (result.length === 0) {
|
|
57088
57103
|
high_risk = mid_risk;
|
|
@@ -57128,7 +57143,8 @@ function getOptimumStopAndRisk(app_config, params) {
|
|
|
57128
57143
|
gap: app_config.gap,
|
|
57129
57144
|
price_places: app_config.price_places,
|
|
57130
57145
|
decimal_places: app_config.decimal_places,
|
|
57131
|
-
distribution
|
|
57146
|
+
distribution,
|
|
57147
|
+
distribution_params: _distribution_params
|
|
57132
57148
|
});
|
|
57133
57149
|
if (result.length === 0)
|
|
57134
57150
|
continue;
|
|
@@ -57349,7 +57365,8 @@ function determineOptimumReward(payload) {
|
|
|
57349
57365
|
kind: app_config.kind,
|
|
57350
57366
|
gap: app_config.gap,
|
|
57351
57367
|
decimal_places: app_config.decimal_places,
|
|
57352
|
-
distribution
|
|
57368
|
+
distribution,
|
|
57369
|
+
distribution_params: payload.distribution_params
|
|
57353
57370
|
});
|
|
57354
57371
|
let total = 0;
|
|
57355
57372
|
let max = -Infinity;
|
|
@@ -57538,6 +57555,7 @@ function computeRiskReward(payload) {
|
|
|
57538
57555
|
app_config,
|
|
57539
57556
|
target_loss,
|
|
57540
57557
|
distribution,
|
|
57558
|
+
distribution_params: payload.distribution_params,
|
|
57541
57559
|
high_range,
|
|
57542
57560
|
max_size
|
|
57543
57561
|
});
|
|
@@ -57562,7 +57580,8 @@ function getRiskReward(payload) {
|
|
|
57562
57580
|
risk_reward: 30,
|
|
57563
57581
|
risk,
|
|
57564
57582
|
symbol: global_config.symbol,
|
|
57565
|
-
distribution
|
|
57583
|
+
distribution,
|
|
57584
|
+
distribution_params: payload.distribution_params
|
|
57566
57585
|
});
|
|
57567
57586
|
const risk_reward = computeRiskReward({
|
|
57568
57587
|
app_config,
|
|
@@ -57572,6 +57591,7 @@ function getRiskReward(payload) {
|
|
|
57572
57591
|
high_range,
|
|
57573
57592
|
target_loss,
|
|
57574
57593
|
distribution,
|
|
57594
|
+
distribution_params: payload.distribution_params,
|
|
57575
57595
|
max_size
|
|
57576
57596
|
});
|
|
57577
57597
|
if (force_exact_risk) {
|
|
@@ -57581,7 +57601,8 @@ function getRiskReward(payload) {
|
|
|
57581
57601
|
risk_reward,
|
|
57582
57602
|
risk,
|
|
57583
57603
|
symbol: global_config.symbol,
|
|
57584
|
-
distribution
|
|
57604
|
+
distribution,
|
|
57605
|
+
distribution_params: payload.distribution_params
|
|
57585
57606
|
}, {
|
|
57586
57607
|
highest_risk: risk * risk_factor
|
|
57587
57608
|
}).optimal_risk;
|
|
@@ -58002,7 +58023,8 @@ function generateOppositeTradeConfig(payload) {
|
|
|
58002
58023
|
}
|
|
58003
58024
|
}
|
|
58004
58025
|
},
|
|
58005
|
-
global_config
|
|
58026
|
+
global_config,
|
|
58027
|
+
distribution_config: {}
|
|
58006
58028
|
});
|
|
58007
58029
|
const risk_reward = computeRiskReward({
|
|
58008
58030
|
app_config,
|
|
@@ -58019,7 +58041,7 @@ function generateOppositeTradeConfig(payload) {
|
|
|
58019
58041
|
};
|
|
58020
58042
|
}
|
|
58021
58043
|
function constructAppConfig(payload) {
|
|
58022
|
-
const { account, global_config, kelly_config } = payload;
|
|
58044
|
+
const { account, global_config, kelly_config, distribution_config } = payload;
|
|
58023
58045
|
const config2 = account.expand?.b_config;
|
|
58024
58046
|
if (!config2) {
|
|
58025
58047
|
return null;
|
|
@@ -58034,7 +58056,9 @@ function constructAppConfig(payload) {
|
|
|
58034
58056
|
use_kelly: kelly_config?.use_kelly ?? kelly?.use_kelly,
|
|
58035
58057
|
kelly_confidence_factor: kelly_config?.kelly_confidence_factor ?? kelly?.kelly_confidence_factor,
|
|
58036
58058
|
kelly_minimum_risk: kelly_config?.kelly_minimum_risk ?? kelly?.kelly_minimum_risk,
|
|
58037
|
-
kelly_prediction_model: kelly_config?.kelly_prediction_model ?? kelly?.kelly_prediction_model
|
|
58059
|
+
kelly_prediction_model: kelly_config?.kelly_prediction_model ?? kelly?.kelly_prediction_model,
|
|
58060
|
+
distribution: distribution_config?.distribution ?? config2?.distribution,
|
|
58061
|
+
distribution_params: distribution_config?.distribution_params ?? config2?.distribution_params
|
|
58038
58062
|
};
|
|
58039
58063
|
const { entries: _entries, ...appConfig } = buildAppConfig(global_config, options);
|
|
58040
58064
|
return appConfig;
|
|
@@ -58044,7 +58068,8 @@ function generateDangerousConfig(payload) {
|
|
|
58044
58068
|
const app_config = constructAppConfig({
|
|
58045
58069
|
account,
|
|
58046
58070
|
global_config,
|
|
58047
|
-
kelly_config: {}
|
|
58071
|
+
kelly_config: {},
|
|
58072
|
+
distribution_config: {}
|
|
58048
58073
|
});
|
|
58049
58074
|
const { optimal_risk, optimal_stop } = getOptimumStopAndRisk(app_config, {
|
|
58050
58075
|
max_size: config2.quantity,
|
|
@@ -58567,6 +58592,7 @@ class Strategy {
|
|
|
58567
58592
|
function buildTrades(payload) {
|
|
58568
58593
|
const { appConfig, settings, kind } = payload;
|
|
58569
58594
|
const kelly_config = settings.kelly;
|
|
58595
|
+
const distribution_params = settings.distribution_params;
|
|
58570
58596
|
const current_app_config = { ...appConfig[kind] };
|
|
58571
58597
|
const entryNum = parseFloat(settings.entry);
|
|
58572
58598
|
const stopNum = parseFloat(settings.stop);
|
|
@@ -58576,6 +58602,7 @@ function buildTrades(payload) {
|
|
|
58576
58602
|
current_app_config.risk_reward = parseFloat(settings.risk_reward);
|
|
58577
58603
|
current_app_config.kind = kind;
|
|
58578
58604
|
current_app_config.kelly = kelly_config;
|
|
58605
|
+
current_app_config.distribution_params = distribution_params;
|
|
58579
58606
|
const options = {
|
|
58580
58607
|
take_profit: null,
|
|
58581
58608
|
entry: current_app_config.entry,
|
|
@@ -58693,11 +58720,13 @@ function buildWithOptimumReward({
|
|
|
58693
58720
|
const risk = settings.risk;
|
|
58694
58721
|
const stop_ratio = settings.stop_ratio || 1;
|
|
58695
58722
|
const distribution = settings.distribution || config2?.distribution;
|
|
58723
|
+
const distribution_params = settings.distribution_params || config2?.distribution_params;
|
|
58696
58724
|
const custom_b_config = {
|
|
58697
58725
|
entry,
|
|
58698
58726
|
stop,
|
|
58699
58727
|
risk,
|
|
58700
|
-
distribution
|
|
58728
|
+
distribution,
|
|
58729
|
+
distribution_params
|
|
58701
58730
|
};
|
|
58702
58731
|
const appConfig = constructAppConfig2({
|
|
58703
58732
|
config: config2,
|
|
@@ -58747,6 +58776,7 @@ function generateOppositeOptimum({
|
|
|
58747
58776
|
settings,
|
|
58748
58777
|
ratio = 1,
|
|
58749
58778
|
distribution,
|
|
58779
|
+
distribution_params,
|
|
58750
58780
|
risk_factor = 1
|
|
58751
58781
|
}) {
|
|
58752
58782
|
const configKind = config2.entry > config2.stop ? "long" : "short";
|
|
@@ -58767,6 +58797,7 @@ function generateOppositeOptimum({
|
|
|
58767
58797
|
stop: settings.stop,
|
|
58768
58798
|
risk: risk * ratio,
|
|
58769
58799
|
distribution: distribution || "inverse-exponential",
|
|
58800
|
+
distribution_params: distribution_params || config2?.distribution_params,
|
|
58770
58801
|
risk_factor
|
|
58771
58802
|
};
|
|
58772
58803
|
const appConfig = constructAppConfig2({
|
|
@@ -58853,11 +58884,13 @@ function increaseTradeHelper({
|
|
|
58853
58884
|
entry,
|
|
58854
58885
|
position: position2,
|
|
58855
58886
|
stop_ratio = 1,
|
|
58856
|
-
distribution: default_distribution
|
|
58887
|
+
distribution: default_distribution,
|
|
58888
|
+
distribution_params: default_distribution_params
|
|
58857
58889
|
}) {
|
|
58858
58890
|
const symbol_config = global_config;
|
|
58859
58891
|
const kind = config2.entry > config2.stop ? "long" : "short";
|
|
58860
58892
|
const distribution = default_distribution || config2.distribution || "inverse-exponential";
|
|
58893
|
+
const distribution_params = default_distribution_params || config2.distribution_params;
|
|
58861
58894
|
const appConfig = constructAppConfig2({
|
|
58862
58895
|
config: config2,
|
|
58863
58896
|
global_config
|
|
@@ -58884,7 +58917,8 @@ function increaseTradeHelper({
|
|
|
58884
58917
|
entry,
|
|
58885
58918
|
stop,
|
|
58886
58919
|
risk: style === "minimum" ? Math.abs(neg_pnl) : optimal_risk,
|
|
58887
|
-
distribution
|
|
58920
|
+
distribution,
|
|
58921
|
+
distribution_params
|
|
58888
58922
|
};
|
|
58889
58923
|
const { result, trades, summary } = helperFuncToBuildTrades({
|
|
58890
58924
|
custom_b_config,
|
|
@@ -58953,7 +58987,8 @@ function generatePositionIncreaseTrade({
|
|
|
58953
58987
|
config: config2,
|
|
58954
58988
|
global_config,
|
|
58955
58989
|
style = "minimum",
|
|
58956
|
-
distribution = "inverse-exponential"
|
|
58990
|
+
distribution = "inverse-exponential",
|
|
58991
|
+
distribution_params
|
|
58957
58992
|
}) {
|
|
58958
58993
|
const kind = config2.entry > config2.stop ? "long" : "short";
|
|
58959
58994
|
const target_max_quantity = kind === "long" ? account.short.quantity : account.long.quantity;
|
|
@@ -58968,10 +59003,46 @@ function generatePositionIncreaseTrade({
|
|
|
58968
59003
|
stop,
|
|
58969
59004
|
style,
|
|
58970
59005
|
increase_qty,
|
|
58971
|
-
distribution
|
|
59006
|
+
distribution,
|
|
59007
|
+
distribution_params
|
|
58972
59008
|
});
|
|
58973
59009
|
}
|
|
59010
|
+
function determineHedgeTradeToPlace({
|
|
59011
|
+
position: position2,
|
|
59012
|
+
config: config2,
|
|
59013
|
+
global_config,
|
|
59014
|
+
profit_risk = 200,
|
|
59015
|
+
allowable_loss = 1000
|
|
59016
|
+
}) {
|
|
59017
|
+
const diff = profit_risk / position2.quantity;
|
|
59018
|
+
const kind = position2.kind === "long" ? "short" : "long";
|
|
59019
|
+
const tp_price = position2.kind === "long" ? diff + position2.entry : position2.entry - diff;
|
|
59020
|
+
const loss_diff = allowable_loss / position2.quantity;
|
|
59021
|
+
const loss_price = position2.kind === "long" ? position2.entry - loss_diff : position2.entry + loss_diff;
|
|
59022
|
+
const entry = kind === "short" ? loss_price : tp_price;
|
|
59023
|
+
const stop = kind === "short" ? tp_price : loss_price;
|
|
59024
|
+
const result = buildWithOptimumReward({
|
|
59025
|
+
config: {
|
|
59026
|
+
...config2,
|
|
59027
|
+
entry,
|
|
59028
|
+
stop
|
|
59029
|
+
},
|
|
59030
|
+
global_config,
|
|
59031
|
+
force_exact: true,
|
|
59032
|
+
settings: {
|
|
59033
|
+
entry,
|
|
59034
|
+
stop,
|
|
59035
|
+
risk: profit_risk,
|
|
59036
|
+
distribution: config2.distribution
|
|
59037
|
+
}
|
|
59038
|
+
});
|
|
59039
|
+
return {
|
|
59040
|
+
opposite: result,
|
|
59041
|
+
take_profit: to_f(tp_price, global_config.price_places)
|
|
59042
|
+
};
|
|
59043
|
+
}
|
|
58974
59044
|
var compoundAPI = {
|
|
59045
|
+
determineHedgeTradeToPlace,
|
|
58975
59046
|
buildWithOptimumReward,
|
|
58976
59047
|
constructAppConfig: constructAppConfig2,
|
|
58977
59048
|
generateOppositeOptimum,
|
|
@@ -58984,8 +59055,10 @@ class BaseExchange {
|
|
|
58984
59055
|
name;
|
|
58985
59056
|
getCredentials;
|
|
58986
59057
|
proxyAgent;
|
|
59058
|
+
remoteActionBaseUrl;
|
|
58987
59059
|
constructor(client) {
|
|
58988
59060
|
this.client = client;
|
|
59061
|
+
this.remoteActionBaseUrl = "https://app-dev.beeola.me";
|
|
58989
59062
|
}
|
|
58990
59063
|
async rawCreateLimitPurchaseOrders(payload) {
|
|
58991
59064
|
const { symbol, orders, price_places, decimal_places } = payload;
|
|
@@ -59319,6 +59392,51 @@ class BaseExchange {
|
|
|
59319
59392
|
setAccountDetails(payload) {
|
|
59320
59393
|
this.getCredentials = payload.getCredentials;
|
|
59321
59394
|
this.proxyAgent = payload.proxyAgent;
|
|
59395
|
+
if (payload.remoteActionBaseUrl) {
|
|
59396
|
+
this.remoteActionBaseUrl = payload.remoteActionBaseUrl;
|
|
59397
|
+
}
|
|
59398
|
+
}
|
|
59399
|
+
async getSymbolInformation(payload) {
|
|
59400
|
+
const { symbol, variant = "full" } = payload;
|
|
59401
|
+
if (!this.remoteActionBaseUrl) {
|
|
59402
|
+
throw new Error("Remote action base URL is not configured");
|
|
59403
|
+
}
|
|
59404
|
+
const url = `${this.remoteActionBaseUrl}/api/main_account/remote-actions`;
|
|
59405
|
+
const analysisType = variant === "short" ? "analyze_candlesticks_short" : "analyze_candlesticks";
|
|
59406
|
+
const requestPayload = {
|
|
59407
|
+
action: "base_model",
|
|
59408
|
+
symbol,
|
|
59409
|
+
name: "base_model",
|
|
59410
|
+
params: {
|
|
59411
|
+
args: [analysisType],
|
|
59412
|
+
kwargs: { symbol }
|
|
59413
|
+
}
|
|
59414
|
+
};
|
|
59415
|
+
try {
|
|
59416
|
+
const response = await fetch(url, {
|
|
59417
|
+
method: "POST",
|
|
59418
|
+
headers: {
|
|
59419
|
+
"Content-Type": "application/json"
|
|
59420
|
+
},
|
|
59421
|
+
body: JSON.stringify(requestPayload)
|
|
59422
|
+
});
|
|
59423
|
+
if (!response.ok) {
|
|
59424
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
59425
|
+
}
|
|
59426
|
+
const result = await response.json();
|
|
59427
|
+
const data = result.data;
|
|
59428
|
+
return {
|
|
59429
|
+
candlesticks: data.candlesticks || {},
|
|
59430
|
+
resistance: data.resistance || {},
|
|
59431
|
+
support: data.support || {},
|
|
59432
|
+
currentPrice: data.current_price || 0,
|
|
59433
|
+
minimumWeekly: data.minimum_weekly,
|
|
59434
|
+
lowest: data.lowest
|
|
59435
|
+
};
|
|
59436
|
+
} catch (error) {
|
|
59437
|
+
console.error("Error fetching symbol information:", error);
|
|
59438
|
+
throw error;
|
|
59439
|
+
}
|
|
59322
59440
|
}
|
|
59323
59441
|
}
|
|
59324
59442
|
|
|
@@ -61953,6 +62071,7 @@ class ExchangePosition {
|
|
|
61953
62071
|
if (condition) {
|
|
61954
62072
|
let entry = payload.tp ? position2.entry || config2.entry : config2.entry;
|
|
61955
62073
|
const v = stop ? "place_stop_orders" : risky ? "dangerous_entry_orders" : "place_limit_orders";
|
|
62074
|
+
console.log("distribution_params", config2.distribution_params);
|
|
61956
62075
|
return await this.placeSharedOrder(v, {
|
|
61957
62076
|
entry,
|
|
61958
62077
|
stop: config2.stop,
|
|
@@ -61963,6 +62082,7 @@ class ExchangePosition {
|
|
|
61963
62082
|
use_current,
|
|
61964
62083
|
stop_percent: config2.stop_percent || 100,
|
|
61965
62084
|
distribution: config2.distribution,
|
|
62085
|
+
distribution_params: config2.distribution_params,
|
|
61966
62086
|
hedge: payload.hedge,
|
|
61967
62087
|
stop_ratio
|
|
61968
62088
|
});
|
|
@@ -61982,7 +62102,9 @@ class ExchangePosition {
|
|
|
61982
62102
|
kelly_confidence_factor: config2.kelly?.kelly_confidence_factor,
|
|
61983
62103
|
kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
|
|
61984
62104
|
kelly_prediction_model: config2.kelly?.kelly_prediction_model,
|
|
61985
|
-
kelly_func: config2.kelly?.kelly_func
|
|
62105
|
+
kelly_func: config2.kelly?.kelly_func,
|
|
62106
|
+
distribution: payload.distribution || config2.distribution,
|
|
62107
|
+
distribution_params: payload.distribution_params || config2.distribution_params
|
|
61986
62108
|
});
|
|
61987
62109
|
const { entry_orders, stop_orders, trades } = await this.placeConfigOrders(app_config, {
|
|
61988
62110
|
risk_reward: payload.risk_reward,
|
|
@@ -61999,7 +62121,8 @@ class ExchangePosition {
|
|
|
61999
62121
|
kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
|
|
62000
62122
|
kelly_prediction_model: config2.kelly?.kelly_prediction_model,
|
|
62001
62123
|
kelly_func: config2.kelly?.kelly_func,
|
|
62002
|
-
distribution: config2.distribution
|
|
62124
|
+
distribution: config2.distribution,
|
|
62125
|
+
distribution_params: payload.distribution_params || config2.distribution_params
|
|
62003
62126
|
}, false);
|
|
62004
62127
|
if (payload.raw) {
|
|
62005
62128
|
let actual_orders_to_buy = await this.determineAmountToBuy({
|
|
@@ -62124,7 +62247,8 @@ class ExchangePosition {
|
|
|
62124
62247
|
kelly_minimum_risk: solution.kelly_minimum_risk,
|
|
62125
62248
|
kelly_prediction_model: solution.kelly_prediction_model,
|
|
62126
62249
|
kelly_func: solution.kelly_func,
|
|
62127
|
-
distribution: solution.distribution
|
|
62250
|
+
distribution: solution.distribution,
|
|
62251
|
+
distribution_params: solution.distribution_params
|
|
62128
62252
|
};
|
|
62129
62253
|
const trades = sortedBuildConfig(app_config, options);
|
|
62130
62254
|
const entry_orders = {
|
|
@@ -62559,7 +62683,9 @@ class ExchangePosition {
|
|
|
62559
62683
|
entry,
|
|
62560
62684
|
stop,
|
|
62561
62685
|
risk_reward,
|
|
62562
|
-
risk
|
|
62686
|
+
risk,
|
|
62687
|
+
distribution: db_config.distribution,
|
|
62688
|
+
distribution_params: db_config.distribution_params
|
|
62563
62689
|
});
|
|
62564
62690
|
let config2 = generate_config_params(app_config, {
|
|
62565
62691
|
entry,
|
|
@@ -62575,7 +62701,9 @@ class ExchangePosition {
|
|
|
62575
62701
|
risk_reward: config2.risk_reward,
|
|
62576
62702
|
risk: config2.risk,
|
|
62577
62703
|
profit: 0,
|
|
62578
|
-
update_db: false
|
|
62704
|
+
update_db: false,
|
|
62705
|
+
distribution: db_config.distribution,
|
|
62706
|
+
distribution_params: db_config.distribution_params
|
|
62579
62707
|
});
|
|
62580
62708
|
const { trades } = await this.placeConfigOrders(app_config2, {
|
|
62581
62709
|
risk_reward: config2.risk_reward,
|
|
@@ -62673,7 +62801,9 @@ class ExchangePosition {
|
|
|
62673
62801
|
entry: config2.entry,
|
|
62674
62802
|
stop: config2.stop,
|
|
62675
62803
|
risk_reward: config2.risk_reward,
|
|
62676
|
-
risk: risk || config2.risk
|
|
62804
|
+
risk: risk || config2.risk,
|
|
62805
|
+
distribution: config2.distribution,
|
|
62806
|
+
distribution_params: config2.distribution_params
|
|
62677
62807
|
});
|
|
62678
62808
|
const { trades } = await this.placeConfigOrders(app_config, {
|
|
62679
62809
|
risk_reward: config2.risk_reward,
|
|
@@ -62729,6 +62859,8 @@ class ExchangePosition {
|
|
|
62729
62859
|
kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
|
|
62730
62860
|
kelly_prediction_model: config2.kelly?.kelly_prediction_model,
|
|
62731
62861
|
kelly_func: config2.kelly?.kelly_func,
|
|
62862
|
+
distribution: config2.distribution,
|
|
62863
|
+
distribution_params: config2.distribution_params,
|
|
62732
62864
|
...override
|
|
62733
62865
|
});
|
|
62734
62866
|
return app_config;
|
|
@@ -63303,7 +63435,7 @@ class ExchangeAccount {
|
|
|
63303
63435
|
kind: "short"
|
|
63304
63436
|
});
|
|
63305
63437
|
const long_config = await long_position.getConfig();
|
|
63306
|
-
const short_config =
|
|
63438
|
+
const short_config = short_position.getInstance().expand.b_config;
|
|
63307
63439
|
const config2 = build_reduce_config({
|
|
63308
63440
|
account: this.instance,
|
|
63309
63441
|
symbol: payload.symbol,
|