Record Class PortfolioBacktester.Financing

java.lang.Object
java.lang.Record
com.quantfinlib.backtest.portfolio.PortfolioBacktester.Financing
Record Components:
cashRate - rate earned on positive cash (0.03 = 3%)
marginRate - rate paid on negative cash (leverage)
defaultBorrowBps - borrow fee on short notional, bps per year
borrowBpsBySymbol - per-symbol borrow fee overrides (hard-to-borrow names)
Enclosing class:
PortfolioBacktester

public static record PortfolioBacktester.Financing(double cashRate, double marginRate, double defaultBorrowBps, Map<String,Double> borrowBpsBySymbol) extends Record
Financing terms, all annual.
  • Constructor Details

    • Financing

      public Financing(double cashRate, double marginRate, double defaultBorrowBps, Map<String,Double> borrowBpsBySymbol)
      Creates an instance of a Financing record class.
      Parameters:
      cashRate - the value for the cashRate record component
      marginRate - the value for the marginRate record component
      defaultBorrowBps - the value for the defaultBorrowBps record component
      borrowBpsBySymbol - the value for the borrowBpsBySymbol record component
  • Method Details

    • none

      public static PortfolioBacktester.Financing none()
      No financing: cash, leverage and shorts are free.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • cashRate

      public double cashRate()
      Returns the value of the cashRate record component.
      Returns:
      the value of the cashRate record component
    • marginRate

      public double marginRate()
      Returns the value of the marginRate record component.
      Returns:
      the value of the marginRate record component
    • defaultBorrowBps

      public double defaultBorrowBps()
      Returns the value of the defaultBorrowBps record component.
      Returns:
      the value of the defaultBorrowBps record component
    • borrowBpsBySymbol

      public Map<String,Double> borrowBpsBySymbol()
      Returns the value of the borrowBpsBySymbol record component.
      Returns:
      the value of the borrowBpsBySymbol record component