Class LegalEntityRatesCurvesCsvLoader


  • public class LegalEntityRatesCurvesCsvLoader
    extends java.lang.Object
    Loads a set of legal entity rates curves into memory by reading from CSV resources.

    There are three type of CSV files.

    The first file is the legal entity curve group metadata file. This file has the following header row:
    Group Name, Curve Type, Reference, Currency, Curve Name.

    • The 'Group Name' column is the name of the group of curves.
    • The 'Curve Type' column is the type of the curve, "repo" or "issuer".
    • The 'Reference' column is the reference group for which the curve is used, legal entity group or repo group.
    • The 'Currency' column is the reference currency for which the curve is used.
    • The 'Curve Name' column is the name of the curve.

    The second file is the curve settings metadata file. This file has the following header row:
    Curve Name, Value Type, Day Count, Interpolator, Left Extrapolator, Right Extrapolator.

    • The 'Curve Name' column is the name of the curve.
    • The 'Value Type' column is the type of data in the curve, "zero" for zero rates, or "df" for discount factors.
    • The 'Day Count' column is the name of the day count, such as "Act/365F".
    • The 'Interpolator' column defines the interpolator to use.
    • The 'Left Extrapolator' and 'Right Extrapolator' columns define the extrapolators to use.

    The third file is the curve values file. This file has the following header row:
    Valuation Date, Curve Name, Date, Value, Label.

    • The 'Valuation Date' column provides the valuation date, allowing data from different days to be stored in the same file
    • The 'Curve Name' column is the name of the curve.
    • The 'Date' column is the date associated with the node.
    • The 'Value' column is value of the curve at the date.
    • The 'Label' column is the label used to refer to the node.

    Each curve must be contained entirely within a single file, but each file may contain more than one curve. The curve points do not need to be ordered. The files must contain at least one repo curve and one issuer curve.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.google.common.collect.ImmutableList<LegalEntityCurveGroup> load​(java.time.LocalDate marketDataDate, ResourceLocator groupsResource, ResourceLocator settingsResource, java.util.Collection<ResourceLocator> curveValueResources)
      Loads one or more CSV format curve files for a specific date.
      static com.google.common.collect.ImmutableListMultimap<java.time.LocalDate,​LegalEntityCurveGroup> loadAllDates​(ResourceLocator groupsResource, ResourceLocator settingsResource, java.util.Collection<ResourceLocator> curveValueResources)
      Loads one or more CSV format curve files for all available dates.
      static com.google.common.collect.ImmutableListMultimap<java.time.LocalDate,​LegalEntityCurveGroup> parse​(java.util.function.Predicate<java.time.LocalDate> datePredicate, com.google.common.io.CharSource groupsCharSource, com.google.common.io.CharSource settingsCharSource, java.util.Collection<com.google.common.io.CharSource> curveValueCharSources)
      Parses one or more CSV format curve files for all available dates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LegalEntityRatesCurvesCsvLoader

        public LegalEntityRatesCurvesCsvLoader()
    • Method Detail

      • load

        public static com.google.common.collect.ImmutableList<LegalEntityCurveGroup> load​(java.time.LocalDate marketDataDate,
                                                                                          ResourceLocator groupsResource,
                                                                                          ResourceLocator settingsResource,
                                                                                          java.util.Collection<ResourceLocator> curveValueResources)
        Loads one or more CSV format curve files for a specific date.

        Only those quotes that match the specified date will be loaded.

        If the files contain a duplicate entry an exception will be thrown.

        Parameters:
        marketDataDate - the curve date to load
        groupsResource - the curve groups CSV resource
        settingsResource - the curve settings CSV resource
        curveValueResources - the CSV resources for curves
        Returns:
        the loaded curves, mapped by an identifying key
        Throws:
        java.lang.IllegalArgumentException - if the files contain a duplicate entry
      • loadAllDates

        public static com.google.common.collect.ImmutableListMultimap<java.time.LocalDate,​LegalEntityCurveGroup> loadAllDates​(ResourceLocator groupsResource,
                                                                                                                                    ResourceLocator settingsResource,
                                                                                                                                    java.util.Collection<ResourceLocator> curveValueResources)
        Loads one or more CSV format curve files for all available dates.

        If the files contain a duplicate entry an exception will be thrown.

        Parameters:
        groupsResource - the curve groups CSV resource
        settingsResource - the curve settings CSV resource
        curveValueResources - the CSV resources for curves
        Returns:
        the loaded curves, mapped by date and identifier
        Throws:
        java.lang.IllegalArgumentException - if the files contain a duplicate entry
      • parse

        public static com.google.common.collect.ImmutableListMultimap<java.time.LocalDate,​LegalEntityCurveGroup> parse​(java.util.function.Predicate<java.time.LocalDate> datePredicate,
                                                                                                                             com.google.common.io.CharSource groupsCharSource,
                                                                                                                             com.google.common.io.CharSource settingsCharSource,
                                                                                                                             java.util.Collection<com.google.common.io.CharSource> curveValueCharSources)
        Parses one or more CSV format curve files for all available dates.

        A predicate is specified that is used to filter the dates that are returned. This could match a single date, a set of dates or all dates.

        If the files contain a duplicate entry an exception will be thrown.

        Parameters:
        datePredicate - the predicate used to select the dates
        groupsCharSource - the curve groups CSV character source
        settingsCharSource - the curve settings CSV character source
        curveValueCharSources - the CSV character sources for curves
        Returns:
        the loaded curves, mapped by date and identifier
        Throws:
        java.lang.IllegalArgumentException - if the files contain a duplicate entry