Record Class PortfolioBacktester.Config
java.lang.Object
java.lang.Record
com.quantfinlib.backtest.portfolio.PortfolioBacktester.Config
- Enclosing class:
PortfolioBacktester
public static record PortfolioBacktester.Config(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel)
extends Record
costModel, when set, supersedes the flat commissionRate
for every trade (rebalances and forced index-drop sales alike) — the
shared TradeCostModel seam that makes a run simultaneously
survivorship-aware AND execution-aware. Null keeps the legacy flat
commission behavior exactly.-
Constructor Summary
ConstructorsConstructorDescriptionConfig(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel) Creates an instance of aConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thecommissionRaterecord component.Returns the value of thecostModelrecord component.static PortfolioBacktester.Configdefaults()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.intReturns the value of therebalanceEveryBarsrecord component.final StringtoString()Returns a string representation of this record class.withCostModel(TradeCostModel model) Pluggable per-trade costs (e.g.withRebalanceEvery(int bars)
-
Constructor Details
-
Config
public Config(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel) Creates an instance of aConfigrecord class.- Parameters:
initialCapital- the value for theinitialCapitalrecord componentcommissionRate- the value for thecommissionRaterecord componentrebalanceEveryBars- the value for therebalanceEveryBarsrecord componentperiodsPerYear- the value for theperiodsPerYearrecord componentcostModel- the value for thecostModelrecord component
-
-
Method Details
-
defaults
-
withRebalanceEvery
-
withCostModel
Pluggable per-trade costs (e.g.TradeCostModel.institutional). -
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. Reference components are compared withObjects::equals(Object,Object); primitive components 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
-
rebalanceEveryBars
public int rebalanceEveryBars()Returns the value of therebalanceEveryBarsrecord component.- Returns:
- the value of the
rebalanceEveryBarsrecord component
-
periodsPerYear
public int periodsPerYear()Returns the value of theperiodsPerYearrecord component.- Returns:
- the value of the
periodsPerYearrecord component
-
costModel
Returns the value of thecostModelrecord component.- Returns:
- the value of the
costModelrecord component
-