Record Class BacktestConfig
java.lang.Object
java.lang.Record
com.quantfinlib.backtest.BacktestConfig
public record BacktestConfig(double initialCapital, double commissionRate, double slippageRate, double stopLossPct, double takeProfitPct, int periodsPerYear)
extends Record
Backtest execution parameters. Rates are fractions (0.001 = 10 bps).
stopLossPct/takeProfitPct of 0 disable the respective check;
a strategy's own stop/take-profit settings override zeros here.-
Constructor Summary
ConstructorsConstructorDescriptionBacktestConfig(double initialCapital, double commissionRate, double slippageRate, double stopLossPct, double takeProfitPct, int periodsPerYear) Creates an instance of aBacktestConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thecommissionRaterecord component.static BacktestConfigdefaults()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleReturns the value of theinitialCapitalrecord component.intReturns the value of theperiodsPerYearrecord component.doubleReturns the value of theslippageRaterecord component.doubleReturns the value of thestopLossPctrecord component.doubleReturns the value of thetakeProfitPctrecord component.final StringtoString()Returns a string representation of this record class.withCommission(double rate) withInitialCapital(double capital) withStopLoss(double pct) withTakeProfit(double pct)
-
Constructor Details
-
BacktestConfig
public BacktestConfig(double initialCapital, double commissionRate, double slippageRate, double stopLossPct, double takeProfitPct, int periodsPerYear) Creates an instance of aBacktestConfigrecord class.- Parameters:
initialCapital- the value for theinitialCapitalrecord componentcommissionRate- the value for thecommissionRaterecord componentslippageRate- the value for theslippageRaterecord componentstopLossPct- the value for thestopLossPctrecord componenttakeProfitPct- the value for thetakeProfitPctrecord componentperiodsPerYear- the value for theperiodsPerYearrecord component
-
-
Method Details
-
defaults
-
withInitialCapital
-
withCommission
-
withStopLoss
-
withTakeProfit
-
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. -
initialCapital
public double initialCapital()Returns the value of theinitialCapitalrecord component.- Returns:
- the value of the
initialCapitalrecord component
-
commissionRate
public double commissionRate()Returns the value of thecommissionRaterecord component.- Returns:
- the value of the
commissionRaterecord component
-
slippageRate
public double slippageRate()Returns the value of theslippageRaterecord component.- Returns:
- the value of the
slippageRaterecord component
-
stopLossPct
public double stopLossPct()Returns the value of thestopLossPctrecord component.- Returns:
- the value of the
stopLossPctrecord component
-
takeProfitPct
public double takeProfitPct()Returns the value of thetakeProfitPctrecord component.- Returns:
- the value of the
takeProfitPctrecord component
-
periodsPerYear
public int periodsPerYear()Returns the value of theperiodsPerYearrecord component.- Returns:
- the value of the
periodsPerYearrecord component
-