nexustrade 1.22.0 → 1.23.0

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.
@@ -15,6 +15,7 @@ exports.ChaikinMoneyFlow = ChaikinMoneyFlow;
15
15
  exports.CommodityChannelIndex = CommodityChannelIndex;
16
16
  exports.CompoundAnnualGrowthRate = CompoundAnnualGrowthRate;
17
17
  exports.ConsecutiveTrue = ConsecutiveTrue;
18
+ exports.Correlation = Correlation;
18
19
  exports.CountTrue = CountTrue;
19
20
  exports.CrossAbove = CrossAbove;
20
21
  exports.CrossBelow = CrossBelow;
@@ -640,6 +641,18 @@ function ConsecutiveTrue(condition, length = 1, interval = "Day") {
640
641
  d.window = { length: length, interval: interval };
641
642
  return d;
642
643
  }
644
+ /**
645
+ * Correlation indicator.
646
+ * @param operands Sub-indicators this compound operates on.
647
+ * @param length Length of time
648
+ * @param interval Unit of time
649
+ */
650
+ function Correlation(operands, length = 60, interval = "Day") {
651
+ const d = { type: "Correlation" };
652
+ d.indicators = operands;
653
+ d.window = { length: length, interval: interval };
654
+ return d;
655
+ }
643
656
  /**
644
657
  * CountTrue indicator.
645
658
  * @param condition Condition evaluated over the window.
@@ -751,6 +751,13 @@ export declare function CompoundAnnualGrowthRate(asset: AssetArg, metric: Fundam
751
751
  * @param interval Unit of time
752
752
  */
753
753
  export declare function ConsecutiveTrue(condition: Condition, length?: number, interval?: Interval): Indicator;
754
+ /**
755
+ * Correlation indicator.
756
+ * @param operands Sub-indicators this compound operates on.
757
+ * @param length Length of time
758
+ * @param interval Unit of time
759
+ */
760
+ export declare function Correlation(operands: Indicator[], length?: number, interval?: Interval): Indicator;
754
761
  /**
755
762
  * CountTrue indicator.
756
763
  * @param condition Condition evaluated over the window.
@@ -1466,7 +1473,7 @@ export declare function WilliamsR(asset: AssetArg, length?: number, interval?: I
1466
1473
  * Year indicator.
1467
1474
  */
1468
1475
  export declare function Year(): Indicator;
1469
- export type FitnessFunction = "sharpeRatio" | "sortinoRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment";
1476
+ export type FitnessFunction = "sharpeRatio" | "sortinoRatio" | "winRate" | "profitFactor" | "calmarRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment";
1470
1477
  export interface FeeAmount {
1471
1478
  amount: number;
1472
1479
  type: "percent" | "dollars";
@@ -1553,7 +1560,7 @@ export interface WalkForwardConfig {
1553
1560
  trainingPercent?: number;
1554
1561
  /** Inner rolling window overlap percent (default 50). Range 0..95. */
1555
1562
  windowOverlapPercent?: number;
1556
- fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1563
+ fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "winRate" | "profitFactor" | "calmarRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1557
1564
  /** Winner selection policy (objectives, constraints, tieBreakers). Applies to sweep leaderboard and fold winner selection. For GA WF, also sets NSGA-II activity constraints when fold_selection_policy is omitted. */
1558
1565
  selectionPolicy?: SelectionPolicy;
1559
1566
  /** Explicit fold winner selection policy. Overrides selection_policy for fold winner pick. When set, train→validation degradation penalty defaults to 0.5 unless degradation_penalty is set. */
@@ -1595,8 +1602,8 @@ export interface OptimizationConfig {
1595
1602
  startDate: string;
1596
1603
  /** Optimization end date (ISO format, e.g. 2024-12-31). Minute selected range plus minute-indicator warmup cannot exceed 730 days of minute data. */
1597
1604
  endDate: string;
1598
- /** Fitness functions: sharpeRatio, sortinoRatio, maxDrawdown, avgDrawdown, percentChange, dollarsSold, ulcerPerformanceIndex, participationRate, distinctUnderlyingsTraded, medianDeployment */
1599
- fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1605
+ /** Fitness functions: sharpeRatio, sortinoRatio, winRate, profitFactor, calmarRatio, maxDrawdown, avgDrawdown, percentChange, dollarsSold, ulcerPerformanceIndex, participationRate, distinctUnderlyingsTraded, medianDeployment */
1606
+ fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "winRate" | "profitFactor" | "calmarRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1600
1607
  /** Population size for genetic algorithm (default 6, range 3-12) Range 3..12. */
1601
1608
  populationSize?: number;
1602
1609
  /** Number of generations (default 6, max 10) Range 1..10. */
@@ -450,6 +450,18 @@ export function ConsecutiveTrue(condition, length = 1, interval = "Day") {
450
450
  d.window = { length: length, interval: interval };
451
451
  return d;
452
452
  }
453
+ /**
454
+ * Correlation indicator.
455
+ * @param operands Sub-indicators this compound operates on.
456
+ * @param length Length of time
457
+ * @param interval Unit of time
458
+ */
459
+ export function Correlation(operands, length = 60, interval = "Day") {
460
+ const d = { type: "Correlation" };
461
+ d.indicators = operands;
462
+ d.window = { length: length, interval: interval };
463
+ return d;
464
+ }
453
465
  /**
454
466
  * CountTrue indicator.
455
467
  * @param condition Condition evaluated over the window.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexustrade",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "Typed TypeScript SDK for NexusTrade portfolio authoring, backtesting, and optimization",
5
5
  "license": "MIT",
6
6
  "author": "Starks Technology",