@gbozee/ultimate 0.0.2-174 → 0.0.2-177

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.
@@ -118,6 +118,21 @@ export declare function determineTPSl(payload: {
118
118
  reduce_quantity: number;
119
119
  expected_loss: number;
120
120
  };
121
+ export interface GetEntriesParams {
122
+ kind: "long" | "short";
123
+ distribution: "arithmetic" | "geometric" | "normal" | "exponential" | "inverse-exponential";
124
+ margin_range: [
125
+ number,
126
+ number
127
+ ];
128
+ risk_reward: number;
129
+ price_places?: string;
130
+ distribution_params?: {
131
+ curveFactor?: number;
132
+ stdDevFactor?: number;
133
+ lambda?: number;
134
+ };
135
+ }
121
136
  export type SignalConfigType = {
122
137
  symbol?: string;
123
138
  focus: number;
@@ -145,6 +160,10 @@ export type SignalConfigType = {
145
160
  kelly_confidence_factor?: number;
146
161
  kelly_minimum_risk?: number;
147
162
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
163
+ full_distribution?: {
164
+ long: GetEntriesParams["distribution"];
165
+ short: GetEntriesParams["distribution"];
166
+ };
148
167
  };
149
168
  declare class Signal {
150
169
  focus: number;
@@ -173,8 +192,12 @@ declare class Signal {
173
192
  kelly_minimum_risk: number;
174
193
  kelly_func: "theoretical" | "position_based" | "theoretical_fixed";
175
194
  symbol?: string;
176
- 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, }: SignalConfigType);
177
- build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, }: {
195
+ distribution: {
196
+ long: GetEntriesParams["distribution"];
197
+ short: GetEntriesParams["distribution"];
198
+ };
199
+ 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, }: SignalConfigType);
200
+ build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, distribution, }: {
178
201
  take_profit?: number;
179
202
  no_of_trades?: number;
180
203
  current_price: number;
@@ -183,6 +206,7 @@ declare class Signal {
183
206
  risk: number;
184
207
  stop_percent?: number;
185
208
  pnl?: number;
209
+ distribution?: GetEntriesParams["distribution"];
186
210
  }): any;
187
211
  get risk(): number;
188
212
  get min_trades(): number;
@@ -216,6 +240,11 @@ declare class Signal {
216
240
  kind?: "long" | "short";
217
241
  limit?: boolean;
218
242
  }): any;
