Interface TradeCsvParserPlugin

  • All Superinterfaces:
    Named

    public interface TradeCsvParserPlugin
    extends Named
    Pluggable CSV trade parser.

    Implementations of this interface parse a CSV file.

    See TradeCsvLoader for the main entry point to parsing.

    • Method Detail

      • extendedEnum

        static ExtendedEnum<TradeCsvParserPlugin> extendedEnum()
        Gets the extended enum helper.

        This helper allows instances of the parser to be looked up. It also provides the complete set of available instances.

        Returns:
        the extended enum helper
      • tradeTypeNames

        Set<String> tradeTypeNames()
        Returns the upper-case product type names that this plugin supports.

        These are matched against the CSV file type column.

        Returns:
        the types that this plugin supports
      • isAdditionalRow

        default boolean isAdditionalRow​(CsvRow baseRow,
                                        CsvRow additionalRow)
        Checks if there is an additional row that must be parsed alongside the base row.

        An example use for this is parsing variable notional swaps.

        Parameters:
        baseRow - the base row
        additionalRow - the additional row
        Returns:
        true if the base row and additional row must be parsed together
      • parseTrade

        Optional<Trade> parseTrade​(Class<?> requiredJavaType,
                                   CsvRow baseRow,
                                   List<CsvRow> additionalRows,
                                   TradeInfo info,
                                   TradeCsvInfoResolver resolver)
        Parses a single CSV format trade from the input.

        This parses a single trade from the CSV rows provided. The trade may exist on multiple rows

        Parameters:
        requiredJavaType - the Java type to return
        baseRow - the base row to parse
        additionalRows - the additional rows to parse, may be empty
        info - the trade info
        resolver - the resolver
        Returns:
        the trade object, empty if choosing not to parse because the Java type does not match
        Throws:
        RuntimeException - if unable to parse
      • getName

        String getName()
        Gets the name that uniquely identifies this parser.

        The name should typically be the name of the Product that can be parsed. For example, 'Fra', 'Swap' or 'FxSingle'.

        This name is used in serialization and can be parsed using of(String).

        Specified by:
        getName in interface Named
        Returns:
        the unique name