Class CsvLoaderUtils

    • Method Detail

      • parseEtdVariant

        public static Pair<YearMonth,​EtdVariant> parseEtdVariant​(CsvRow row,
                                                                       EtdType type)
        Parses the year-month and variant.
        Parameters:
        row - the CSV row to parse
        type - the ETD type
        Returns:
        the expiry year-month and variant
        Throws:
        IllegalArgumentException - if the row cannot be parsed
      • parseEtdSettlementType

        public static EtdSettlementType parseEtdSettlementType​(String str)
        Parses the ETD settlement type from the short code or full name.
        Parameters:
        str - the string to parse
        Returns:
        the settlement type
        Throws:
        IllegalArgumentException - if the string cannot be parsed
      • parseEtdOptionType

        public static EtdOptionType parseEtdOptionType​(String str)
        Parses the ETD option type from the short code or full name.
        Parameters:
        str - the string to parse
        Returns:
        the option type
        Throws:
        IllegalArgumentException - if the string cannot be parsed
      • parseQuantity

        public static DoublesPair parseQuantity​(CsvRow row)
        Parses the quantity.
        Parameters:
        row - the CSV row to parse
        Returns:
        the quantity, long first, short second
        Throws:
        IllegalArgumentException - if the row cannot be parsed
      • formattedPercentage

        public static String formattedPercentage​(double value)
        Returns a value formatted as a percentage.

        Using this method avoids nasty effects from floating point arithmetic.

        Parameters:
        value - the value in decimal format (to be multiplied by 100)
        Returns:
        the formatted percentage value
      • formattedDouble

        public static String formattedDouble​(double value)
        Returns a value formatted as a double.

        Using this method avoids nasty effects from floating point arithmetic.

        Parameters:
        value - the value
        Returns:
        the formatted value