Interface PositionCsvInfoResolver
-
- All Known Subinterfaces:
LightweightPositionCsvInfoResolver
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 Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default EtdFuturePosition
completePosition(CsvRow row, EtdFuturePosition position, EtdContractSpec spec)
Completes the position, potentially parsing additional columns.default EtdOptionPosition
completePosition(CsvRow row, EtdOptionPosition position, EtdContractSpec spec)
Completes the position, potentially parsing additional columns.default SecurityPosition
completePosition(CsvRow row, SecurityPosition position)
Completes the position, potentially parsing additional columns.ReferenceData
getReferenceData()
Gets the reference data being used.static PositionCsvInfoResolver
of(ReferenceData refData)
Obtains an instance that uses the specified set of reference data.default EtdContractSpec
parseEtdContractSpec(CsvRow row, EtdType type)
Parses the contract specification from the row.default Position
parseEtdFuturePosition(CsvRow row, PositionInfo info)
Parses an ETD future position from the CSV row.default SecurityPosition
parseEtdFutureSecurityPosition(CsvRow row, PositionInfo info)
Parses an ETD future position from the CSV row without using reference data.default Position
parseEtdOptionPosition(CsvRow row, PositionInfo info)
Parses an ETD future position from the CSV row.default SecurityPosition
parseEtdOptionSecurityPosition(CsvRow row, PositionInfo info)
Parses an ETD option position from the CSV row without using reference data.default Position
parseNonEtdPosition(CsvRow row, PositionInfo info)
Parses a non-ETD position from the CSV row.default SecurityPosition
parseNonEtdSecurityPosition(CsvRow row, PositionInfo info)
Parses a non-ETD position from the CSV row.default void
parsePositionInfo(CsvRow row, PositionInfoBuilder builder)
Parses attributes intoPositionInfo
.default void
parseStandardAttributes(CsvRow row, PositionInfoBuilder builder)
Parses standard attributes intoPositionInfo
.static PositionCsvInfoResolver
standard()
Obtains an instance that uses the standard set of reference data.
-
-
-
Method Detail
-
standard
static PositionCsvInfoResolver standard()
Obtains an instance that uses the standard set of reference data.- Returns:
- the resolver
-
of
static PositionCsvInfoResolver 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, PositionInfoBuilder builder)
Parses standard attributes intoPositionInfo
.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 parsebuilder
- the builder to update
-
parsePositionInfo
default void parsePositionInfo(CsvRow row, PositionInfoBuilder builder)
Parses attributes intoPositionInfo
.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 parsebuilder
- the builder to update
-
completePosition
default EtdFuturePosition completePosition(CsvRow row, EtdFuturePosition position, EtdContractSpec spec)
Completes the position, potentially parsing additional columns.This is called after the position has been parsed and after
parsePositionInfo(CsvRow, PositionInfoBuilder)
.- Parameters:
row
- the CSV row to parseposition
- the parsed positionspec
- the contract specification- Returns:
- the updated position
-
completePosition
default EtdOptionPosition completePosition(CsvRow row, EtdOptionPosition position, EtdContractSpec spec)
Completes the position, potentially parsing additional columns.This is called after the position has been parsed and after
parsePositionInfo(CsvRow, PositionInfoBuilder)
.- Parameters:
row
- the CSV row to parseposition
- the parsed positionspec
- the contract specification- Returns:
- the updated position
-
completePosition
default SecurityPosition completePosition(CsvRow row, SecurityPosition position)
Completes the position, potentially parsing additional columns.This is called after the position has been parsed and after
parsePositionInfo(CsvRow, PositionInfoBuilder)
.- Parameters:
row
- the CSV row to parseposition
- the parsed position- Returns:
- the updated position
-
parseNonEtdPosition
default Position parseNonEtdPosition(CsvRow row, PositionInfo info)
Parses a non-ETD position from the CSV row.This parses the basic
SecurityPosition
and then tries to parse the extra details to convert it into aGenericSecurityPosition
.- Parameters:
row
- the CSV row to parseinfo
- the position information- Returns:
- the parsed position
- Throws:
IllegalArgumentException
- if the row cannot be parsed
-
parseNonEtdSecurityPosition
default SecurityPosition parseNonEtdSecurityPosition(CsvRow row, PositionInfo info)
Parses a non-ETD position from the CSV row.This parses the basic
SecurityPosition
without using reference data.- Parameters:
row
- the CSV row to parseinfo
- the position information- Returns:
- the parsed position
- Throws:
IllegalArgumentException
- if the row cannot be parsed
-
parseEtdContractSpec
default EtdContractSpec parseEtdContractSpec(CsvRow row, EtdType type)
Parses the contract specification from the row.- Parameters:
row
- the CSV row to parsetype
- the ETD type- Returns:
- the contract specification
- Throws:
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 usesparseEtdContractSpec(CsvRow, EtdType)
by default, however it could be overridden to lookup the security directly in reference data.- Parameters:
row
- the CSV row to parseinfo
- the position information- Returns:
- the parsed position
- Throws:
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 usesparseEtdContractSpec(CsvRow, EtdType)
by default, however it could be overridden to lookup the security directly in reference data.- Parameters:
row
- the CSV rowinfo
- the position info- Returns:
- the parsed position
- Throws:
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 fromEtdIdUtils
.- Parameters:
row
- the CSV row to parseinfo
- the position information- Returns:
- the loaded positions, position-level errors are captured in the result
- Throws:
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 fromEtdIdUtils
.- Parameters:
row
- the CSV row to parseinfo
- the position information- Returns:
- the loaded positions, position-level errors are captured in the result
- Throws:
IllegalArgumentException
- if the row cannot be parsed
-
-