Record Class PerformanceMetrics

java.lang.Object
java.lang.Record
com.quantfinlib.backtest.PerformanceMetrics

public record PerformanceMetrics(double totalReturn, double cagr, double annualizedReturn, double annualizedVolatility, double sharpeRatio, double sortinoRatio, double calmarRatio, double maxDrawdown, double profitFactor, double winRate, int tradeCount, double finalEquity) extends Record
Strategy performance analytics. Returns/drawdown are fractions; ratios are annualized.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PerformanceMetrics(double totalReturn, double cagr, double annualizedReturn, double annualizedVolatility, double sharpeRatio, double sortinoRatio, double calmarRatio, double maxDrawdown, double profitFactor, double winRate, int tradeCount, double finalEquity)
    Creates an instance of a PerformanceMetrics record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the value of the annualizedReturn record component.
    double
    Returns the value of the annualizedVolatility record component.
    double
    Returns the value of the cagr record component.
    double
    Returns the value of the calmarRatio record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    double
    Returns the value of the finalEquity record component.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the maxDrawdown record component.
    double
    Returns the value of the profitFactor record component.
    double
    Returns the value of the sharpeRatio record component.
    double
    Returns the value of the sortinoRatio record component.
    final String
    Returns a string representation of this record class.
    double
    Returns the value of the totalReturn record component.
    int
    Returns the value of the tradeCount record component.
    double
    Returns the value of the winRate record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PerformanceMetrics

      public PerformanceMetrics(double totalReturn, double cagr, double annualizedReturn, double annualizedVolatility, double sharpeRatio, double sortinoRatio, double calmarRatio, double maxDrawdown, double profitFactor, double winRate, int tradeCount, double finalEquity)
      Creates an instance of a PerformanceMetrics record class.
      Parameters:
      totalReturn - the value for the totalReturn record component
      cagr - the value for the cagr record component
      annualizedReturn - the value for the annualizedReturn record component
      annualizedVolatility - the value for the annualizedVolatility record component
      sharpeRatio - the value for the sharpeRatio record component
      sortinoRatio - the value for the sortinoRatio record component
      calmarRatio - the value for the calmarRatio record component
      maxDrawdown - the value for the maxDrawdown record component
      profitFactor - the value for the profitFactor record component
      winRate - the value for the winRate record component
      tradeCount - the value for the tradeCount record component
      finalEquity - the value for the finalEquity record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • totalReturn

      public double totalReturn()
      Returns the value of the totalReturn record component.
      Returns:
      the value of the totalReturn record component
    • cagr

      public double cagr()
      Returns the value of the cagr record component.
      Returns:
      the value of the cagr record component
    • annualizedReturn

      public double annualizedReturn()
      Returns the value of the annualizedReturn record component.
      Returns:
      the value of the annualizedReturn record component
    • annualizedVolatility

      public double annualizedVolatility()
      Returns the value of the annualizedVolatility record component.
      Returns:
      the value of the annualizedVolatility record component
    • sharpeRatio

      public double sharpeRatio()
      Returns the value of the sharpeRatio record component.
      Returns:
      the value of the sharpeRatio record component
    • sortinoRatio

      public double sortinoRatio()
      Returns the value of the sortinoRatio record component.
      Returns:
      the value of the sortinoRatio record component
    • calmarRatio

      public double calmarRatio()
      Returns the value of the calmarRatio record component.
      Returns:
      the value of the calmarRatio record component
    • maxDrawdown

      public double maxDrawdown()
      Returns the value of the maxDrawdown record component.
      Returns:
      the value of the maxDrawdown record component
    • profitFactor

      public double profitFactor()
      Returns the value of the profitFactor record component.
      Returns:
      the value of the profitFactor record component
    • winRate

      public double winRate()
      Returns the value of the winRate record component.
      Returns:
      the value of the winRate record component
    • tradeCount

      public int tradeCount()
      Returns the value of the tradeCount record component.
      Returns:
      the value of the tradeCount record component
    • finalEquity

      public double finalEquity()
      Returns the value of the finalEquity record component.
      Returns:
      the value of the finalEquity record component