Skip to content

Bond irregular dates - #2694

Merged
mergify[bot] merged 31 commits into
mainfrom
bond-irregular-dates
Sep 29, 2026
Merged

mergify[bot] merged 31 commits into
mainfrom
bond-irregular-dates

Conversation

@jodastephen

Copy link
Copy Markdown
Contributor

Updated code from #2655. Applies a fix to dirtyPriceFromYieldStandard for FixedCouponBond.

The main change is the use of Math.pow(factorOnPeriod, yearFraction * eventsPerYear) instead of factorOnPeriod when the period is not regular.

ritonglue and others added 30 commits September 26, 2024 22:38
Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.10.2 to 5.11.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](junit-team/junit-framework@r5.10.2...r5.11.2)

---
updated-dependencies:
- dependency-name: org.junit:junit-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* overnight cap product

* tests

* javadoc

* line

* clean

* white spaces

* failing test for accrual
* PROD-42681: Adding Inauguration Day to MXMC

* PROD-42681: Adding Inauguration Day to MXMC
* Overnight CapFloor CSV plugin

* copyright

* variable names

---------

Co-authored-by: Alexis Skitini <skitini@users.noreply.github.com>
* overnight cap product

* tests

* javadoc

* line

* clean

* white spaces

* pricers

* failing test for accrual

* pricers

* test

* spaces

* addressed review comments

* error message
* Adding Inauguration Day to MXMC

* Adding Inauguration Day to MXMC

* Adding Inauguration Day to MXMC
Co-authored-by: Michael Rollins <MichaelRol@users.noreply.github.com>
* Adding Overnight-Overnight swap conventions

* Cleanup + Add Tests

* PR cleanup

* Finish PR feedback

* Fix tests

* Make constant public to fix ini loading

---------

Co-authored-by: Brian Weller <brianweller89@users.noreply.github.com>
* Holiday for President Jimmy Carter
* Only appears to apply to NYSE
* https://www.sifma.org/resources/unscheduled-close-market-matrix/
* Fixes #2691
Bumps [com.google.guava:guava](https://github.com/google/guava) from 32.1.3-jre to 33.4.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.11.2 to 5.11.4.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](junit-team/junit-framework@r5.11.2...r5.11.4)

---
updated-dependencies:
- dependency-name: org.junit:junit-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.25.3 to 3.27.0.
- [Release notes](https://github.com/assertj/assertj/releases)
- [Commits](assertj/assertj@assertj-build-3.25.3...assertj-build-3.27.0)

---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Provide default value for new property
* Adjust code to pull out events per year
@ritonglue

Copy link
Copy Markdown
Contributor

The year 2025 starts very nicely. Thank you for reviewing my modifications.

@ritonglue

Copy link
Copy Markdown
Contributor

There are other lines where the logic should be changed:

  • dirtyPriceFromYieldStandardAd
  • modifiedDurationFromYieldStandard
  • modifiedDurationFromYieldStandardAd
  • convexityFromYieldStandard

In fact everty time there is a "++pow"

There is also this odd/ugly name function FixedCouponBondPaymentPeriod.isIsRegular which was automatically generated by Eclipse ("build automatically" was on).

I can fix my PR with some guidance.
Thanks

@beajeanm beajeanm added the auto-merge Merge when build finishes label Sep 29, 2026
Copilot AI balanced review requested due to automatic review settings September 29, 2026 22:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Irregular-period handling is not propagated to AD, duration, and convexity calculations, producing inconsistent sensitivities.

Review effort: Balanced
Findings: 1 High severity · 2 Low severity

Open (3)
What changed in this PR

Fixes yield pricing for bonds with irregular coupon periods by tracking period regularity and applying fractional-period discounting.

Changes:

  • Adds and resolves coupon-period regularity metadata.
  • Updates dirty-price discount factors for irregular periods.
  • Adds day-count and irregular-schedule regression tests.
File Description
FixedCouponBondPaymentPeriod.java Adds the regular property.
FixedCouponBond.java Populates regularity during resolution.
DiscountingFixedCouponBondProductPricer.java Applies fractional-period discounting.
DiscountingFixedCouponBondProductPricerTest.java Adds yield regression tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

if (period.isRegular()) {
factor *= factorOnPeriod;
} else {
factor *= Math.pow(factorOnPeriod, yearFraction * eventsPerYear);
double dirtyPrice = PRICER.dirtyPriceFromCleanPrice(bond, settlementDate, cleanPrice);
assertThat(dirtyPrice).isCloseTo(cleanPrice, offset(TOL)); // 2.x.
double yield = PRICER.yieldFromDirtyPrice(bond, settlementDate, dirtyPrice);
assertThat(yield).isCloseTo(0.07286881667273096, offset(TOL)); // 2.x.œœ
Comment on lines +126 to +129
/**
* Indicates if the is period is regular.
* <p>
* If true the full coupon is paid, otherwise the period is shorter/longer.
@mergify mergify Bot added the queued label Sep 29, 2026
@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-29 22:49 UTC · Rule: default · triggered by rule Auto-Merge
  • ✅ Checks passed · on draft merge queue: checking #2694 on main (aca632b) #2811
  • ✅ Merged — 2026-09-29 22:59 UTC · at e1db1ba69ddf6478dfe00a595c56fc9cf9a5260b · squash

This pull request spent 10 minutes 29 seconds in the queue, including 10 minutes 7 seconds running CI.

Required conditions to merge

@mergify mergify Bot mentioned this pull request Sep 29, 2026
10 of 14 tasks
@mergify
mergify Bot merged commit e1db1ba into main Sep 29, 2026
11 checks passed
@mergify
mergify Bot deleted the bond-irregular-dates branch September 29, 2026 22:59
@mergify mergify Bot removed the queued label Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Merge when build finishes Type:Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants