Record Class Backtester.State
java.lang.Object
java.lang.Record
com.quantfinlib.backtest.Backtester.State
- Record Components:
cash- cash heldquantity- shares held (0 = flat)entryPrice- fill price of the open position (stops key off it)entryCost- cash committed at entryentryIndex- absolute bar index of the entryentryTime- timestamp of the entry barpending- signal decided on the last bar and not yet filled
- Enclosing class:
Backtester
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecash()Returns the value of thecashrecord component.doubleReturns the value of theentryCostrecord component.intReturns the value of theentryIndexrecord component.doubleReturns the value of theentryPricerecord component.longReturns the value of theentryTimerecord component.final booleanIndicates whether some other object is "equal to" this one.static Backtester.Stateflat(double capital) Flat book withcapitalin cash.final inthashCode()Returns a hash code value for this object.pending()Returns the value of thependingrecord component.doublequantity()Returns the value of thequantityrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
State
public State(double cash, double quantity, double entryPrice, double entryCost, int entryIndex, long entryTime, Signal pending) Creates an instance of aStaterecord class.- Parameters:
cash- the value for thecashrecord componentquantity- the value for thequantityrecord componententryPrice- the value for theentryPricerecord componententryCost- the value for theentryCostrecord componententryIndex- the value for theentryIndexrecord componententryTime- the value for theentryTimerecord componentpending- the value for thependingrecord component
-
-
Method Details
-
flat
Flat book withcapitalin cash. -
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. -
cash
-
quantity
-
entryPrice
public double entryPrice()Returns the value of theentryPricerecord component.- Returns:
- the value of the
entryPricerecord component
-
entryCost
-
entryIndex
public int entryIndex()Returns the value of theentryIndexrecord component.- Returns:
- the value of the
entryIndexrecord component
-
entryTime
-
pending
-