Interface TradeCsvInfoResolver


  • public interface TradeCsvInfoResolver
    Resolves additional information when parsing trade CSV files.

    Data loaded from a CSV may contain additional information that needs to be captured. This plugin point allows the additional CSV columns to be parsed and captured.

    • Method Detail

      • standard

        static TradeCsvInfoResolver standard()
        Obtains an instance that uses the standard set of reference data.
        Returns:
        the resolver
      • of

        static TradeCsvInfoResolver of​(ReferenceData refData)
        Obtains an instance that uses the specified set of reference data.
        Parameters:
        refData - the reference data
        Returns:
        the resolver
      • getReferenceData

        ReferenceData getReferenceData()
        Gets the reference data being used.
        Returns:
        the reference data
      • parseStandardAttributes

        default void parseStandardAttributes​(CsvRow row,
                                             TradeInfoBuilder builder)
        Parses standard attributes into TradeInfo.

        This parses the standard set of attributes, which are the three constants in AttributeType. The column names are 'Description', 'Name' and 'CCP'.

        Parameters:
        row - the CSV row to parse
        builder - the builder to update
      • parseTradeInfo

        default void parseTradeInfo​(CsvRow row,
                                    TradeInfoBuilder builder)
        Parses attributes into TradeInfo.

        If they are available, the trade ID, date, time and zone will have been set before this method is called. They may be altered if necessary, although this is not recommended.

        Parameters:
        row - the CSV row to parse
        builder - the builder to update
      • completeTradeCommon

        default <T extends Trade> T completeTradeCommon​(CsvRow row,
                                                        T trade)
        Completes the trade, potentially parsing additional columns.

        This is called by each of the completeTrade methods.

        Type Parameters:
        T - the trade type
        Parameters:
        row - the CSV row to parse
        trade - the parsed trade
        Returns:
        the updated trade
      • parseFraTrade

        default FraTrade parseFraTrade​(CsvRow row,
                                       TradeInfo info)
        Parses a FRA trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the FRA trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseSecurityTrade

        default SecurityQuantityTrade parseSecurityTrade​(CsvRow row,
                                                         TradeInfo info)
        Parses a Security trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the Security trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseSwapTrade

        default SwapTrade parseSwapTrade​(CsvRow row,
                                         List<CsvRow> variableRows,
                                         TradeInfo info)
        Parses a Swap trade from CSV.
        Parameters:
        row - the CSV row to parse
        variableRows - the CSV rows representing variable notional/rate etc
        info - the trade info
        Returns:
        the Swap trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseSwaptionTrade

        default SwaptionTrade parseSwaptionTrade​(CsvRow row,
                                                 List<CsvRow> variableRows,
                                                 TradeInfo info)
        Parses a Swaption trade from CSV.
        Parameters:
        row - the CSV row to parse
        variableRows - the CSV rows representing variable notional/rate etc
        info - the trade info
        Returns:
        the Swaption trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseBulletPaymentTrade

        default BulletPaymentTrade parseBulletPaymentTrade​(CsvRow row,
                                                           TradeInfo info)
        Parses a Bullet Payment trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the Bullet Payment trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseTermDepositTrade

        default TermDepositTrade parseTermDepositTrade​(CsvRow row,
                                                       TradeInfo info)
        Parses a Term Deposit trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the Term Deposit trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseFxSingleTrade

        default FxSingleTrade parseFxSingleTrade​(CsvRow row,
                                                 TradeInfo info)
        Parses a FX Single trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the FX Single trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseFxSwapTrade

        default FxSwapTrade parseFxSwapTrade​(CsvRow row,
                                             TradeInfo info)
        Parses a FX Swap trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the FX Swap trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseFxVanillaOptionTrade

        default FxVanillaOptionTrade parseFxVanillaOptionTrade​(CsvRow row,
                                                               TradeInfo info)
        Parses a FX Vanilla Option trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the FX Vanilla Option trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseFxNdfTrade

        default FxNdfTrade parseFxNdfTrade​(CsvRow row,
                                           TradeInfo info)
        Parses a FX NDF trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the FX NDF trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseCdsTrade

        default CdsTrade parseCdsTrade​(CsvRow row,
                                       TradeInfo info)
        Parses a CDS trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the CDS trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseCdsIndexTrade

        default CdsIndexTrade parseCdsIndexTrade​(CsvRow row,
                                                 TradeInfo info)
        Parses a CDS Index trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the CDS trade
        Throws:
        RuntimeException - if the row contains invalid data
      • parseCapFloorTrade

        default IborCapFloorTrade parseCapFloorTrade​(CsvRow row,
                                                     TradeInfo info)
        Parses a CapFloor trade from CSV.
        Parameters:
        row - the CSV row to parse
        info - the trade info
        Returns:
        the CapFloor trade
        Throws:
        RuntimeException - if the row contains invalid data
      • overrideParseTrade

        default Optional<Trade> overrideParseTrade​(String typeUpper,
                                                   CsvRow row,
                                                   TradeInfo info)
        Parses any kind of trade from CSV before standard matching.

        This is called before the standard matching on the 'Product Type' column. As such, it allows the standard parsing to be replaced for a given type.

        Parameters:
        typeUpper - the upper case product type column
        row - the CSV row to parse
        info - the trade info
        Returns:
        the trade, empty if the product type is not known, or if standard parsing should occur
        Throws:
        RuntimeException - if the product type is known but the row contains invalid data
      • parseOtherTrade

        default Optional<Trade> parseOtherTrade​(String typeUpper,
                                                CsvRow row,
                                                TradeInfo info)
        Parses any kind of trade from CSV after standard matching.

        This is called after the standard matching on the 'Product Type' column. As such, it allows non-matched rows to be captured.

        Parameters:
        typeUpper - the upper case product type column
        row - the CSV row to parse
        info - the trade info
        Returns:
        the trade, empty if the product type is not known
        Throws:
        RuntimeException - if the product type is known but the row contains invalid data