Class FixingSeriesCsvLoader


  • public final class FixingSeriesCsvLoader
    extends java.lang.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 Detail

      • load

        public static com.google.common.collect.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:
        java.lang.IllegalArgumentException - if the files contain a duplicate entry
      • load

        public static com.google.common.collect.ImmutableMap<ObservableId,​LocalDateDoubleTimeSeries> load​(java.util.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:
        java.lang.IllegalArgumentException - if the files contain a duplicate entry
      • parse

        public static com.google.common.collect.ImmutableMap<ObservableId,​LocalDateDoubleTimeSeries> parse​(java.util.Collection<com.google.common.io.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:
        java.lang.IllegalArgumentException - if the files contain a duplicate entry