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

Add portfolio item summaries #1631

Merged
merged 2 commits into from Dec 21, 2017

Conversation

Projects
None yet
2 participants
@jodastephen
Member

jodastephen commented Dec 19, 2017

Provide summary of a trade

Add portfolio item summaries
Provide summary of a trade
@brianweller89

Looks good.

The only thing that strikes me as a little odd is our inconsistent handling of premium payments across different product types. Is the idea that the premium is only included in the description if it is optional for the product type but present for the given trade?

buf.append(getPremium().isPresent() ? " / Pay Premium" : (product.getPayLeg().isPresent() ? " / Pay Periodic" : ""));
} else {
buf.append("Rec ");
buf.append(getPremium().isPresent() ? "Premium" : (product.getPayLeg().isPresent() ? "Periodic" : ""));

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Should the "Rec" only be populated if premium is present, similar to when we pay premium?

"Rec / Pay 5Y ...." doesn't look right

@@ -73,6 +76,44 @@ private static void applyDefaults(Builder builder) {
}
//-------------------------------------------------------------------------
@Override
public PortfolioItemSummary summarize() {
// 5Y USD 2mm Rec CMS USD-LIBOR-6M Cap 1% / Pay Premium : 21Jan17-21Jan22

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Where would the 'CMS' part of this string come from for a CMS cap/floor?

summarizeMainLeg(mainLeg, buf);
}
buf.append(" : ");
buf.append(SummarizerUtils.dateRange(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted()));

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Think it makes more sense to associate start/end date with the ibor leg rather than adding it at the end, potentially after the premium.

Or was this done for consistency with out products?

This comment has been minimized.

@jodastephen

jodastephen Dec 19, 2017

Member

All trades have the dates at the end. The 5Y period is at the start.

buf.append(getPremium().isPresent() ? " / Pay Premium" : (product.getPayLeg().isPresent() ? " / Pay Periodic" : ""));
} else {
buf.append("Rec ");
buf.append(getPremium().isPresent() ? "Premium" : (product.getPayLeg().isPresent() ? "Periodic" : ""));

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

In this case the main leg is pay, so the funding leg would be the receive leg?

if (tradeDate.isPresent()) {
buf.append(MONTHS.between(tradeDate.get(), product.getStartDate().plusDays(3)));
buf.append("x");
buf.append(MONTHS.between(tradeDate.get(), product.getEndDate().plusDays(3)));

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

why + 3 days here? It's not obvious to me so a comment would be useful

buf.append(SummarizerUtils.fx(base, counter));
buf.append(" : ");
buf.append(SummarizerUtils.date(product.getPaymentDate()));
CurrencyPair currencyPair = product.getCurrencyPair();

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Already have the two currencies associated with the amounts, could use these rather than pulling the pair?

CurrencyPair currencyPair = product.getCurrencyPair();
return SummarizerUtils.summary(
this, ProductType.FX_SINGLE_BARRIER_OPTION, buf.toString(), currencyPair.getBase(), currencyPair.getCounter());
}

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Capture premium as we do for IR options?

buf.append(SummarizerUtils.date(product.getExpiryDate()));
CurrencyPair currencyPair = product.getCurrencyPair();
return SummarizerUtils.summary(
this, ProductType.FX_VANILLA_OPTION, buf.toString(), currencyPair.getBase(), currencyPair.getCounter());

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Capture premium as we do for IR options?

@@ -237,6 +240,111 @@ public boolean isCrossCurrency() {
return builder.build();
}
//-------------------------------------------------------------------------
/**
* Summarizes this ETD future into string form.

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Comment refers to future

NotionalSchedule notionalSchedule = rcLeg.getNotionalSchedule();
ValueSchedule amount = notionalSchedule.getAmount();
double notional = amount.getInitialValue();
String varying = !amount.getSteps().isEmpty() || amount.getStepSequence().isPresent() ? " varying" : "";

This comment has been minimized.

@brianweller89

brianweller89 Dec 19, 2017

Contributor

Tiny point, but I think 'variable' is the more natural term rather than 'varying'

@jodastephen jodastephen added this to the v1.7 milestone Dec 21, 2017

@jodastephen jodastephen merged commit c2d061b into master Dec 21, 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

@jodastephen jodastephen deleted the topic/trade-summary branch Dec 21, 2017

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