Bill product and trade pricers. #1754
Merged
Conversation
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillProductPricer.java
Outdated
* @return the price | ||
*/ | ||
public double priceFromCurves(ResolvedBill bill, LegalEntityDiscountingProvider provider, LocalDate settlementDate) { | ||
ArgChecker.isTrue(settlementDate.isBefore(bill.getNotional().getDate()), |
jodastephen
Jun 28, 2018
Member
ArgChecker.inOrderNotEqual
ArgChecker.inOrderNotEqual
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillProductPricer.java
Outdated
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()), |
jodastephen
Jun 28, 2018
Member
ArgChecker.inOrderOrEqual
ArgChecker.inOrderOrEqual
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillProductPricer.java
Outdated
provider.repoCurveDiscountFactors(bill.getSecurityId(), bill.getLegalEntityId(), bill.getCurrency()); | ||
double dfRepoSettle = discountFactorsRepo.discountFactor(settlementDate); | ||
double price = dfMaturity / dfRepoSettle; | ||
return price; |
jodastephen
Jun 28, 2018
Member
Just return the calculation - no need for price
local variable
Just return the calculation - no need for price
local variable
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillProductPricer.java
Outdated
provider.repoCurveDiscountFactors(bill.getSecurityId(), bill.getLegalEntityId(), bill.getCurrency()); | ||
double dfRepoSettle = discountFactorsRepo.discountFactor(settlementDate); | ||
double price = dfMaturity / dfRepoSettle; | ||
return price; |
jodastephen
Jun 28, 2018
Member
Inline variable
Inline variable
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillProductPricer.java
Outdated
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"); |
jodastephen
Jun 28, 2018
Member
ArgChecker changes
ArgChecker changes
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillTradePricer.java
Outdated
paymentPricer.presentValueSensitivity(bill.getSettlement().get(), discountFactorsRepo).build(); | ||
return sensiProduct.combinedWith(sensiSettle); | ||
} | ||
return sensiProduct; |
jodastephen
Jun 28, 2018
Member
Same comments as method above
Same comments as method above
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillTradePricer.java
Outdated
LegalEntityDiscountingProvider provider, | ||
double zSpread, | ||
CompoundedRateType compoundedRateType, | ||
int periodsPerYear) { |
jodastephen
Jun 28, 2018
Member
Blank line here
Blank line here
modules/pricer/src/main/java/com/opengamma/strata/pricer/bond/DiscountingBillTradePricer.java
Outdated
* 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 |
jodastephen
Jun 28, 2018
Member
In all methods on the class, this parameter should be called trade
In all methods on the class, this parameter should be called trade
.../pricer/src/test/java/com/opengamma/strata/pricer/bond/DiscountingBillProductPricerTest.java
Outdated
private static final StandardId ISSUER_ID = StandardId.of("OG-Ticker", "GOVT1"); | ||
private static final BillYieldConvention YIELD_CONVENTION = BillYieldConvention.INTEREST_AT_MATURITY; | ||
|
||
|
jodastephen
Jun 28, 2018
Member
Only one blank line
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; | ||
|
jodastephen
Jun 28, 2018
Member
Only one blank line
Only one blank line
yukiiwashita
Jul 3, 2018
Contributor
A blank line removed.
A blank line removed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Pricers for Bill products and trades