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

@marc-henrard marc-henrard commented Jun 28, 2018

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()),

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

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()),

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

ArgChecker.inOrderOrEqual

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

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

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;

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

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");

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

ArgChecker changes

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

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

Same comments as method above

LegalEntityDiscountingProvider provider,
double zSpread,
CompoundedRateType compoundedRateType,
int periodsPerYear) {

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

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

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

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;


This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

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;

This comment has been minimized.

@jodastephen

jodastephen Jun 28, 2018
Member

Only one blank line

This comment has been minimized.

@yukiiwashita

yukiiwashita Jul 3, 2018
Contributor

A blank line removed.

yukiiwashita added 3 commits Jul 2, 2018
@yukiiwashita yukiiwashita merged commit 6e856ea into master Jul 3, 2018
15 checks passed
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 - modules/basics/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/calc/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/collect/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/data/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/loader/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/market/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/math/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/measure/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/pricer/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/product/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/report/pom.xml (OpenGamma) No new issues
Details
security/snyk - pom.xml (OpenGamma) No new issues
Details
@jodastephen jodastephen deleted the topic/bill-pricer-2 branch Jul 4, 2018
@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
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants