Class LegalEntityRatesCurvesCsvLoader


  • public class LegalEntityRatesCurvesCsvLoader
    extends 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 Detail

      • load

        public static ImmutableList<LegalEntityCurveGroup> load​(LocalDate marketDataDate,
                                                                ResourceLocator groupsResource,
                                                                ResourceLocator settingsResource,
                                                                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:
        IllegalArgumentException - if the files contain a duplicate entry
      • parse

        public static ImmutableListMultimap<LocalDate,​LegalEntityCurveGroup> parse​(Predicate<LocalDate> datePredicate,
                                                                                         CharSource groupsCharSource,
                                                                                         CharSource settingsCharSource,
                                                                                         Collection<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:
        IllegalArgumentException - if the files contain a duplicate entry