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

Bill product and trade pricers. #1754

Merged
merged 4 commits into from
Jul 3, 2018
Merged

Bill product and trade pricers. #1754

merged 4 commits into from
Jul 3, 2018

Conversation

marc-henrard
Copy link
Contributor

Pricers for Bill products and trades

  • present value
  • present value sensitivity
  • yield and price
  • currency exposure and current cash

* @return the price
*/
public double priceFromCurves(ResolvedBill bill, LegalEntityDiscountingProvider provider, LocalDate settlementDate) {
ArgChecker.isTrue(settlementDate.isBefore(bill.getNotional().getDate()),
Copy link
Member

Choose a reason for hiding this comment

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

ArgChecker.inOrderNotEqual

public double priceFromCurves(ResolvedBill bill, LegalEntityDiscountingProvider provider, LocalDate settlementDate) {
ArgChecker.isTrue(settlementDate.isBefore(bill.getNotional().getDate()),
"settlement date must be before maturity date");
ArgChecker.isTrue(!settlementDate.isBefore(provider.getValuationDate()),
Copy link
Member

Choose a reason for hiding this comment

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

ArgChecker.inOrderOrEqual

provider.repoCurveDiscountFactors(bill.getSecurityId(), bill.getLegalEntityId(), bill.getCurrency());
double dfRepoSettle = discountFactorsRepo.discountFactor(settlementDate);
double price = dfMaturity / dfRepoSettle;
return price;
Copy link
Member

Choose a reason for hiding this comment

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

Just return the calculation - no need for price local variable

provider.repoCurveDiscountFactors(bill.getSecurityId(), bill.getLegalEntityId(), bill.getCurrency());
double dfRepoSettle = discountFactorsRepo.discountFactor(settlementDate);
double price = dfMaturity / dfRepoSettle;
return price;
Copy link
Member

Choose a reason for hiding this comment

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

Inline variable

ArgChecker.isTrue(settlementDate.isBefore(bill.getNotional().getDate()),
"settlement date must be before maturity date");
ArgChecker.isTrue(!settlementDate.isBefore(provider.getValuationDate()),
"settlement date must be on or after valuation date");
Copy link
Member

Choose a reason for hiding this comment

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

ArgChecker changes

paymentPricer.presentValueSensitivity(bill.getSettlement().get(), discountFactorsRepo).build();
return sensiProduct.combinedWith(sensiSettle);
}
return sensiProduct;
Copy link
Member

Choose a reason for hiding this comment

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

Same comments as method above

LegalEntityDiscountingProvider provider,
double zSpread,
CompoundedRateType compoundedRateType,
int periodsPerYear) {
Copy link
Member

Choose a reason for hiding this comment

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

Blank line here

* multiplied by the quantity and the present value of the settlement payment if still due at the valuation date.
* If not it is the underlying product's present value multiplied by the quantity.
*
* @param bill the bill
Copy link
Member

Choose a reason for hiding this comment

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

In all methods on the class, this parameter should be called trade

private static final StandardId ISSUER_ID = StandardId.of("OG-Ticker", "GOVT1");
private static final BillYieldConvention YIELD_CONVENTION = BillYieldConvention.INTEREST_AT_MATURITY;


Copy link
Member

Choose a reason for hiding this comment

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

Only one blank line

private static final StandardId SECURITY_ID = StandardId.of("OG-Ticker", "GOVT1-BOND1");
private static final StandardId ISSUER_ID = StandardId.of("OG-Ticker", "GOVT1");
private static final BillYieldConvention YIELD_CONVENTION = BillYieldConvention.INTEREST_AT_MATURITY;

Copy link
Member

Choose a reason for hiding this comment

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

Only one blank line

Copy link
Contributor

Choose a reason for hiding this comment

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

A blank line removed.

@yukiiwashita yukiiwashita merged commit 6e856ea into master Jul 3, 2018
@jodastephen jodastephen deleted the topic/bill-pricer-2 branch July 4, 2018 14:40
@jodastephen jodastephen added this to the v2.0 milestone Jul 5, 2018
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

3 participants