@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/mcp-server.js
CHANGED
|
@@ -62532,6 +62532,7 @@ class Signal {
|
|
|
62532
62532
|
budget;
|
|
62533
62533
|
percent_change = 0.02;
|
|
62534
62534
|
price_places = "%.5f";
|
|
62535
|
+
distribution_params = {};
|
|
62535
62536
|
decimal_places = "%.0f";
|
|
62536
62537
|
zone_risk = 1;
|
|
62537
62538
|
fee = 0.08 / 100;
|
|
@@ -62587,11 +62588,13 @@ class Signal {
|
|
|
62587
62588
|
kelly_minimum_risk = 0.2,
|
|
62588
62589
|
kelly_func = "theoretical",
|
|
62589
62590
|
full_distribution,
|
|
62590
|
-
max_quantity = 0.03
|
|
62591
|
+
max_quantity = 0.03,
|
|
62592
|
+
distribution_params = {}
|
|
62591
62593
|
}) {
|
|
62592
62594
|
if (full_distribution) {
|
|
62593
62595
|
this.distribution = full_distribution;
|
|
62594
62596
|
}
|
|
62597
|
+
this.distribution_params = distribution_params;
|
|
62595
62598
|
this.symbol = symbol;
|
|
62596
62599
|
this.minimum_size = minimum_size;
|
|
62597
62600
|
this.first_order_size = first_order_size;
|
|
@@ -62629,7 +62632,8 @@ class Signal {
|
|
|
62629
62632
|
risk,
|
|
62630
62633
|
no_of_trades = 1,
|
|
62631
62634
|
take_profit,
|
|
62632
|
-
distribution
|
|
62635
|
+
distribution,
|
|
62636
|
+
distribution_params = {}
|
|
62633
62637
|
}) {
|
|
62634
62638
|
let _stop_loss = stop_loss;
|
|
62635
62639
|
if (!_stop_loss && stop_percent) {
|
|
@@ -62653,7 +62657,8 @@ class Signal {
|
|
|
62653
62657
|
full_distribution: distribution ? {
|
|
62654
62658
|
...this.distribution,
|
|
62655
62659
|
[kind]: distribution
|
|
62656
|
-
} : undefined
|
|
62660
|
+
} : undefined,
|
|
62661
|
+
distribution_params
|
|
62657
62662
|
};
|
|
62658
62663
|
const instance = new Signal(derivedConfig);
|
|
62659
62664
|
if (kind === "short") {}
|
|
@@ -62881,7 +62886,8 @@ class Signal {
|
|
|
62881
62886
|
kind: _kind,
|
|
62882
62887
|
distribution,
|
|
62883
62888
|
risk_reward: this.risk_reward,
|
|
62884
|
-
price_places: this.price_places
|
|
62889
|
+
price_places: this.price_places,
|
|
62890
|
+
distribution_params: this.distribution_params
|
|
62885
62891
|
});
|
|
62886
62892
|
return entries.sort((a, b) => a - b);
|
|
62887
62893
|
}
|
|
@@ -63551,7 +63557,8 @@ function buildConfig(app_config, {
|
|
|
63551
63557
|
kelly_prediction_model = "exponential",
|
|
63552
63558
|
kelly_func = "theoretical",
|
|
63553
63559
|
min_avg_size = 0,
|
|
63554
|
-
distribution
|
|
63560
|
+
distribution,
|
|
63561
|
+
distribution_params
|
|
63555
63562
|
}) {
|
|
63556
63563
|
let fee = app_config.fee / 100;
|
|
63557
63564
|
let working_risk = risk || app_config.risk_per_trade;
|
|
@@ -63582,7 +63589,8 @@ function buildConfig(app_config, {
|
|
|
63582
63589
|
kelly_prediction_model: kelly_prediction_model || app_config.kelly?.kelly_prediction_model,
|
|
63583
63590
|
kelly_func: kelly_func || app_config.kelly?.kelly_func,
|
|
63584
63591
|
symbol: app_config.symbol,
|
|
63585
|
-
max_quantity: app_config.max_quantity
|
|
63592
|
+
max_quantity: app_config.max_quantity,
|
|
63593
|
+
distribution_params: distribution_params || app_config.distribution_params
|
|
63586
63594
|
};
|
|
63587
63595
|
const instance = new Signal(config2);
|
|
63588
63596
|
if (raw_instance) {
|
|
@@ -63599,7 +63607,8 @@ function buildConfig(app_config, {
|
|
|
63599
63607
|
risk: working_risk,
|
|
63600
63608
|
kind: kind || app_config.kind,
|
|
63601
63609
|
no_of_trades: trade_no,
|
|
63602
|
-
distribution
|
|
63610
|
+
distribution,
|
|
63611
|
+
distribution_params
|
|
63603
63612
|
}) || [] : [];
|
|
63604
63613
|
const new_trades = computeTotalAverageForEachTrade(result, config2);
|
|
63605
63614
|
let filtered = new_trades.filter((o) => o.avg_size > min_avg_size);
|
|
@@ -63656,7 +63665,8 @@ function get_app_config_and_max_size(config2, payload) {
|
|
|
63656
63665
|
kelly_minimum_risk: payload.kelly_minimum_risk,
|
|
63657
63666
|
kelly_prediction_model: payload.kelly_prediction_model,
|
|
63658
63667
|
kelly_func: payload.kelly_func,
|
|
63659
|
-
distribution: payload.distribution
|
|
63668
|
+
distribution: payload.distribution,
|
|
63669
|
+
distribution_params: payload.distribution_params
|
|
63660
63670
|
});
|
|
63661
63671
|
const max_size = initialResult[0]?.avg_size;
|
|
63662
63672
|
const last_value = initialResult[0];
|
|
@@ -63695,7 +63705,8 @@ function buildAppConfig(config2, payload) {
|
|
|
63695
63705
|
kelly_minimum_risk: payload.kelly_minimum_risk,
|
|
63696
63706
|
kelly_prediction_model: payload.kelly_prediction_model,
|
|
63697
63707
|
kelly_func: payload.kelly_func,
|
|
63698
|
-
distribution: payload.distribution
|
|
63708
|
+
distribution: payload.distribution,
|
|
63709
|
+
distribution_params: payload.distribution_params
|
|
63699
63710
|
});
|
|
63700
63711
|
app_config.max_size = max_size;
|
|
63701
63712
|
app_config.entry = payload.entry || app_config.entry;
|
|
@@ -63709,10 +63720,12 @@ function buildAppConfig(config2, payload) {
|
|
|
63709
63720
|
kelly_prediction_model: payload.kelly_prediction_model,
|
|
63710
63721
|
kelly_func: payload.kelly_func
|
|
63711
63722
|
};
|
|
63723
|
+
app_config.distribution = payload.distribution;
|
|
63724
|
+
app_config.distribution_params = payload.distribution_params;
|
|
63712
63725
|
return app_config;
|
|
63713
63726
|
}
|
|
63714
63727
|
function getOptimumStopAndRisk(app_config, params) {
|
|
63715
|
-
const { max_size, target_stop, distribution } = params;
|
|
63728
|
+
const { max_size, target_stop, distribution, distribution_params: _distribution_params } = params;
|
|
63716
63729
|
const isLong = app_config.kind === "long";
|
|
63717
63730
|
const stopRange = Math.abs(app_config.entry - target_stop) * 0.5;
|
|
63718
63731
|
let low_stop = isLong ? target_stop - stopRange : Math.max(target_stop - stopRange, app_config.entry);
|
|
@@ -63736,7 +63749,8 @@ function getOptimumStopAndRisk(app_config, params) {
|
|
|
63736
63749
|
gap: app_config.gap,
|
|
63737
63750
|
price_places: app_config.price_places,
|
|
63738
63751
|
decimal_places: app_config.decimal_places,
|
|
63739
|
-
distribution
|
|
63752
|
+
distribution,
|
|
63753
|
+
distribution_params: _distribution_params
|
|
63740
63754
|
});
|
|
63741
63755
|
if (result.length === 0) {
|
|
63742
63756
|
if (isLong) {
|
|
@@ -63791,7 +63805,8 @@ function getOptimumStopAndRisk(app_config, params) {
|
|
|
63791
63805
|
gap: app_config.gap,
|
|
63792
63806
|
price_places: app_config.price_places,
|
|
63793
63807
|
decimal_places: app_config.decimal_places,
|
|
63794
|
-
distribution
|
|
63808
|
+
distribution,
|
|
63809
|
+
distribution_params: _distribution_params
|
|
63795
63810
|
});
|
|
63796
63811
|
if (result.length === 0) {
|
|
63797
63812
|
high_risk = mid_risk;
|
|
@@ -63837,7 +63852,8 @@ function getOptimumStopAndRisk(app_config, params) {
|
|
|
63837
63852
|
gap: app_config.gap,
|
|
63838
63853
|
price_places: app_config.price_places,
|
|
63839
63854
|
decimal_places: app_config.decimal_places,
|
|
63840
|
-
distribution
|
|
63855
|
+
distribution,
|
|
63856
|
+
distribution_params: _distribution_params
|
|
63841
63857
|
});
|
|
63842
63858
|
if (result.length === 0)
|
|
63843
63859
|
continue;
|
|
@@ -64058,7 +64074,8 @@ function determineOptimumReward(payload) {
|
|
|
64058
64074
|
kind: app_config.kind,
|
|
64059
64075
|
gap: app_config.gap,
|
|
64060
64076
|
decimal_places: app_config.decimal_places,
|
|
64061
|
-
distribution
|
|
64077
|
+
distribution,
|
|
64078
|
+
distribution_params: payload.distribution_params
|
|
64062
64079
|
});
|
|
64063
64080
|
let total = 0;
|
|
64064
64081
|
let max = -Infinity;
|
|
@@ -64247,6 +64264,7 @@ function computeRiskReward(payload) {
|
|
|
64247
64264
|
app_config,
|
|
64248
64265
|
target_loss,
|
|
64249
64266
|
distribution,
|
|
64267
|
+
distribution_params: payload.distribution_params,
|
|
64250
64268
|
high_range,
|
|
64251
64269
|
max_size
|
|
64252
64270
|
});
|
|
@@ -64271,7 +64289,8 @@ function getRiskReward(payload) {
|
|
|
64271
64289
|
risk_reward: 30,
|
|
64272
64290
|
risk,
|
|
64273
64291
|
symbol: global_config.symbol,
|
|
64274
|
-
distribution
|
|
64292
|
+
distribution,
|
|
64293
|
+
distribution_params: payload.distribution_params
|
|
64275
64294
|
});
|
|
64276
64295
|
const risk_reward = computeRiskReward({
|
|
64277
64296
|
app_config,
|
|
@@ -64281,6 +64300,7 @@ function getRiskReward(payload) {
|
|
|
64281
64300
|
high_range,
|
|
64282
64301
|
target_loss,
|
|
64283
64302
|
distribution,
|
|
64303
|
+
distribution_params: payload.distribution_params,
|
|
64284
64304
|
max_size
|
|
64285
64305
|
});
|
|
64286
64306
|
if (force_exact_risk) {
|
|
@@ -64290,7 +64310,8 @@ function getRiskReward(payload) {
|
|
|
64290
64310
|
risk_reward,
|
|
64291
64311
|
risk,
|
|
64292
64312
|
symbol: global_config.symbol,
|
|
64293
|
-
distribution
|
|
64313
|
+
distribution,
|
|
64314
|
+
distribution_params: payload.distribution_params
|
|
64294
64315
|
}, {
|
|
64295
64316
|
highest_risk: risk * risk_factor
|
|
64296
64317
|
}).optimal_risk;
|
|
@@ -64613,7 +64634,8 @@ function generateOppositeTradeConfig(payload) {
|
|
|
64613
64634
|
}
|
|
64614
64635
|
}
|
|
64615
64636
|
},
|
|
64616
|
-
global_config
|
|
64637
|
+
global_config,
|
|
64638
|
+
distribution_config: {}
|
|
64617
64639
|
});
|
|
64618
64640
|
const risk_reward = computeRiskReward({
|
|
64619
64641
|
app_config,
|
|
@@ -64630,7 +64652,7 @@ function generateOppositeTradeConfig(payload) {
|
|
|
64630
64652
|
};
|
|
64631
64653
|
}
|
|
64632
64654
|
function constructAppConfig(payload) {
|
|
64633
|
-
const { account, global_config, kelly_config } = payload;
|
|
64655
|
+
const { account, global_config, kelly_config, distribution_config } = payload;
|
|
64634
64656
|
const config2 = account.expand?.b_config;
|
|
64635
64657
|
if (!config2) {
|
|
64636
64658
|
return null;
|
|
@@ -64645,7 +64667,9 @@ function constructAppConfig(payload) {
|
|
|
64645
64667
|
use_kelly: kelly_config?.use_kelly ?? kelly?.use_kelly,
|
|
64646
64668
|
kelly_confidence_factor: kelly_config?.kelly_confidence_factor ?? kelly?.kelly_confidence_factor,
|
|
64647
64669
|
kelly_minimum_risk: kelly_config?.kelly_minimum_risk ?? kelly?.kelly_minimum_risk,
|
|
64648
|
-
kelly_prediction_model: kelly_config?.kelly_prediction_model ?? kelly?.kelly_prediction_model
|
|
64670
|
+
kelly_prediction_model: kelly_config?.kelly_prediction_model ?? kelly?.kelly_prediction_model,
|
|
64671
|
+
distribution: distribution_config?.distribution ?? config2?.distribution,
|
|
64672
|
+
distribution_params: distribution_config?.distribution_params ?? config2?.distribution_params
|
|
64649
64673
|
};
|
|
64650
64674
|
const { entries: _entries, ...appConfig } = buildAppConfig(global_config, options);
|
|
64651
64675
|
return appConfig;
|
|
@@ -64655,7 +64679,8 @@ function generateDangerousConfig(payload) {
|
|
|
64655
64679
|
const app_config = constructAppConfig({
|
|
64656
64680
|
account,
|
|
64657
64681
|
global_config,
|
|
64658
|
-
kelly_config: {}
|
|
64682
|
+
kelly_config: {},
|
|
64683
|
+
distribution_config: {}
|
|
64659
64684
|
});
|
|
64660
64685
|
const { optimal_risk, optimal_stop } = getOptimumStopAndRisk(app_config, {
|
|
64661
64686
|
max_size: config2.quantity,
|
|
@@ -65178,6 +65203,7 @@ class Strategy {
|
|
|
65178
65203
|
function buildTrades(payload) {
|
|
65179
65204
|
const { appConfig, settings, kind } = payload;
|
|
65180
65205
|
const kelly_config = settings.kelly;
|
|
65206
|
+
const distribution_params = settings.distribution_params;
|
|
65181
65207
|
const current_app_config = { ...appConfig[kind] };
|
|
65182
65208
|
const entryNum = parseFloat(settings.entry);
|
|
65183
65209
|
const stopNum = parseFloat(settings.stop);
|
|
@@ -65187,6 +65213,7 @@ function buildTrades(payload) {
|
|
|
65187
65213
|
current_app_config.risk_reward = parseFloat(settings.risk_reward);
|
|
65188
65214
|
current_app_config.kind = kind;
|
|
65189
65215
|
current_app_config.kelly = kelly_config;
|
|
65216
|
+
current_app_config.distribution_params = distribution_params;
|
|
65190
65217
|
const options = {
|
|
65191
65218
|
take_profit: null,
|
|
65192
65219
|
entry: current_app_config.entry,
|
|
@@ -65304,11 +65331,13 @@ function buildWithOptimumReward({
|
|
|
65304
65331
|
const risk = settings.risk;
|
|
65305
65332
|
const stop_ratio = settings.stop_ratio || 1;
|
|
65306
65333
|
const distribution = settings.distribution || config2?.distribution;
|
|
65334
|
+
const distribution_params = settings.distribution_params || config2?.distribution_params;
|
|
65307
65335
|
const custom_b_config = {
|
|
65308
65336
|
entry,
|
|
65309
65337
|
stop,
|
|
65310
65338
|
risk,
|
|
65311
|
-
distribution
|
|
65339
|
+
distribution,
|
|
65340
|
+
distribution_params
|
|
65312
65341
|
};
|
|
65313
65342
|
const appConfig = constructAppConfig2({
|
|
65314
65343
|
config: config2,
|
|
@@ -65358,6 +65387,7 @@ function generateOppositeOptimum({
|
|
|
65358
65387
|
settings,
|
|
65359
65388
|
ratio = 1,
|
|
65360
65389
|
distribution,
|
|
65390
|
+
distribution_params,
|
|
65361
65391
|
risk_factor = 1
|
|
65362
65392
|
}) {
|
|
65363
65393
|
const configKind = config2.entry > config2.stop ? "long" : "short";
|
|
@@ -65378,6 +65408,7 @@ function generateOppositeOptimum({
|
|
|
65378
65408
|
stop: settings.stop,
|
|
65379
65409
|
risk: risk * ratio,
|
|
65380
65410
|
distribution: distribution || "inverse-exponential",
|
|
65411
|
+
distribution_params: distribution_params || config2?.distribution_params,
|
|
65381
65412
|
risk_factor
|
|
65382
65413
|
};
|
|
65383
65414
|
const appConfig = constructAppConfig2({
|
|
@@ -65464,11 +65495,13 @@ function increaseTradeHelper({
|
|
|
65464
65495
|
entry,
|
|
65465
65496
|
position: position2,
|
|
65466
65497
|
stop_ratio = 1,
|
|
65467
|
-
distribution: default_distribution
|
|
65498
|
+
distribution: default_distribution,
|
|
65499
|
+
distribution_params: default_distribution_params
|
|
65468
65500
|
}) {
|
|
65469
65501
|
const symbol_config = global_config;
|
|
65470
65502
|
const kind = config2.entry > config2.stop ? "long" : "short";
|
|
65471
65503
|
const distribution = default_distribution || config2.distribution || "inverse-exponential";
|
|
65504
|
+
const distribution_params = default_distribution_params || config2.distribution_params;
|
|
65472
65505
|
const appConfig = constructAppConfig2({
|
|
65473
65506
|
config: config2,
|
|
65474
65507
|
global_config
|
|
@@ -65495,7 +65528,8 @@ function increaseTradeHelper({
|
|
|
65495
65528
|
entry,
|
|
65496
65529
|
stop,
|
|
65497
65530
|
risk: style === "minimum" ? Math.abs(neg_pnl) : optimal_risk,
|
|
65498
|
-
distribution
|
|
65531
|
+
distribution,
|
|
65532
|
+
distribution_params
|
|
65499
65533
|
};
|
|
65500
65534
|
const { result, trades, summary } = helperFuncToBuildTrades({
|
|
65501
65535
|
custom_b_config,
|
|
@@ -65564,7 +65598,8 @@ function generatePositionIncreaseTrade({
|
|
|
65564
65598
|
config: config2,
|
|
65565
65599
|
global_config,
|
|
65566
65600
|
style = "minimum",
|
|
65567
|
-
distribution = "inverse-exponential"
|
|
65601
|
+
distribution = "inverse-exponential",
|
|
65602
|
+
distribution_params
|
|
65568
65603
|
}) {
|
|
65569
65604
|
const kind = config2.entry > config2.stop ? "long" : "short";
|
|
65570
65605
|
const target_max_quantity = kind === "long" ? account.short.quantity : account.long.quantity;
|
|
@@ -65579,10 +65614,46 @@ function generatePositionIncreaseTrade({
|
|
|
65579
65614
|
stop,
|
|
65580
65615
|
style,
|
|
65581
65616
|
increase_qty,
|
|
65582
|
-
distribution
|
|
65617
|
+
distribution,
|
|
65618
|
+
distribution_params
|
|
65583
65619
|
});
|
|
65584
65620
|
}
|
|
65621
|
+
function determineHedgeTradeToPlace({
|
|
65622
|
+
position: position2,
|
|
65623
|
+
config: config2,
|
|
65624
|
+
global_config,
|
|
65625
|
+
profit_risk = 200,
|
|
65626
|
+
allowable_loss = 1000
|
|
65627
|
+
}) {
|
|
65628
|
+
const diff = profit_risk / position2.quantity;
|
|
65629
|
+
const kind = position2.kind === "long" ? "short" : "long";
|
|
65630
|
+
const tp_price = position2.kind === "long" ? diff + position2.entry : position2.entry - diff;
|
|
65631
|
+
const loss_diff = allowable_loss / position2.quantity;
|
|
65632
|
+
const loss_price = position2.kind === "long" ? position2.entry - loss_diff : position2.entry + loss_diff;
|
|
65633
|
+
const entry = kind === "short" ? loss_price : tp_price;
|
|
65634
|
+
const stop = kind === "short" ? tp_price : loss_price;
|
|
65635
|
+
const result = buildWithOptimumReward({
|
|
65636
|
+
config: {
|
|
65637
|
+
...config2,
|
|
65638
|
+
entry,
|
|
65639
|
+
stop
|
|
65640
|
+
},
|
|
65641
|
+
global_config,
|
|
65642
|
+
force_exact: true,
|
|
65643
|
+
settings: {
|
|
65644
|
+
entry,
|
|
65645
|
+
stop,
|
|
65646
|
+
risk: profit_risk,
|
|
65647
|
+
distribution: config2.distribution
|
|
65648
|
+
}
|
|
65649
|
+
});
|
|
65650
|
+
return {
|
|
65651
|
+
opposite: result,
|
|
65652
|
+
take_profit: to_f(tp_price, global_config.price_places)
|
|
65653
|
+
};
|
|
65654
|
+
}
|
|
65585
65655
|
var compoundAPI = {
|
|
65656
|
+
determineHedgeTradeToPlace,
|
|
65586
65657
|
buildWithOptimumReward,
|
|
65587
65658
|
constructAppConfig: constructAppConfig2,
|
|
65588
65659
|
generateOppositeOptimum,
|
|
@@ -65595,8 +65666,10 @@ class BaseExchange {
|
|
|
65595
65666
|
name;
|
|
65596
65667
|
getCredentials;
|
|
65597
65668
|
proxyAgent;
|
|
65669
|
+
remoteActionBaseUrl;
|
|
65598
65670
|
constructor(client) {
|
|
65599
65671
|
this.client = client;
|
|
65672
|
+
this.remoteActionBaseUrl = "https://app-dev.beeola.me";
|
|
65600
65673
|
}
|
|
65601
65674
|
async rawCreateLimitPurchaseOrders(payload) {
|
|
65602
65675
|
const { symbol, orders, price_places, decimal_places } = payload;
|
|
@@ -65930,6 +66003,51 @@ class BaseExchange {
|
|
|
65930
66003
|
setAccountDetails(payload) {
|
|
65931
66004
|
this.getCredentials = payload.getCredentials;
|
|
65932
66005
|
this.proxyAgent = payload.proxyAgent;
|
|
66006
|
+
if (payload.remoteActionBaseUrl) {
|
|
66007
|
+
this.remoteActionBaseUrl = payload.remoteActionBaseUrl;
|
|
66008
|
+
}
|
|
66009
|
+
}
|
|
66010
|
+
async getSymbolInformation(payload) {
|
|
66011
|
+
const { symbol, variant = "full" } = payload;
|
|
66012
|
+
if (!this.remoteActionBaseUrl) {
|
|
66013
|
+
throw new Error("Remote action base URL is not configured");
|
|
66014
|
+
}
|
|
66015
|
+
const url = `${this.remoteActionBaseUrl}/api/main_account/remote-actions`;
|
|
66016
|
+
const analysisType = variant === "short" ? "analyze_candlesticks_short" : "analyze_candlesticks";
|
|
66017
|
+
const requestPayload = {
|
|
66018
|
+
action: "base_model",
|
|
66019
|
+
symbol,
|
|
66020
|
+
name: "base_model",
|
|
66021
|
+
params: {
|
|
66022
|
+
args: [analysisType],
|
|
66023
|
+
kwargs: { symbol }
|
|
66024
|
+
}
|
|
66025
|
+
};
|
|
66026
|
+
try {
|
|
66027
|
+
const response = await fetch(url, {
|
|
66028
|
+
method: "POST",
|
|
66029
|
+
headers: {
|
|
66030
|
+
"Content-Type": "application/json"
|
|
66031
|
+
},
|
|
66032
|
+
body: JSON.stringify(requestPayload)
|
|
66033
|
+
});
|
|
66034
|
+
if (!response.ok) {
|
|
66035
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
66036
|
+
}
|
|
66037
|
+
const result = await response.json();
|
|
66038
|
+
const data = result.data;
|
|
66039
|
+
return {
|
|
66040
|
+
candlesticks: data.candlesticks || {},
|
|
66041
|
+
resistance: data.resistance || {},
|
|
66042
|
+
support: data.support || {},
|
|
66043
|
+
currentPrice: data.current_price || 0,
|
|
66044
|
+
minimumWeekly: data.minimum_weekly,
|
|
66045
|
+
lowest: data.lowest
|
|
66046
|
+
};
|
|
66047
|
+
} catch (error) {
|
|
66048
|
+
console.error("Error fetching symbol information:", error);
|
|
66049
|
+
throw error;
|
|
66050
|
+
}
|
|
65933
66051
|
}
|
|
65934
66052
|
}
|
|
65935
66053
|
|
|
@@ -68564,6 +68682,7 @@ class ExchangePosition {
|
|
|
68564
68682
|
if (condition) {
|
|
68565
68683
|
let entry = payload.tp ? position2.entry || config2.entry : config2.entry;
|
|
68566
68684
|
const v = stop ? "place_stop_orders" : risky ? "dangerous_entry_orders" : "place_limit_orders";
|
|
68685
|
+
console.log("distribution_params", config2.distribution_params);
|
|
68567
68686
|
return await this.placeSharedOrder(v, {
|
|
68568
68687
|
entry,
|
|
68569
68688
|
stop: config2.stop,
|
|
@@ -68574,6 +68693,7 @@ class ExchangePosition {
|
|
|
68574
68693
|
use_current,
|
|
68575
68694
|
stop_percent: config2.stop_percent || 100,
|
|
68576
68695
|
distribution: config2.distribution,
|
|
68696
|
+
distribution_params: config2.distribution_params,
|
|
68577
68697
|
hedge: payload.hedge,
|
|
68578
68698
|
stop_ratio
|
|
68579
68699
|
});
|
|
@@ -68593,7 +68713,9 @@ class ExchangePosition {
|
|
|
68593
68713
|
kelly_confidence_factor: config2.kelly?.kelly_confidence_factor,
|
|
68594
68714
|
kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
|
|
68595
68715
|
kelly_prediction_model: config2.kelly?.kelly_prediction_model,
|
|
68596
|
-
kelly_func: config2.kelly?.kelly_func
|
|
68716
|
+
kelly_func: config2.kelly?.kelly_func,
|
|
68717
|
+
distribution: payload.distribution || config2.distribution,
|
|
68718
|
+
distribution_params: payload.distribution_params || config2.distribution_params
|
|
68597
68719
|
});
|
|
68598
68720
|
const { entry_orders, stop_orders, trades } = await this.placeConfigOrders(app_config, {
|
|
68599
68721
|
risk_reward: payload.risk_reward,
|
|
@@ -68610,7 +68732,8 @@ class ExchangePosition {
|
|
|
68610
68732
|
kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
|
|
68611
68733
|
kelly_prediction_model: config2.kelly?.kelly_prediction_model,
|
|
68612
68734
|
kelly_func: config2.kelly?.kelly_func,
|
|
68613
|
-
distribution: config2.distribution
|
|
68735
|
+
distribution: config2.distribution,
|
|
68736
|
+
distribution_params: payload.distribution_params || config2.distribution_params
|
|
68614
68737
|
}, false);
|
|
68615
68738
|
if (payload.raw) {
|
|
68616
68739
|
let actual_orders_to_buy = await this.determineAmountToBuy({
|
|
@@ -68735,7 +68858,8 @@ class ExchangePosition {
|
|
|
68735
68858
|
kelly_minimum_risk: solution.kelly_minimum_risk,
|
|
68736
68859
|
kelly_prediction_model: solution.kelly_prediction_model,
|
|
68737
68860
|
kelly_func: solution.kelly_func,
|
|
68738
|
-
distribution: solution.distribution
|
|
68861
|
+
distribution: solution.distribution,
|
|
68862
|
+
distribution_params: solution.distribution_params
|
|
68739
68863
|
};
|
|
68740
68864
|
const trades = sortedBuildConfig(app_config, options);
|
|
68741
68865
|
const entry_orders = {
|
|
@@ -69170,7 +69294,9 @@ class ExchangePosition {
|
|
|
69170
69294
|
entry,
|
|
69171
69295
|
stop,
|
|
69172
69296
|
risk_reward,
|
|
69173
|
-
risk
|
|
69297
|
+
risk,
|
|
69298
|
+
distribution: db_config.distribution,
|
|
69299
|
+
distribution_params: db_config.distribution_params
|
|
69174
69300
|
});
|
|
69175
69301
|
let config2 = generate_config_params(app_config, {
|
|
69176
69302
|
entry,
|
|
@@ -69186,7 +69312,9 @@ class ExchangePosition {
|
|
|
69186
69312
|
risk_reward: config2.risk_reward,
|
|
69187
69313
|
risk: config2.risk,
|
|
69188
69314
|
profit: 0,
|
|
69189
|
-
update_db: false
|
|
69315
|
+
update_db: false,
|
|
69316
|
+
distribution: db_config.distribution,
|
|
69317
|
+
distribution_params: db_config.distribution_params
|
|
69190
69318
|
});
|
|
69191
69319
|
const { trades } = await this.placeConfigOrders(app_config2, {
|
|
69192
69320
|
risk_reward: config2.risk_reward,
|
|
@@ -69284,7 +69412,9 @@ class ExchangePosition {
|
|
|
69284
69412
|
entry: config2.entry,
|
|
69285
69413
|
stop: config2.stop,
|
|
69286
69414
|
risk_reward: config2.risk_reward,
|
|
69287
|
-
risk: risk || config2.risk
|
|
69415
|
+
risk: risk || config2.risk,
|
|
69416
|
+
distribution: config2.distribution,
|
|
69417
|
+
distribution_params: config2.distribution_params
|
|
69288
69418
|
});
|
|
69289
69419
|
const { trades } = await this.placeConfigOrders(app_config, {
|
|
69290
69420
|
risk_reward: config2.risk_reward,
|
|
@@ -69340,6 +69470,8 @@ class ExchangePosition {
|
|
|
69340
69470
|
kelly_minimum_risk: config2.kelly?.kelly_minimum_risk,
|
|
69341
69471
|
kelly_prediction_model: config2.kelly?.kelly_prediction_model,
|
|
69342
69472
|
kelly_func: config2.kelly?.kelly_func,
|
|
69473
|
+
distribution: config2.distribution,
|
|
69474
|
+
distribution_params: config2.distribution_params,
|
|
69343
69475
|
...override
|
|
69344
69476
|
});
|
|
69345
69477
|
return app_config;
|
|
@@ -69914,7 +70046,7 @@ class ExchangeAccount {
|
|
|
69914
70046
|
kind: "short"
|
|
69915
70047
|
});
|
|
69916
70048
|
const long_config = await long_position.getConfig();
|
|
69917
|
-
const short_config =
|
|
70049
|
+
const short_config = short_position.getInstance().expand.b_config;
|
|
69918
70050
|
const config2 = build_reduce_config({
|
|
69919
70051
|
account: this.instance,
|
|
69920
70052
|
symbol: payload.symbol,
|