Record Class TradeAnalytics.Result
java.lang.Object
java.lang.Record
com.quantfinlib.backtest.TradeAnalytics.Result
- Record Components:
count- number of tradeswinRate- fraction of strictly-positive tradesexpectancy- average P&L per tradeavgWin- mean P&L of winning trades (0 if none)avgLoss- mean magnitude of losing trades (0 if none)payoffRatio- avgWin / avgLoss (+inf if no losers)maxWinStreak- longest run of consecutive winnersmaxLossStreak- longest run of consecutive loserskellyFraction- W - (1-W)/R, clamped to [0, 1]avgBarsHeldWinners- mean holding period of winnersavgBarsHeldLosers- mean holding period of losers
- Enclosing class:
TradeAnalytics
public static record TradeAnalytics.Result(int count, double winRate, double expectancy, double avgWin, double avgLoss, double payoffRatio, int maxWinStreak, int maxLossStreak, double kellyFraction, double avgBarsHeldWinners, double avgBarsHeldLosers)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionResult(int count, double winRate, double expectancy, double avgWin, double avgLoss, double payoffRatio, int maxWinStreak, int maxLossStreak, double kellyFraction, double avgBarsHeldWinners, double avgBarsHeldLosers) Creates an instance of aResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of theavgBarsHeldLosersrecord component.doubleReturns the value of theavgBarsHeldWinnersrecord component.doubleavgLoss()Returns the value of theavgLossrecord component.doubleavgWin()Returns the value of theavgWinrecord component.intcount()Returns the value of thecountrecord component.final booleanIndicates whether some other object is "equal to" this one.doubleReturns the value of theexpectancyrecord component.final inthashCode()Returns a hash code value for this object.doubleReturns the value of thekellyFractionrecord component.intReturns the value of themaxLossStreakrecord component.intReturns the value of themaxWinStreakrecord component.doubleReturns the value of thepayoffRatiorecord component.final StringtoString()Returns a string representation of this record class.doublewinRate()Returns the value of thewinRaterecord component.
-
Constructor Details
-
Result
public Result(int count, double winRate, double expectancy, double avgWin, double avgLoss, double payoffRatio, int maxWinStreak, int maxLossStreak, double kellyFraction, double avgBarsHeldWinners, double avgBarsHeldLosers) Creates an instance of aResultrecord class.- Parameters:
count- the value for thecountrecord componentwinRate- the value for thewinRaterecord componentexpectancy- the value for theexpectancyrecord componentavgWin- the value for theavgWinrecord componentavgLoss- the value for theavgLossrecord componentpayoffRatio- the value for thepayoffRatiorecord componentmaxWinStreak- the value for themaxWinStreakrecord componentmaxLossStreak- the value for themaxLossStreakrecord componentkellyFraction- the value for thekellyFractionrecord componentavgBarsHeldWinners- the value for theavgBarsHeldWinnersrecord componentavgBarsHeldLosers- the value for theavgBarsHeldLosersrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 thecomparemethod from their corresponding wrapper classes. -
count
-
winRate
-
expectancy
public double expectancy()Returns the value of theexpectancyrecord component.- Returns:
- the value of the
expectancyrecord component
-
avgWin
-
avgLoss
-
payoffRatio
public double payoffRatio()Returns the value of thepayoffRatiorecord component.- Returns:
- the value of the
payoffRatiorecord component
-
maxWinStreak
public int maxWinStreak()Returns the value of themaxWinStreakrecord component.- Returns:
- the value of the
maxWinStreakrecord component
-
maxLossStreak
public int maxLossStreak()Returns the value of themaxLossStreakrecord component.- Returns:
- the value of the
maxLossStreakrecord component
-
kellyFraction
public double kellyFraction()Returns the value of thekellyFractionrecord component.- Returns:
- the value of the
kellyFractionrecord component
-
avgBarsHeldWinners
public double avgBarsHeldWinners()Returns the value of theavgBarsHeldWinnersrecord component.- Returns:
- the value of the
avgBarsHeldWinnersrecord component
-
avgBarsHeldLosers
public double avgBarsHeldLosers()Returns the value of theavgBarsHeldLosersrecord component.- Returns:
- the value of the
avgBarsHeldLosersrecord component
-