java.lang.Object
net.finmath.parser.CSVSwaptionParser
Provides options to parse
SwaptionDataLattice
from csv files.- Author:
- Roland Bachl
-
Constructor Summary
ConstructorsConstructorDescriptionCSVSwaptionParser(String[] maturities, String[] tenors, SchedulePrototype fixMetaSchedule, SchedulePrototype floatMetaSchedule)
Create the parser with filter on maturities and tenors.CSVSwaptionParser(SchedulePrototype fixMetaSchedule, SchedulePrototype floatMetaSchedule)
Create the parser with no filter on the maturities and tenors. -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalDate[]
getReferenceDates(SwaptionDataLattice[] lattices)
Extract the reference date of each SwaptionDataLattice in an array.parseCSV(File atmFile, File otmFile, LocalDate referenceDate, String currency, String index, String discountCurveName)
Extract a single lattice from the pair of csv files.parseCSVMultiShift(File atmFile, File otmFile, LocalDate referenceDate, String currency, String index, String discountCurveName)
Extract a set of lattices from the pair of csv files.parseTenorsPerShift(File atmFile, String currency)
Create a map overview of which tenors in the given csv file share the same displacement.Extract an array of SwaptionDataLattice from the zip files.parseZIPToConvention(File atmFile, File otmFile, String currency, String index, String discountCurveName, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel... models)
Extract an array of SwaptionDataLattice from the zip files.void
setFileQuotingConvention(SwaptionDataLattice.QuotingConvention fileQuotingConvention, double fileQuotingUnit, double fileQuotingUnitForDisplacement)
Set the quoting convention used in the files, together with their unit and the unit of the displacement.
-
Constructor Details
-
CSVSwaptionParser
Create the parser with no filter on the maturities and tenors.- Parameters:
fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.
-
CSVSwaptionParser
public CSVSwaptionParser(String[] maturities, String[] tenors, SchedulePrototype fixMetaSchedule, SchedulePrototype floatMetaSchedule)Create the parser with filter on maturities and tenors.- Parameters:
maturities
- The maturities, which the parser should consider.tenors
- The tenors, which the parser should consider.fixMetaSchedule
- The conventions used for the fixed leg of the swaptions.floatMetaSchedule
- The conventions used for the float leg of the swaptions.
-
-
Method Details
-
setFileQuotingConvention
public void setFileQuotingConvention(SwaptionDataLattice.QuotingConvention fileQuotingConvention, double fileQuotingUnit, double fileQuotingUnitForDisplacement)Set the quoting convention used in the files, together with their unit and the unit of the displacement. Values and shifts parsed are multiplied by this unit.- Parameters:
fileQuotingConvention
- The quoting convention.fileQuotingUnit
- The quoting unit (a scaling factor).fileQuotingUnitForDisplacement
- The unit of the displacement (a scaling factor).
-
parseCSV
public SwaptionDataLattice parseCSV(File atmFile, File otmFile, LocalDate referenceDate, String currency, String index, String discountCurveName) throws IOExceptionExtract a single lattice from the pair of csv files. The parser will not check that the files are aligned for the same reference date.- Parameters:
atmFile
- The file containing data on atm swpations.otmFile
- The file containing data on otm swaptions.referenceDate
- The reference date the swaptions should be created with respect to.currency
- The currency, which should be parsed from the files.index
- The index, which should be parsed from the files.discountCurveName
- The name of the discount curve, which should be used by the swaptions.- Returns:
- The lattice containing the data from the files.
- Throws:
IOException
- Thrown upon io error with File.
-
parseZIP
public SwaptionDataLattice[] parseZIP(File atmFile, File otmFile, String currency, String index, String discountCurveName) throws IOExceptionExtract an array of SwaptionDataLattice from the zip files. The reference dates will be taken from the names of the files inside the archives. The order of the files must be aligned inside the archives.- Parameters:
atmFile
- The archive containing data on atm swpations.otmFile
- The archive containing data on otm swaptions.currency
- The currency, which should be parsed from the files.index
- The index, which should be parsed from the files.discountCurveName
- The name of the discount curve, which should be used by the swaptions.- Returns:
- An array of lattices for each reference date.
- Throws:
IOException
- Thrown upon io error with File.
-
parseZIPToConvention
public SwaptionDataLattice[] parseZIPToConvention(File atmFile, File otmFile, String currency, String index, String discountCurveName, SwaptionDataLattice.QuotingConvention convention, double displacement, AnalyticModel... models) throws IOExceptionExtract an array of SwaptionDataLattice from the zip files. The data in the zip file will be converted to the given quoting convention before storing. The reference dates will be taken from the names of the files inside the archives. The order of the files must be aligned inside the archives. Only the data sets for which a model with matching reference date is provided will be evaluated.- Parameters:
atmFile
- The archive containing data on atm swpations.otmFile
- The archive containing data on otm swaptions.currency
- The currency, which should be parsed from the files.index
- The index, which should be parsed from the files.discountCurveName
- The name of the discount curve, which should be used by the swaptions.convention
- The quoting convention to store the data in.displacement
- The displacement to use, if storing in convention VOLATILITYLOGNORMALmodels
- The models for context to use for each data set top convert to convention.- Returns:
- An array of lattices for each reference date.
- Throws:
IOException
- Thrown upon io error with File.
-
parseCSVMultiShift
public Set<SwaptionDataLattice> parseCSVMultiShift(File atmFile, File otmFile, LocalDate referenceDate, String currency, String index, String discountCurveName) throws IOExceptionExtract a set of lattices from the pair of csv files. Each lattice contains data for matching displacements. The parser will not check that the files are alligned for the same reference date.- Parameters:
atmFile
- The file containing data on atm swpations.otmFile
- The file containing data on otm swaptions.referenceDate
- The reference date the swaptions should be created with respect to.currency
- The currency, which should be parsed from the files.index
- The index, which should be parsed from the files.discountCurveName
- The name of the discount curve, which should be used by the swaptions.- Returns:
- The lattices containing the data from the files.
- Throws:
IOException
- Thrown upon io error with atmFile.
-
parseTenorsPerShift
public Map<Double,Set<String>> parseTenorsPerShift(File atmFile, String currency) throws IOExceptionCreate a map overview of which tenors in the given csv file share the same displacement.- Parameters:
atmFile
- The file containing data on atm swpations.currency
- The currency, which should be parsed from the files.- Returns:
- A map overview of tenors per displacement.
- Throws:
IOException
- Thrown upon io error with atmFile.
-
getReferenceDates
Extract the reference date of each SwaptionDataLattice in an array.- Parameters:
lattices
- The array of lattices.- Returns:
- Array of the respective reference dates.
-