New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added counterparty field to CSV trade loader. #1583

Merged
merged 3 commits into from Oct 24, 2017

Conversation

Projects
None yet
2 participants
@marc-henrard
Contributor

marc-henrard commented Oct 24, 2017

Parse Counterparty field for loaded trades. The counterparty are loaded into the 'counterparty' field of the TradeInfo.
Close issue #1582

@marc-henrard marc-henrard requested a review from jodastephen Oct 24, 2017

@@ -424,6 +433,11 @@ private TradeInfo parseTradeInfo(CsvRow row) {
TradeInfoBuilder infoBuilder = TradeInfo.builder();
String scheme = row.findField(ID_SCHEME_FIELD).orElse(DEFAULT_TRADE_SCHEME);
row.findValue(ID_FIELD).ifPresent(id -> infoBuilder.id(StandardId.of(scheme, id)));
String schemeCpty = row.findField(CTPY_SCHEME_FIELD).orElse(DEFAULT_CTPY_SCHEME);

This comment has been minimized.

@jodastephen

jodastephen Oct 24, 2017

Member

Should be findValue() not findField(). This will then default empty schemes.

@@ -424,6 +433,11 @@ private TradeInfo parseTradeInfo(CsvRow row) {
TradeInfoBuilder infoBuilder = TradeInfo.builder();
String scheme = row.findField(ID_SCHEME_FIELD).orElse(DEFAULT_TRADE_SCHEME);
row.findValue(ID_FIELD).ifPresent(id -> infoBuilder.id(StandardId.of(scheme, id)));
String schemeCpty = row.findField(CTPY_SCHEME_FIELD).orElse(DEFAULT_CTPY_SCHEME);
Optional<String> cptyOption = row.findValue(CTPY_FIELD);
if (cptyOption.isPresent() && !cptyOption.get().equals(EMPTY)) {

This comment has been minimized.

@jodastephen

jodastephen Oct 24, 2017

Member

No need to check for EMPTY as findValue() does this.

@@ -0,0 +1,23 @@
Strata Trade Type,Id Scheme,Id,Counterparty Scheme,Counterparty,Trade Date,Trade Time,Trade Zone,Convention,Buy Sell,Period To Start,Tenor,Index,Interpolated index,Fixed Rate,FX Rate,Day Count,Currency,Notional,Start Date,End Date,Date Convention,Date Calendar,Stub Convention,Leg 1 Direction,Leg 1 Start Date,Leg 1 End Date,Leg 1 Stub Convention,Leg 1 Roll Convention,Leg 1 Frequency,Leg 1 Currency,Leg 1 Notional,Leg 1 Fixed Rate,Leg 1 Day Count,Leg 1 Date Convention,Leg 1 Date Calendar,Leg 2 Direction,Leg 2 Start Date,Leg 2 End Date,Leg 2 Frequency,Leg 2 Currency,Leg 2 Notional,Leg 2 Index,Security Id Scheme,Security Id,Quantity,Long Quantity,Price
Fra,OG,123401,CPTY,Bank A,01/06/2017,11:05,Europe/London,GBP-LIBOR-3M,Buy,P2M,,,,0.5,,,,1000000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

This comment has been minimized.

@jodastephen

jodastephen Oct 24, 2017

Member

It would be simpler to add the extra two columns to the existing trades.csv file and extend the existing tests, rather than cutting and pasting new ones.

This comment has been minimized.

@marc-henrard

marc-henrard Oct 24, 2017

Contributor

Need to check 3 cases: without counterparty column, with only the 'Counterparty' column and with both 'Counterparty' and 'Counterparty Scheme' columns. That means at least 3 files.

marc-henrard and others added some commits Oct 24, 2017

@marc-henrard marc-henrard merged commit 56d9fcc into master Oct 24, 2017

15 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
security/snyk No new issues
Details
security/snyk - modules/basics/pom.xml No new issues
Details
security/snyk - modules/calc/pom.xml No new issues
Details
security/snyk - modules/collect/pom.xml No new issues
Details
security/snyk - modules/data/pom.xml No new issues
Details
security/snyk - modules/loader/pom.xml No new issues
Details
security/snyk - modules/market/pom.xml No new issues
Details
security/snyk - modules/math/pom.xml No new issues
Details
security/snyk - modules/measure/pom.xml No new issues
Details
security/snyk - modules/pom.xml No new issues
Details
security/snyk - modules/pricer/pom.xml No new issues
Details
security/snyk - modules/product/pom.xml No new issues
Details
security/snyk - modules/report/pom.xml No new issues
Details

@marc-henrard marc-henrard deleted the topic/trade-loader-cpty branch Oct 24, 2017

@jodastephen jodastephen added this to the v1.5 milestone Oct 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment