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 Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default IborCapFloorTrade
completeTrade(CsvRow row, IborCapFloorTrade trade)
Completes the CapFloor trade, potentially parsing additional columns.default CdsIndexTrade
completeTrade(CsvRow row, CdsIndexTrade trade)
Completes the CDS Index trade, potentially parsing additional columns.default CdsTrade
completeTrade(CsvRow row, CdsTrade trade)
Completes the CDS trade, potentially parsing additional columns.default TermDepositTrade
completeTrade(CsvRow row, TermDepositTrade trade)
Completes the trade, potentially parsing additional columns.default FraTrade
completeTrade(CsvRow row, FraTrade trade)
Completes the FRA trade, potentially parsing additional columns.default FxNdfTrade
completeTrade(CsvRow row, FxNdfTrade trade)
Completes the FX NDF trade, potentially parsing additional columns.default FxSingleTrade
completeTrade(CsvRow row, FxSingleTrade trade)
Completes the FX Forward trade, potentially parsing additional columns.default FxSwapTrade
completeTrade(CsvRow row, FxSwapTrade trade)
Completes the FX Swap trade, potentially parsing additional columns.default FxVanillaOptionTrade
completeTrade(CsvRow row, FxVanillaOptionTrade trade)
Completes the FX Vanilla Option trade, potentially parsing additional columns.default BulletPaymentTrade
completeTrade(CsvRow row, BulletPaymentTrade trade)
Completes the trade, potentially parsing additional columns.default SecurityTrade
completeTrade(CsvRow row, SecurityTrade trade)
Completes the trade, potentially parsing additional columns.default SwapTrade
completeTrade(CsvRow row, SwapTrade trade)
Completes the Swap trade, potentially parsing additional columns.default SwaptionTrade
completeTrade(CsvRow row, SwaptionTrade trade)
Completes the Swaption trade, potentially parsing additional columns.default <T extends Trade>
TcompleteTradeCommon(CsvRow row, T trade)
Completes the trade, potentially parsing additional columns.ReferenceData
getReferenceData()
Gets the reference data being used.static TradeCsvInfoResolver
of(ReferenceData refData)
Obtains an instance that uses the specified set of reference data.default Optional<Trade>
overrideParseTrade(String typeUpper, CsvRow row, TradeInfo info)
Parses any kind of trade from CSV before standard matching.default BulletPaymentTrade
parseBulletPaymentTrade(CsvRow row, TradeInfo info)
Parses a Bullet Payment trade from CSV.default IborCapFloorTrade
parseCapFloorTrade(CsvRow row, TradeInfo info)
Parses a CapFloor trade from CSV.default CdsIndexTrade
parseCdsIndexTrade(CsvRow row, TradeInfo info)
Parses a CDS Index trade from CSV.default CdsTrade
parseCdsTrade(CsvRow row, TradeInfo info)
Parses a CDS trade from CSV.default FraTrade
parseFraTrade(CsvRow row, TradeInfo info)
Parses a FRA trade from CSV.default FxNdfTrade
parseFxNdfTrade(CsvRow row, TradeInfo info)
Parses a FX NDF trade from CSV.default FxSingleTrade
parseFxSingleTrade(CsvRow row, TradeInfo info)
Parses a FX Single trade from CSV.default FxSwapTrade
parseFxSwapTrade(CsvRow row, TradeInfo info)
Parses a FX Swap trade from CSV.default FxVanillaOptionTrade
parseFxVanillaOptionTrade(CsvRow row, TradeInfo info)
Parses a FX Vanilla Option trade from CSV.default Optional<Trade>
parseOtherTrade(String typeUpper, CsvRow row, TradeInfo info)
Parses any kind of trade from CSV after standard matching.default SecurityQuantityTrade
parseSecurityTrade(CsvRow row, TradeInfo info)
Parses a Security trade from CSV.default void
parseStandardAttributes(CsvRow row, TradeInfoBuilder builder)
Parses standard attributes intoTradeInfo
.default SwaptionTrade
parseSwaptionTrade(CsvRow row, List<CsvRow> variableRows, TradeInfo info)
Parses a Swaption trade from CSV.default SwapTrade
parseSwapTrade(CsvRow row, List<CsvRow> variableRows, TradeInfo info)
Parses a Swap trade from CSV.default TermDepositTrade
parseTermDepositTrade(CsvRow row, TradeInfo info)
Parses a Term Deposit trade from CSV.default void
parseTradeInfo(CsvRow row, TradeInfoBuilder builder)
Parses attributes intoTradeInfo
.static TradeCsvInfoResolver
standard()
Obtains an instance that uses the standard set of reference data.
-
-
-
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 intoTradeInfo
.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
-
parseTradeInfo
default void parseTradeInfo(CsvRow row, TradeInfoBuilder builder)
Parses attributes intoTradeInfo
.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 parsebuilder
- 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 parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default FraTrade completeTrade(CsvRow row, FraTrade trade)
Completes the FRA trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default SecurityTrade completeTrade(CsvRow row, SecurityTrade trade)
Completes the trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default SwapTrade completeTrade(CsvRow row, SwapTrade trade)
Completes the Swap trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default SwaptionTrade completeTrade(CsvRow row, SwaptionTrade trade)
Completes the Swaption trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default BulletPaymentTrade completeTrade(CsvRow row, BulletPaymentTrade trade)
Completes the trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default TermDepositTrade completeTrade(CsvRow row, TermDepositTrade trade)
Completes the trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default FxSingleTrade completeTrade(CsvRow row, FxSingleTrade trade)
Completes the FX Forward trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default FxSwapTrade completeTrade(CsvRow row, FxSwapTrade trade)
Completes the FX Swap trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default FxVanillaOptionTrade completeTrade(CsvRow row, FxVanillaOptionTrade trade)
Completes the FX Vanilla Option trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default FxNdfTrade completeTrade(CsvRow row, FxNdfTrade trade)
Completes the FX NDF trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default CdsTrade completeTrade(CsvRow row, CdsTrade trade)
Completes the CDS trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default CdsIndexTrade completeTrade(CsvRow row, CdsIndexTrade trade)
Completes the CDS Index trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- the parsed trade- Returns:
- the updated trade
-
completeTrade
default IborCapFloorTrade completeTrade(CsvRow row, IborCapFloorTrade trade)
Completes the CapFloor trade, potentially parsing additional columns.This is called after the trade has been parsed and after
parseTradeInfo(CsvRow, TradeInfoBuilder)
.By default this calls
completeTradeCommon(CsvRow, Trade)
.- Parameters:
row
- the CSV row to parsetrade
- 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 parseinfo
- 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 parseinfo
- 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 parsevariableRows
- the CSV rows representing variable notional/rate etcinfo
- 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 parsevariableRows
- the CSV rows representing variable notional/rate etcinfo
- 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 parseinfo
- 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 parseinfo
- 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 parseinfo
- 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 parseinfo
- 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 parseinfo
- 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 parseinfo
- 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 parseinfo
- 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 parseinfo
- 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 parseinfo
- 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 columnrow
- the CSV row to parseinfo
- 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 columnrow
- the CSV row to parseinfo
- 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
-
-