Skip to content
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
Merged

Add portfolio item summaries #1631

merged 2 commits into from
Dec 21, 2017

Conversation

jodastephen
Copy link
Member

Provide summary of a trade

Provide summary of a trade
Copy link
Contributor

@brianweller89 brianweller89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" : ""));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" : ""));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" : "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@jodastephen jodastephen deleted the topic/trade-summary branch December 21, 2017 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants