@gbozee/ultimate 0.0.2-204 → 0.0.2-205

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.
@@ -165,12 +165,22 @@ export type SignalConfigType = {
165
165
  short: GetEntriesParams["distribution"];
166
166
  };
167
167
  max_quantity?: number;
168
+ distribution_params?: {
169
+ curveFactor?: number;
170
+ stdDevFactor?: number;
171
+ lambda?: number;
172
+ };
168
173
  };
169
174
  declare class Signal {
170
175
  focus: number;
171
176
  budget: number;
172
177
  percent_change: number;
173
178
  price_places: string;
179
+ distribution_params: {
180
+ curveFactor?: number;
181
+ stdDevFactor?: number;
182
+ lambda?: number;
183
+ };
174
184
  decimal_places: string;
175
185
  zone_risk: number;
176
186
  fee: number;
@@ -198,8 +208,8 @@ declare class Signal {
198
208
  short: GetEntriesParams["distribution"];
199
209
  };
200
210
  max_quantity: number;
201
- constructor({ focus, symbol, budget, percent_change, price_places, decimal_places, zone_risk, fee, support, risk_reward, resistance, risk_per_trade, increase_size, additional_increase, minimum_pnl, take_profit, increase_position, minimum_size, first_order_size, gap, max_size, use_kelly, kelly_prediction_model, kelly_confidence_factor, kelly_minimum_risk, kelly_func, full_distribution, max_quantity, }: SignalConfigType);
202
- build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, distribution, }: {
211
+ constructor({ focus, symbol, budget, percent_change, price_places, decimal_places, zone_risk, fee, support, risk_reward, resistance, risk_per_trade, increase_size, additional_increase, minimum_pnl, take_profit, increase_position, minimum_size, first_order_size, gap, max_size, use_kelly, kelly_prediction_model, kelly_confidence_factor, kelly_minimum_risk, kelly_func, full_distribution, max_quantity, distribution_params, }: SignalConfigType);
212
+ build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, distribution, distribution_params, }: {
203
213
  take_profit?: number;
204
214
  no_of_trades?: number;
205
215
  current_price: number;
@@ -209,6 +219,11 @@ declare class Signal {
209
219
  stop_percent?: number;
210
220
  pnl?: number;
211
221
  distribution?: GetEntriesParams["distribution"];
222
+ distribution_params?: {
223
+ curveFactor?: number;
224
+ stdDevFactor?: number;
225
+ lambda?: number;
226
+ };
212
227
  }): any;
213
228
  get risk(): number;
214
229
  get min_trades(): number;
@@ -376,6 +391,11 @@ export interface ScheduledTrade extends BaseSystemFields {
376
391
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
377
392
  };
378
393
  distribution?: GetEntriesParams["distribution"];
394
+ distribution_params?: {
395
+ curveFactor?: number;
396
+ stdDevFactor?: number;
397
+ lambda?: number;
398
+ };
379
399
  settings?: {
380
400
  gap_trading?: {
381
401
  entry_risk?: number;
@@ -518,6 +538,12 @@ export type AppConfig = {
518
538
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
519
539
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
520
540
  };
541
+ distribution?: GetEntriesParams["distribution"];
542
+ distribution_params?: {
543
+ curveFactor?: number;
544
+ stdDevFactor?: number;
545
+ lambda?: number;
546
+ };
521
547
  };
522
548
  export type ExtendConfigType = {
523
549
  take_profit?: number;
@@ -541,8 +567,13 @@ export type ExtendConfigType = {
541
567
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
542
568
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
543
569
  distribution?: GetEntriesParams["distribution"];
570
+ distribution_params?: {
571
+ curveFactor?: number;
572
+ stdDevFactor?: number;
573
+ lambda?: number;
574
+ };
544
575
  };
545
- export declare function buildConfig(app_config: AppConfig, { take_profit, entry, stop, raw_instance, risk, no_of_trades, min_profit, risk_reward, kind, increase, gap, rr, price_places, decimal_places, use_kelly, kelly_confidence_factor, kelly_minimum_risk, kelly_prediction_model, kelly_func, min_avg_size, distribution, }: ExtendConfigType): any[] | Signal;
576
+ export declare function buildConfig(app_config: AppConfig, { take_profit, entry, stop, raw_instance, risk, no_of_trades, min_profit, risk_reward, kind, increase, gap, rr, price_places, decimal_places, use_kelly, kelly_confidence_factor, kelly_minimum_risk, kelly_prediction_model, kelly_func, min_avg_size, distribution, distribution_params, }: ExtendConfigType): any[] | Signal;
546
577
  export declare function buildAvg({ _trades, kind, }: {
547
578
  _trades: any[];
548
579
  kind: "long" | "short";
@@ -558,6 +589,11 @@ export declare function get_app_config_and_max_size(config: GlobalConfig, payloa
558
589
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
559
590
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
560
591
  distribution?: GetEntriesParams["distribution"];
592
+ distribution_params?: {
593
+ curveFactor?: number;
594
+ stdDevFactor?: number;
595
+ lambda?: number;
596
+ };
561
597
  }): {
562
598
  app_config: AppConfig;
563
599
  max_size: any;
@@ -583,12 +619,22 @@ export declare function buildAppConfig(config: GlobalConfig, payload: {
583
619
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
584
620
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
585
621
  distribution?: GetEntriesParams["distribution"];
622
+ distribution_params?: {
623
+ curveFactor?: number;
624
+ stdDevFactor?: number;
625
+ lambda?: number;
626
+ };
586
627
  }): AppConfig;
587
628
  export declare function getOptimumStopAndRisk(app_config: AppConfig, params: {
588
629
  max_size: number;
589
630
  target_stop: number;
590
631
  highest_risk?: number;
591
632
  distribution?: GetEntriesParams["distribution"];
633
+ distribution_params?: {
634
+ curveFactor?: number;
635
+ stdDevFactor?: number;
636
+ lambda?: number;
637
+ };
592
638
  }): {
593
639
  optimal_stop: number;
594
640
  optimal_risk: number;
@@ -646,6 +692,11 @@ export declare function generateOptimumAppConfig(config: GlobalConfig, payload:
646
692
  start_risk: number;
647
693
  max_risk?: number;
648
694
  distribution?: GetEntriesParams["distribution"];
695
+ distribution_params?: {
696
+ curveFactor?: number;
697
+ stdDevFactor?: number;
698
+ lambda?: number;
699
+ };
649
700
  }, position: {
650
701
  entry: number;
651
702
  quantity: number;
@@ -658,6 +709,11 @@ export declare function determineOptimumReward(payload: {
658
709
  high_range?: number;
659
710
  target_loss?: number;
660
711
  distribution?: GetEntriesParams["distribution"];
712
+ distribution_params?: {
713
+ curveFactor?: number;
714
+ stdDevFactor?: number;
715
+ lambda?: number;
716
+ };
661
717
  max_size?: number;
662
718
  }): number | {
663
719
  result: any[];
@@ -677,6 +733,11 @@ export declare function determineOptimumRisk(config: GlobalConfig, payload: {
677
733
  risk: number;
678
734
  symbol: string;
679
735
  distribution?: GetEntriesParams["distribution"];
736
+ distribution_params?: {
737
+ curveFactor?: number;
738
+ stdDevFactor?: number;
739
+ lambda?: number;
740
+ };
680
741
  }, params: {
681
742
  highest_risk: number;
682
743
  tolerance?: number;
@@ -699,6 +760,11 @@ export declare function computeRiskReward(payload: {
699
760
  risk_per_trade: number;
700
761
  target_loss?: number;
701
762
  distribution?: GetEntriesParams["distribution"];
763
+ distribution_params?: {
764
+ curveFactor?: number;
765
+ stdDevFactor?: number;
766
+ lambda?: number;
767
+ };
702
768
  high_range?: number;
703
769
  max_size?: number;
704
770
  }): number | {
@@ -721,6 +787,11 @@ export declare function getRiskReward(payload: {
721
787
  target_loss?: number;
722
788
  max_size?: number;
723
789
  distribution?: GetEntriesParams["distribution"];
790
+ distribution_params?: {
791
+ curveFactor?: number;
792
+ stdDevFactor?: number;
793
+ lambda?: number;
794
+ };
724
795
  risk_factor?: number;
725
796
  high_range?: number;
726
797
  }): any;
@@ -951,6 +1022,14 @@ export declare function constructAppConfig(payload: {
951
1022
  kelly_minimum_risk: number;
952
1023
  kelly_prediction_model: string;
953
1024
  };
1025
+ distribution_config?: {
1026
+ distribution?: GetEntriesParams["distribution"];
1027
+ distribution_params?: {
1028
+ curveFactor?: number;
1029
+ stdDevFactor?: number;
1030
+ lambda?: number;
1031
+ };
1032
+ };
954
1033
  }): {
955
1034
  fee: number;
956
1035
  risk_per_trade: number;
@@ -985,6 +1064,12 @@ export declare function constructAppConfig(payload: {
985
1064
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
986
1065
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
987
1066
  };
1067
+ distribution?: GetEntriesParams["distribution"];
1068
+ distribution_params?: {
1069
+ curveFactor?: number;
1070
+ stdDevFactor?: number;
1071
+ lambda?: number;
1072
+ };
988
1073
  };
989
1074
  export declare function generateDangerousConfig(payload: {
990
1075
  account: PositionsView;
@@ -1203,6 +1288,12 @@ export declare class Strategy {
1203
1288
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
1204
1289
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
1205
1290
  };
1291
+ distribution?: GetEntriesParams["distribution"];
1292
+ distribution_params?: {
1293
+ curveFactor?: number;
1294
+ stdDevFactor?: number;
1295
+ lambda?: number;
1296
+ };
1206
1297
  };
1207
1298
  identifyGapConfig(payload: {
1208
1299
  factor?: number;
@@ -1351,6 +1442,12 @@ declare function constructAppConfig$1({ config, global_config, }: {
1351
1442
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
1352
1443
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
1353
1444
  };
1445
+ distribution?: GetEntriesParams["distribution"];
1446
+ distribution_params?: {
1447
+ curveFactor?: number;
1448
+ stdDevFactor?: number;
1449
+ lambda?: number;
1450
+ };
1354
1451
  };
1355
1452
  declare function buildWithOptimumReward({ config, settings, global_config, force_exact, }: {
1356
1453
  config: TradeConfig;
@@ -1572,7 +1669,44 @@ declare function generatePositionIncreaseTrade({ account, zoneAccount, ratio, co
1572
1669
  };
1573
1670
  };
1574
1671
  };
1672
+ declare function determineHedgeTradeToPlace({ position, config, global_config, profit_risk, allowable_loss, }: {
1673
+ position: {
1674
+ entry: number;
1675
+ quantity: number;
1676
+ kind: "long" | "short";
1677
+ };
1678
+ config: TradeConfig;
1679
+ global_config: GlobalConfig;
1680
+ profit_risk?: number;
1681
+ allowable_loss?: number;
1682
+ }): {
1683
+ opposite: {
1684
+ trades: any[];
1685
+ summary: {
1686
+ entry: number;
1687
+ stop: number;
1688
+ risk: number;
1689
+ risk_reward: any;
1690
+ avg_entry: number;
1691
+ avg_size: number;
1692
+ first_entry: number;
1693
+ pnl: number;
1694
+ fee: number;
1695
+ loss: number;
1696
+ last_entry: number;
1697
+ margin: number;
1698
+ };
1699
+ config: any;
1700
+ stop_order: {
1701
+ quantity: number;
1702
+ price: number;
1703
+ };
1704
+ kind: string;
1705
+ };
1706
+ take_profit: number;
1707
+ };
1575
1708
  export declare const compoundAPI: {
1709
+ determineHedgeTradeToPlace: typeof determineHedgeTradeToPlace;
1576
1710
  buildWithOptimumReward: typeof buildWithOptimumReward;
1577
1711
  constructAppConfig: typeof constructAppConfig$1;
1578
1712
  generateOppositeOptimum: typeof generateOppositeOptimum;
@@ -376,6 +376,7 @@ class Signal {
376
376
  budget;
377
377
  percent_change = 0.02;
378
378
  price_places = "%.5f";
379
+ distribution_params = {};
379
380
  decimal_places = "%.0f";
380
381
  zone_risk = 1;
381
382
  fee = 0.08 / 100;
@@ -431,11 +432,13 @@ class Signal {
431
432
  kelly_minimum_risk = 0.2,
432
433
  kelly_func = "theoretical",
433
434
  full_distribution,
434
- max_quantity = 0.03
435
+ max_quantity = 0.03,
436
+ distribution_params = {}
435
437
  }) {
436
438
  if (full_distribution) {
437
439
  this.distribution = full_distribution;
438
440
  }
441
+ this.distribution_params = distribution_params;
439
442
  this.symbol = symbol;
440
443
  this.minimum_size = minimum_size;
441
444
  this.first_order_size = first_order_size;
@@ -473,7 +476,8 @@ class Signal {
473
476
  risk,
474
477
  no_of_trades = 1,
475
478
  take_profit,
476
- distribution
479
+ distribution,
480
+ distribution_params = {}
477
481
  }) {
478
482
  let _stop_loss = stop_loss;
479
483
  if (!_stop_loss && stop_percent) {
@@ -497,7 +501,8 @@ class Signal {
497
501
  full_distribution: distribution ? {
498
502
  ...this.distribution,
499
503
  [kind]: distribution
500
- } : undefined
504
+ } : undefined,
505
+ distribution_params
501
506
  };
502
507
  const instance = new Signal(derivedConfig);
503
508
  if (kind === "short") {}
@@ -725,7 +730,8 @@ class Signal {
725
730
  kind: _kind,
726
731
  distribution,
727
732
  risk_reward: this.risk_reward,
728
- price_places: this.price_places
733
+ price_places: this.price_places,
734
+ distribution_params: this.distribution_params
729
735
  });
730
736
  return entries.sort((a, b) => a - b);
731
737
  }
@@ -1606,7 +1612,8 @@ function buildConfig(app_config, {
1606
1612
  kelly_prediction_model = "exponential",
1607
1613
  kelly_func = "theoretical",
1608
1614
  min_avg_size = 0,
1609
- distribution
1615
+ distribution,
1616
+ distribution_params
1610
1617
  }) {
1611
1618
  let fee = app_config.fee / 100;
1612
1619
  let working_risk = risk || app_config.risk_per_trade;
@@ -1637,7 +1644,8 @@ function buildConfig(app_config, {
1637
1644
  kelly_prediction_model: kelly_prediction_model || app_config.kelly?.kelly_prediction_model,
1638
1645
  kelly_func: kelly_func || app_config.kelly?.kelly_func,
1639
1646
  symbol: app_config.symbol,
1640
- max_quantity: app_config.max_quantity
1647
+ max_quantity: app_config.max_quantity,
1648
+ distribution_params: distribution_params || app_config.distribution_params
1641
1649
  };
1642
1650
  const instance = new Signal(config);
1643
1651
  if (raw_instance) {
@@ -1654,7 +1662,8 @@ function buildConfig(app_config, {
1654
1662
  risk: working_risk,
1655
1663
  kind: kind || app_config.kind,
1656
1664
  no_of_trades: trade_no,
1657
- distribution
1665
+ distribution,
1666
+ distribution_params
1658
1667
  }) || [] : [];
1659
1668
  const new_trades = computeTotalAverageForEachTrade(result, config);
1660
1669
  let filtered = new_trades.filter((o) => o.avg_size > min_avg_size);
@@ -1724,7 +1733,8 @@ function get_app_config_and_max_size(config, payload) {
1724
1733
  kelly_minimum_risk: payload.kelly_minimum_risk,
1725
1734
  kelly_prediction_model: payload.kelly_prediction_model,
1726
1735
  kelly_func: payload.kelly_func,
1727
- distribution: payload.distribution
1736
+ distribution: payload.distribution,
1737
+ distribution_params: payload.distribution_params
1728
1738
  });
1729
1739
  const max_size = initialResult[0]?.avg_size;
1730
1740
  const last_value = initialResult[0];
@@ -1763,7 +1773,8 @@ function buildAppConfig(config, payload) {
1763
1773
  kelly_minimum_risk: payload.kelly_minimum_risk,
1764
1774
  kelly_prediction_model: payload.kelly_prediction_model,
1765
1775
  kelly_func: payload.kelly_func,
1766
- distribution: payload.distribution
1776
+ distribution: payload.distribution,
1777
+ distribution_params: payload.distribution_params
1767
1778
  });
1768
1779
  app_config.max_size = max_size;
1769
1780
  app_config.entry = payload.entry || app_config.entry;
@@ -1777,10 +1788,12 @@ function buildAppConfig(config, payload) {
1777
1788
  kelly_prediction_model: payload.kelly_prediction_model,
1778
1789
  kelly_func: payload.kelly_func
1779
1790
  };
1791
+ app_config.distribution = payload.distribution;
1792
+ app_config.distribution_params = payload.distribution_params;
1780
1793
  return app_config;
1781
1794
  }
1782
1795
  function getOptimumStopAndRisk(app_config, params) {
1783
- const { max_size, target_stop, distribution } = params;
1796
+ const { max_size, target_stop, distribution, distribution_params: _distribution_params } = params;
1784
1797
  const isLong = app_config.kind === "long";
1785
1798
  const stopRange = Math.abs(app_config.entry - target_stop) * 0.5;
1786
1799
  let low_stop = isLong ? target_stop - stopRange : Math.max(target_stop - stopRange, app_config.entry);
@@ -1804,7 +1817,8 @@ function getOptimumStopAndRisk(app_config, params) {
1804
1817
  gap: app_config.gap,
1805
1818
  price_places: app_config.price_places,
1806
1819
  decimal_places: app_config.decimal_places,
1807
- distribution
1820
+ distribution,
1821
+ distribution_params: _distribution_params
1808
1822
  });
1809
1823
  if (result.length === 0) {
1810
1824
  if (isLong) {
@@ -1859,7 +1873,8 @@ function getOptimumStopAndRisk(app_config, params) {
1859
1873
  gap: app_config.gap,
1860
1874
  price_places: app_config.price_places,
1861
1875
  decimal_places: app_config.decimal_places,
1862
- distribution
1876
+ distribution,
1877
+ distribution_params: _distribution_params
1863
1878
  });
1864
1879
  if (result.length === 0) {
1865
1880
  high_risk = mid_risk;
@@ -1905,7 +1920,8 @@ function getOptimumStopAndRisk(app_config, params) {
1905
1920
  gap: app_config.gap,
1906
1921
  price_places: app_config.price_places,
1907
1922
  decimal_places: app_config.decimal_places,
1908
- distribution
1923
+ distribution,
1924
+ distribution_params: _distribution_params
1909
1925
  });
1910
1926
  if (result.length === 0)
1911
1927
  continue;
@@ -2126,7 +2142,8 @@ function determineOptimumReward(payload) {
2126
2142
  kind: app_config.kind,
2127
2143
  gap: app_config.gap,
2128
2144
  decimal_places: app_config.decimal_places,
2129
- distribution
2145
+ distribution,
2146
+ distribution_params: payload.distribution_params
2130
2147
  });
2131
2148
  let total = 0;
2132
2149
  let max = -Infinity;
@@ -2315,6 +2332,7 @@ function computeRiskReward(payload) {
2315
2332
  app_config,
2316
2333
  target_loss,
2317
2334
  distribution,
2335
+ distribution_params: payload.distribution_params,
2318
2336
  high_range,
2319
2337
  max_size
2320
2338
  });
@@ -2339,7 +2357,8 @@ function getRiskReward(payload) {
2339
2357
  risk_reward: 30,
2340
2358
  risk,
2341
2359
  symbol: global_config.symbol,
2342
- distribution
2360
+ distribution,
2361
+ distribution_params: payload.distribution_params
2343
2362
  });
2344
2363
  const risk_reward = computeRiskReward({
2345
2364
  app_config,
@@ -2349,6 +2368,7 @@ function getRiskReward(payload) {
2349
2368
  high_range,
2350
2369
  target_loss,
2351
2370
  distribution,
2371
+ distribution_params: payload.distribution_params,
2352
2372
  max_size
2353
2373
  });
2354
2374
  if (force_exact_risk) {
@@ -2358,7 +2378,8 @@ function getRiskReward(payload) {
2358
2378
  risk_reward,
2359
2379
  risk,
2360
2380
  symbol: global_config.symbol,
2361
- distribution
2381
+ distribution,
2382
+ distribution_params: payload.distribution_params
2362
2383
  }, {
2363
2384
  highest_risk: risk * risk_factor
2364
2385
  }).optimal_risk;
@@ -2779,7 +2800,8 @@ function generateOppositeTradeConfig(payload) {
2779
2800
  }
2780
2801
  }
2781
2802
  },
2782
- global_config
2803
+ global_config,
2804
+ distribution_config: {}
2783
2805
  });
2784
2806
  const risk_reward = computeRiskReward({
2785
2807
  app_config,
@@ -2796,7 +2818,7 @@ function generateOppositeTradeConfig(payload) {
2796
2818
  };
2797
2819
  }
2798
2820
  function constructAppConfig(payload) {
2799
- const { account, global_config, kelly_config } = payload;
2821
+ const { account, global_config, kelly_config, distribution_config } = payload;
2800
2822
  const config = account.expand?.b_config;
2801
2823
  if (!config) {
2802
2824
  return null;
@@ -2811,7 +2833,9 @@ function constructAppConfig(payload) {
2811
2833
  use_kelly: kelly_config?.use_kelly ?? kelly?.use_kelly,
2812
2834
  kelly_confidence_factor: kelly_config?.kelly_confidence_factor ?? kelly?.kelly_confidence_factor,
2813
2835
  kelly_minimum_risk: kelly_config?.kelly_minimum_risk ?? kelly?.kelly_minimum_risk,
2814
- kelly_prediction_model: kelly_config?.kelly_prediction_model ?? kelly?.kelly_prediction_model
2836
+ kelly_prediction_model: kelly_config?.kelly_prediction_model ?? kelly?.kelly_prediction_model,
2837
+ distribution: distribution_config?.distribution ?? config?.distribution,
2838
+ distribution_params: distribution_config?.distribution_params ?? config?.distribution_params
2815
2839
  };
2816
2840
  const { entries: _entries, ...appConfig } = buildAppConfig(global_config, options);
2817
2841
  return appConfig;
@@ -2821,7 +2845,8 @@ function generateDangerousConfig(payload) {
2821
2845
  const app_config = constructAppConfig({
2822
2846
  account,
2823
2847
  global_config,
2824
- kelly_config: {}
2848
+ kelly_config: {},
2849
+ distribution_config: {}
2825
2850
  });
2826
2851
  const { optimal_risk, optimal_stop } = getOptimumStopAndRisk(app_config, {
2827
2852
  max_size: config.quantity,
@@ -3748,7 +3773,42 @@ function generatePositionIncreaseTrade({
3748
3773
  distribution
3749
3774
  });
3750
3775
  }
3776
+ function determineHedgeTradeToPlace({
3777
+ position: position2,
3778
+ config,
3779
+ global_config,
3780
+ profit_risk = 200,
3781
+ allowable_loss = 1000
3782
+ }) {
3783
+ const diff = profit_risk / position2.quantity;
3784
+ const kind = position2.kind === "long" ? "short" : "long";
3785
+ const tp_price = position2.kind === "long" ? diff + position2.entry : position2.entry - diff;
3786
+ const loss_diff = allowable_loss / position2.quantity;
3787
+ const loss_price = position2.kind === "long" ? position2.entry - loss_diff : position2.entry + loss_diff;
3788
+ const entry = kind === "short" ? loss_price : tp_price;
3789
+ const stop = kind === "short" ? tp_price : loss_price;
3790
+ const result = buildWithOptimumReward({
3791
+ config: {
3792
+ ...config,
3793
+ entry,
3794
+ stop
3795
+ },
3796
+ global_config,
3797
+ force_exact: true,
3798
+ settings: {
3799
+ entry,
3800
+ stop,
3801
+ risk: profit_risk,
3802
+ distribution: config.distribution
3803
+ }
3804
+ });
3805
+ return {
3806
+ opposite: result,
3807
+ take_profit: to_f(tp_price, global_config.price_places)
3808
+ };
3809
+ }
3751
3810
  var compoundAPI = {
3811
+ determineHedgeTradeToPlace,
3752
3812
  buildWithOptimumReward,
3753
3813
  constructAppConfig: constructAppConfig2,
3754
3814
  generateOppositeOptimum,