Package com.opengamma.strata.loader.csv
Class FixingSeriesCsvLoader
- java.lang.Object
-
- com.opengamma.strata.loader.csv.FixingSeriesCsvLoader
-
public final class FixingSeriesCsvLoader extends Object
Loads a set of historical fixing series into memory from CSV resources.The resources are expected to be in a CSV format, with the following header row:
Reference, Date, Value
.- The 'Reference' column is the name of the index that the data is for, such as 'USD-LIBOR-3M'.
- The 'Date' column is the date that the fixing was taken, this should be a year-month for price indices.
- The 'Value' column is the fixed value.
Each fixing series must be contained entirely within a single resource, but each resource may contain more than one series. The fixing series points do not need to be ordered.
For example:
Reference, Date, Value USD-LIBOR-3M, 1971-01-04, 0.065 USD-LIBOR-3M, 1971-01-05, 0.0638 USD-LIBOR-3M, 1971-01-06, 0.0638
Note that Microsoft Excel prefers the CSV file to have no space after the comma.CSV files sometimes contain a Unicode Byte Order Mark. Callers are responsible for handling this, such as by using
UnicodeBom
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ImmutableMap<ObservableId,LocalDateDoubleTimeSeries>
load(ResourceLocator... resources)
Loads one or more CSV format fixing series files.static ImmutableMap<ObservableId,LocalDateDoubleTimeSeries>
load(Collection<ResourceLocator> resources)
Loads one or more CSV format fixing series files.static ImmutableMap<ObservableId,LocalDateDoubleTimeSeries>
parse(Collection<CharSource> charSources)
Parses one or more CSV format fixing series files.
-
-
-
Method Detail
-
load
public static ImmutableMap<ObservableId,LocalDateDoubleTimeSeries> load(ResourceLocator... resources)
Loads one or more CSV format fixing series files.If the files contain a duplicate entry an exception will be thrown.
- Parameters:
resources
- the fixing series CSV resources- Returns:
- the loaded fixing series, mapped by observable ID
- Throws:
IllegalArgumentException
- if the files contain a duplicate entry
-
load
public static ImmutableMap<ObservableId,LocalDateDoubleTimeSeries> load(Collection<ResourceLocator> resources)
Loads one or more CSV format fixing series files.If the files contain a duplicate entry an exception will be thrown.
- Parameters:
resources
- the fixing series CSV resources- Returns:
- the loaded fixing series, mapped by observable ID
- Throws:
IllegalArgumentException
- if the files contain a duplicate entry
-
parse
public static ImmutableMap<ObservableId,LocalDateDoubleTimeSeries> parse(Collection<CharSource> charSources)
Parses one or more CSV format fixing series files.If the files contain a duplicate entry an exception will be thrown.
- Parameters:
charSources
- the fixing series CSV character sources- Returns:
- the loaded fixing series, mapped by observable ID
- Throws:
IllegalArgumentException
- if the files contain a duplicate entry
-
-