Record Class PortfolioBacktester.Config
java.lang.Object
java.lang.Record
com.quantfinlib.backtest.portfolio.PortfolioBacktester.Config
- Record Components:
fillPolicy- when a decision fills (defaultNEXT_OPEN)financing- cash, margin and borrow rates (default none)
- Enclosing class:
PortfolioBacktester
public static record PortfolioBacktester.Config(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel, FillPolicy fillPolicy, PortfolioBacktester.Financing financing)
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 survivorship-aware
and execution-aware at once. Null keeps the flat commission.-
Constructor Summary
ConstructorsConstructorDescriptionConfig(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel) Next-open fills, no financing.Config(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel, FillPolicy fillPolicy, PortfolioBacktester.Financing financing) 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.Returns the value of thefillPolicyrecord component.Returns the value of thefinancingrecord component.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.withFillPolicy(FillPolicy policy) withRebalanceEvery(int bars)
-
Constructor Details
-
Config
public Config(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel, FillPolicy fillPolicy, PortfolioBacktester.Financing financing) 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 componentfillPolicy- the value for thefillPolicyrecord componentfinancing- the value for thefinancingrecord component
-
Config
public Config(double initialCapital, double commissionRate, int rebalanceEveryBars, int periodsPerYear, TradeCostModel costModel) Next-open fills, no financing.
-
-
Method Details
-
defaults
-
withRebalanceEvery
-
withCostModel
Pluggable per-trade costs (e.g.TradeCostModel.institutional). -
withFillPolicy
-
withFinancing
-
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
-
fillPolicy
Returns the value of thefillPolicyrecord component.- Returns:
- the value of the
fillPolicyrecord component
-
financing
-