Interface PositionCsvInfoResolver


  • public interface PositionCsvInfoResolver
    Resolves additional information when parsing position 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. It also allows the ETD contract specification to be loaded.

    • Method Detail

      • standard

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

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

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

        default void parsePositionInfo​(CsvRow row,
                                       PositionInfoBuilder builder)
        Parses attributes into PositionInfo.

        If it is available, the position ID will have been set before this method is called. It may be altered if necessary, although this is not recommended.

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

        default EtdContractSpec parseEtdContractSpec​(CsvRow row,
                                                     EtdType type)
        Parses the contract specification from the row.
        Parameters:
        row - the CSV row to parse
        type - the ETD type
        Returns:
        the contract specification
        Throws:
        java.lang.IllegalArgumentException - if the specification is not found
      • parseEtdFuturePosition

        default Position parseEtdFuturePosition​(CsvRow row,
                                                PositionInfo info)
        Parses an ETD future position from the CSV row.

        This is intended to use reference data to find the ETD future security, returning it as an instance of EtdFuturePosition. The reference data lookup uses parseEtdContractSpec(CsvRow, EtdType) by default, however it could be overridden to lookup the security directly in reference data.

        Parameters:
        row - the CSV row to parse
        info - the position information
        Returns:
        the parsed position
        Throws:
        java.lang.IllegalArgumentException - if the row cannot be parsed
      • parseEtdOptionPosition

        default Position parseEtdOptionPosition​(CsvRow row,
                                                PositionInfo info)
        Parses an ETD future position from the CSV row.

        This is intended to use reference data to find the ETD future security, returning it as an instance of EtdOptionPosition. The reference data lookup uses parseEtdContractSpec(CsvRow, EtdType) by default, however it could be overridden to lookup the security directly in reference data.

        Parameters:
        row - the CSV row
        info - the position info
        Returns:
        the parsed position
        Throws:
        java.lang.IllegalArgumentException - if the row cannot be parsed
      • parseEtdFutureSecurityPosition

        default SecurityPosition parseEtdFutureSecurityPosition​(CsvRow row,
                                                                PositionInfo info)
        Parses an ETD future position from the CSV row without using reference data.

        This returns a SecurityPosition based on a standard ETD identifier from EtdIdUtils.

        Parameters:
        row - the CSV row to parse
        info - the position information
        Returns:
        the loaded positions, position-level errors are captured in the result
        Throws:
        java.lang.IllegalArgumentException - if the row cannot be parsed
      • parseEtdOptionSecurityPosition

        default SecurityPosition parseEtdOptionSecurityPosition​(CsvRow row,
                                                                PositionInfo info)
        Parses an ETD option position from the CSV row without using reference data.

        This returns a SecurityPosition based on a standard ETD identifier from EtdIdUtils.

        Parameters:
        row - the CSV row to parse
        info - the position information
        Returns:
        the loaded positions, position-level errors are captured in the result
        Throws:
        java.lang.IllegalArgumentException - if the row cannot be parsed