Class CSVCurveParser

java.lang.Object
net.finmath.parser.CSVCurveParser

public class CSVCurveParser extends Object
Provides options to parse curves.
Author:
Roland Bachl
  • Constructor Details

    • CSVCurveParser

      public CSVCurveParser()
      Set up the parser with default interpolation.
      • InterpolationMethod.LINEAR
      • ExtrapolationMethod.CONSTANT
      • InterpolationEntity.LOG_OF_VALUE_PER_TIME
    • CSVCurveParser

      public CSVCurveParser(CurveInterpolation.InterpolationMethod interpolationMethod, CurveInterpolation.ExtrapolationMethod extrapolationMethod, CurveInterpolation.InterpolationEntity interpolationEntity)
      Set up the parser with given interpolation.
      Parameters:
      interpolationMethod - The interpolation method.
      extrapolationMethod - The extrapolation method.
      interpolationEntity - The interpolation entity.
  • Method Details

    • parseCSV

      public DiscountCurve parseCSV(File file, String currency, String index) throws IOException
      Extract a single discount curve from a csv file.
      Parameters:
      file - The file to be parsed.
      currency - The currency of the curve.
      index - The index of the curve.
      Returns:
      The discount curve.
      Throws:
      IOException - Thrown upon an exception related to File.
    • parseZIP

      public DiscountCurve[] parseZIP(File file, String currency, String index) throws IOException
      Extract an arry of discount curves from a zip archive.
      Parameters:
      file - The archive to be parsed.
      currency - The currency of the curves.
      index - The index of the curves.
      Returns:
      The array of discount curves.
      Throws:
      IOException - Thrown upon an exception related to File.
    • setInterpolation

      public void setInterpolation(CurveInterpolation.InterpolationMethod interpolationMethod, CurveInterpolation.ExtrapolationMethod extrapolationMethod, CurveInterpolation.InterpolationEntity interpolationEntity)
      Set interpolation method for parsed curves.
      Parameters:
      interpolationMethod - The interpolation method.
      extrapolationMethod - The extrapolation method.
      interpolationEntity - The interpolation entity.
    • getReferenceDates

      public static LocalDate[] getReferenceDates(Curve[] curves)
      Extract the reference date of each curve in an array.
      Parameters:
      curves - The array of curves.
      Returns:
      Array of the respective reference dates.