243
+ get_future_zones_simple({ current_price, kind, raw, }: {
244
+ raw?: boolean;
245
+ current_price: number;
246
+ kind?: "long" | "short";
247
+ }): number[];
219
248
  get_future_zones({ current_price, kind, raw, }: {
220
249
  raw?: boolean;
221
250
  current_price: number;
@@ -329,6 +358,7 @@ export interface ScheduledTrade extends BaseSystemFields {
329
358
  kelly_minimum_risk?: number;
330
359
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
331
360
  };
361
+ distribution?: GetEntriesParams["distribution"];
332
362
  }
333
363
  export interface AccountStrategy extends BaseSystemFields {
334
364
  account: string;
@@ -388,8 +418,36 @@ export interface PositionsView {
388
418
  b_config?: ScheduledTrade;
389
419
  proxy?: Proxy$1;
390
420
  account_strategy?: AccountStrategy;
421
+ compound_instance?: CompoundInstance;
422
+ support?: SupportTable;
391
423
  };
392
424
  pnl?: number;
425
+ support_price?: number;
426
+ }
427
+ export interface Compounder extends BaseSystemFields {
428
+ risk?: number;
429
+ profit_percent?: number;
430
+ owner?: string;
431
+ completed?: boolean;
432
+ start_balance?: number;
433
+ starting_risk?: number;
434
+ fee_rate?: number;
435
+ }
436
+ export interface CompoundInstance extends BaseSystemFields {
437
+ ref?: string;
438
+ position?: string;
439
+ risk?: number;
440
+ hedged?: boolean;
441
+ expand?: {
442
+ ref?: Compounder;
443
+ };
444
+ }
445
+ export interface SupportTable extends BaseSystemFields {
446
+ symbol?: string;
447
+ price?: number;
448
+ counter?: number;
449
+ last_updated?: string;
450
+ kind?: "long" | "short";
393
451
  }
394
452
  export type AppConfig = {
395
453
  fee: number;
@@ -442,13 +500,15 @@ export type ExtendConfigType = {
442
500
  kind?: "long" | "short";
443
501
  gap?: number;
444
502
  rr?: number;
503
+ min_avg_size?: number;
445
504
  use_kelly?: boolean;
446
505
  kelly_confidence_factor?: number;
447
506
  kelly_minimum_risk?: number;
448
507
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
449
508
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
509
+ distribution?: GetEntriesParams["distribution"];
450
510
  };
451
- 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, }: ExtendConfigType): any[] | Signal;
511
+ 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;
452
512
  export declare function buildAvg({ _trades, kind, }: {
453
513
  _trades: any[];
454
514
  kind: "long" | "short";
@@ -463,6 +523,7 @@ export declare function get_app_config_and_max_size(config: GlobalConfig, payloa
463
523
  kelly_minimum_risk?: number;
464
524
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
465
525
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
526
+ distribution?: GetEntriesParams["distribution"];
466
527
  }): {
467
528
  app_config: AppConfig;
468
529
  max_size: any;
@@ -487,11 +548,13 @@ export declare function buildAppConfig(config: GlobalConfig, payload: {
487
548
  kelly_minimum_risk?: number;
488
549
  kelly_prediction_model?: "exponential" | "normal" | "uniform";
489
550
  kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
551
+ distribution?: GetEntriesParams["distribution"];
490
552
  }): AppConfig;
491
553
  export declare function getOptimumStopAndRisk(app_config: AppConfig, params: {
492
554
  max_size: number;
493
555
  target_stop: number;
494
556
  highest_risk?: number;
557
+ distribution?: GetEntriesParams["distribution"];
495
558
  }): {
496
559
  optimal_stop: number;
497
560
  optimal_risk: number;
@@ -548,6 +611,7 @@ export declare function generateOptimumAppConfig(config: GlobalConfig, payload:
548
611
  risk_reward: number;
549
612
  start_risk: number;
550
613
  max_risk?: number;
614
+ distribution?: GetEntriesParams["distribution"];
551
615
  }, position: {
552
616
  entry: number;
553
617
  quantity: number;
@@ -559,6 +623,7 @@ export declare function determineOptimumReward(payload: {
559
623
  low_range?: number;
560
624
  high_range?: number;
561
625
  target_loss?: number;
626
+ distribution?: GetEntriesParams["distribution"];
562
627
  }): number | {
563
628
  result: any[];
564
629
  value: number;
@@ -575,6 +640,7 @@ export declare function determineOptimumRisk(config: GlobalConfig, payload: {
575
640
  risk_reward: number;
576
641
  risk: number;
577
642
  symbol: string;
643
+ distribution?: GetEntriesParams["distribution"];
578
644
  }, params: {
579
645
  highest_risk: number;
580
646
  tolerance?: number;
@@ -596,6 +662,7 @@ export declare function computeRiskReward(payload: {
596
662
  stop: number;
597
663
  risk_per_trade: number;
598
664
  target_loss?: number;
665
+ distribution?: GetEntriesParams["distribution"];
599
666
  }): number | {
600
667
  result: any[];
601
668
  value: number;
@@ -613,6 +680,7 @@ export declare function getRiskReward(payload: {
613
680
  global_config: GlobalConfig;
614
681
  force_exact_risk?: boolean;
615
682
  target_loss?: number;
683
+ distribution?: GetEntriesParams["distribution"];
616
684
  }): any;
617
685
  export declare function computeProfitDetail(payload: {
618
686
  focus_position: {
@@ -703,6 +771,34 @@ export declare function generateGapTp(payload: {
703
771
  gap: number;
704
772
  gap_loss: number;
705
773
  };
774
+ export declare function calculateFactorFromTakeProfit(payload: {
775
+ long: {
776
+ entry: number;
777
+ quantity: number;
778
+ };
779
+ short: {
780
+ entry: number;
781
+ quantity: number;
782
+ };
783
+ knownTp: number;
784
+ tpType: "long" | "short";
785
+ price_places?: string;
786
+ }): number;
787
+ export declare function calculateFactorFromSellQuantity(payload: {
788
+ long: {
789
+ entry: number;
790
+ quantity: number;
791
+ };
792
+ short: {
793
+ entry: number;
794
+ quantity: number;
795
+ };
796
+ knownSellQuantity: number;
797
+ sellType: "long" | "short";
798
+ sell_factor?: number;
799
+ price_places?: string;
800
+ decimal_places?: string;
801
+ }): number;
706
802
  export declare function determineRewardFactor(payload: {
707
803
  quantity: number;
708
804
  avg_qty: number;
@@ -812,7 +908,41 @@ export declare function constructAppConfig(payload: {
812
908
  kelly_minimum_risk: number;
813
909
  kelly_prediction_model: string;
814
910
  };
815
- }): AppConfig;
911
+ }): {
912
+ fee: number;
913
+ risk_per_trade: number;
914
+ risk_reward: number;
915
+ symbol?: string;
916
+ focus: number;
917
+ budget: number;
918
+ support: number;
919
+ resistance: number;
920
+ percent_change: number;
921
+ tradeSplit?: number;
922
+ take_profit?: number;
923
+ kind: "long" | "short";
924
+ entry: number;
925
+ stop: number;
926
+ min_size: number;
927
+ price_places?: string;
928
+ strategy?: "quantity" | "entry";
929
+ as_array?: boolean;
930
+ decimal_places?: string;
931
+ min_profit?: number;
932
+ raw?: boolean;
933
+ gap?: number;
934
+ rr?: number;
935
+ max_size?: number;
936
+ last_value?: any;
937
+ max_quantity?: number;
938
+ kelly?: {
939
+ use_kelly?: boolean;
940
+ kelly_confidence_factor?: number;
941
+ kelly_minimum_risk?: number;
942
+ kelly_prediction_model?: "exponential" | "normal" | "uniform";
943
+ kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
944
+ };
945
+ };
816
946
  export declare function generateDangerousConfig(payload: {
817
947
  account: PositionsView;
818
948
  global_config: GlobalConfig;