@gbozee/ultimate 0.0.2-next.0 → 0.0.2-next.4

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/index.d.ts CHANGED
@@ -1207,6 +1207,16 @@ export type SignalConfigType = {
1207
1207
  stdDevFactor?: number;
1208
1208
  lambda?: number;
1209
1209
  };
1210
+ use_progressive_risk?: boolean;
1211
+ risk_distribution?: {
1212
+ enabled: boolean;
1213
+ total_risk_budget: number;
1214
+ risk_reward: number;
1215
+ buckets: Array<{
1216
+ zone_percentage: number;
1217
+ risk_percentage: number;
1218
+ }>;
1219
+ };
1210
1220
  };
1211
1221
  declare class Signal {
1212
1222
  focus: number;
@@ -1244,8 +1254,18 @@ declare class Signal {
1244
1254
  long: GetEntriesParams["distribution"];
1245
1255
  short: GetEntriesParams["distribution"];
1246
1256
  };
1257
+ use_progressive_risk?: boolean;
1258
+ risk_distribution?: {
1259
+ enabled: boolean;
1260
+ total_risk_budget: number;
1261
+ risk_reward: number;
1262
+ buckets: Array<{
1263
+ zone_percentage: number;
1264
+ risk_percentage: number;
1265
+ }>;
1266
+ };
1247
1267
  max_quantity: number;
1248
- 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);
1268
+ 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, use_progressive_risk, risk_distribution, }: SignalConfigType);
1249
1269
  build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, distribution, distribution_params, }: {
1250
1270
  take_profit?: number;
1251
1271
  no_of_trades?: number;
@@ -1260,6 +1280,11 @@ declare class Signal {
1260
1280
  curveFactor?: number;
1261
1281
  stdDevFactor?: number;
1262
1282
  lambda?: number;
1283
+ use_progressive?: boolean;
1284
+ buckets?: Array<{
1285
+ zone_percentage: number;
1286
+ risk_percentage: number;
1287
+ }>;
1263
1288
  };
1264
1289
  }): any;
1265
1290
  get risk(): number;
@@ -1310,6 +1335,14 @@ declare class Signal {
1310
1335
  kind?: "long" | "short";
1311
1336
  }): number[][];
1312
1337
  get_margin_range(current_price: number, kind?: string): number[];
1338
+ /**
1339
+ * Helper function to calculate zone-specific risk based on progressive risk distribution
1340
+ * @param index - The index of the current zone
1341
+ * @param totalZones - Total number of zones
1342
+ * @param account - Account configuration with risk settings
1343
+ * @returns The risk amount for the specific zone
1344
+ */
1345
+ private getZoneRisk;
1313
1346
  process_orders({ current_price, stop_loss, trade_zones, kind, }: {
1314
1347
  current_price: number;
1315
1348
  stop_loss: number;
@@ -1410,9 +1443,15 @@ export type ExtendConfigType = {
1410
1443
  curveFactor?: number;
1411
1444
  stdDevFactor?: number;
1412
1445
  lambda?: number;
1446
+ buckets?: Array<{
1447
+ zone_percentage: number;
1448
+ risk_percentage: number;
1449
+ }>;
1450
+ use_progressive?: boolean;
1413
1451
  };
1452
+ use_progressive_risk?: boolean;
1414
1453
  };
1415
- 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;
1454
+ 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, use_progressive_risk, }: ExtendConfigType): any[] | Signal;
1416
1455
  export declare function buildAvg({ _trades, kind, }: {
1417
1456
  _trades: any[];
1418
1457
  kind: "long" | "short";
@@ -2417,6 +2456,7 @@ export declare class ExchangePosition {
2417
2456
  stdDevFactor?: number;
2418
2457
  lambda?: number;
2419
2458
  };
2459
+ use_progressive_risk?: boolean;
2420
2460
  }): Promise<AppConfig>;
2421
2461
  placeConfigOrders(app_config: AppConfig, solution: {
2422
2462
  risk_reward: number;
@@ -2439,6 +2479,7 @@ export declare class ExchangePosition {
2439
2479
  stdDevFactor?: number;
2440
2480
  lambda?: number;
2441
2481
  };
2482
+ use_progressive_risk?: boolean;
2442
2483
  }, place?: boolean, skip_stop?: boolean): Promise<{
2443
2484
  entry_orders: {
2444
2485
  orders: {
@@ -2630,8 +2671,10 @@ export declare class ExchangePosition {
2630
2671
  }): Promise<any>;
2631
2672
  buildTrades(payload: {
2632
2673
  risk?: number;
2674
+ use_progressive_risk?: boolean;
2633
2675
  }): Promise<{
2634
2676
  trades: any[];
2677
+ actual_trades: any[];
2635
2678
  max_size: any;
2636
2679
  last_price: any;
2637
2680
  total_size: number;
@@ -2925,6 +2968,7 @@ declare class ExchangeAccount$1 {
2925
2968
  risk?: number;
2926
2969
  }): Promise<{
2927
2970
  trades: any[];
2971
+ actual_trades: any[];
2928
2972
  max_size: any;
2929
2973
  last_price: any;
2930
2974
  total_size: number;