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 and bill trade description. #1748

Merged
merged 3 commits into from Jun 28, 2018
Merged

Bill and bill trade description. #1748

merged 3 commits into from Jun 28, 2018

Conversation

@marc-henrard
Copy link
Contributor

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

  • Created bill product and bill trade
  • Resolved versions
@marc-henrard marc-henrard requested a review from jodastephen Jun 21, 2018
.settlementDateOffset(DaysAdjustment.ofBusinessDays(2, EUTA, BUSINESS_ADJUST))
.yieldConvention(BillYieldConvention.INTEREST_AT_MATURITY).build();
private static final double TOLERANCE_PRICE = 1.0E-8;

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

Om;y one blank line

/**
* A bill.
* <p>
* A bill is a financial instrument that represents a unique fixed payments.

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

singular/plural

@ImmutableValidator
private void validate() {
ArgChecker.isTrue(settlementDateOffset.getDays() >= 0, "The settlement date offset must be non-negative");
ArgChecker.isTrue(notional.getAmount() > 0, "Notionanl must be strictly positve");

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

Spelling

* @return the price
*/
public double priceFromYield(double yield, LocalDate settlementDate) {
double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate().getUnadjusted());

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

The logic below should move onto BillConvention (taking accrualFactor)

*/
public double yieldFromPrice(double price, LocalDate settlementDate) {
double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate().getUnadjusted());
if (yieldConvention.equals(DISCOUNT)) {

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

move to BillConvention


@Override
public BillTrade withPrice(double price) {
return BillTrade.builder().info(info).product(product).quantity(quantity).price(price).build();

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

return new BillTrade(...)

* The notional payment of the bill notional, the amount must be positive.
*/
@PropertyDefinition(validate = "notNull")
private final Payment notional; // Change to payment

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

Remove comment

* @return the price
*/
public double priceFromYield(double yield, LocalDate settlementDate) {
double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate());

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

Logic on convention

*/
public double yieldFromPrice(double price, LocalDate settlementDate) {
double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate());
if (yieldConvention.equals(DISCOUNT)) {

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

Logic on convention

@ImmutablePreBuild
private static void preBuild(Builder builder) {
if (builder.settlement != null) {
ArgChecker.isTrue(builder.quantity * builder.settlement.getAmount() <= 0); // Amount negative for buy

This comment has been minimized.

@jodastephen

jodastephen Jun 27, 2018
Member

Is this right?

This comment has been minimized.

@marc-henrard

marc-henrard Jun 27, 2018
Author Contributor

When buying, quantity > 0 and amount is paid and so < 0. This is to check that the user does not get confused on the signs.

Copy link
Member

@jodastephen jodastephen left a comment

Still got singular/plural comment and ofPrice() to do

@jodastephen jodastephen merged commit f9a068f into master Jun 28, 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 No dependency changes
Details
security/snyk - modules/calc/pom.xml No dependency changes
Details
security/snyk - modules/collect/pom.xml No dependency changes
Details
security/snyk - modules/data/pom.xml No dependency changes
Details
security/snyk - modules/loader/pom.xml No dependency changes
Details
security/snyk - modules/market/pom.xml No dependency changes
Details
security/snyk - modules/math/pom.xml No dependency changes
Details
security/snyk - modules/measure/pom.xml No dependency changes
Details
security/snyk - modules/pom.xml No dependency changes
Details
security/snyk - modules/pricer/pom.xml No dependency changes
Details
security/snyk - modules/product/pom.xml No dependency changes
Details
security/snyk - modules/report/pom.xml No dependency changes
Details
security/snyk - pom.xml No dependency changes
Details
@jodastephen jodastephen deleted the topic/bill-trade branch Jun 28, 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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants