Record Class PortfolioOptimizer.Allocation
java.lang.Object
java.lang.Record
com.quantfinlib.optimization.PortfolioOptimizer.Allocation
- Enclosing class:
PortfolioOptimizer
public static record PortfolioOptimizer.Allocation(double[] weights, double expectedReturn, double volatility, double sharpe)
extends Record
An optimized allocation with its risk/return profile (same periodicity as the inputs).
-
Constructor Summary
ConstructorsConstructorDescriptionAllocation(double[] weights, double expectedReturn, double volatility, double sharpe) Creates an instance of aAllocationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.doubleReturns the value of theexpectedReturnrecord component.final inthashCode()Returns a hash code value for this object.doublesharpe()Returns the value of thesharperecord component.final StringtoString()Returns a string representation of this record class.doubleReturns the value of thevolatilityrecord component.double[]weights()Returns the value of theweightsrecord component.
-
Constructor Details
-
Allocation
public Allocation(double[] weights, double expectedReturn, double volatility, double sharpe) Creates an instance of aAllocationrecord class.- Parameters:
weights- the value for theweightsrecord componentexpectedReturn- the value for theexpectedReturnrecord componentvolatility- the value for thevolatilityrecord componentsharpe- the value for thesharperecord 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
weights
public double[] weights()Returns the value of theweightsrecord component.- Returns:
- the value of the
weightsrecord component
-
expectedReturn
public double expectedReturn()Returns the value of theexpectedReturnrecord component.- Returns:
- the value of the
expectedReturnrecord component
-
volatility
public double volatility()Returns the value of thevolatilityrecord component.- Returns:
- the value of the
volatilityrecord component
-
sharpe
public double sharpe()Returns the value of thesharperecord component.- Returns:
- the value of the
sharperecord component
-