@@ -173,6 +173,63 @@ public class DiscountingFixedCouponBondProductPricerTest {
173
173
private static final RatesFiniteDifferenceSensitivityCalculator FD_CAL =
174
174
new RatesFiniteDifferenceSensitivityCalculator (EPS );
175
175
176
+ @ Test
177
+ public void test_yield_act_act_isda () {
178
+ PeriodicSchedule period = PeriodicSchedule .builder ()
179
+ .startDate (LocalDate .of (2021 , Month .JUNE , 30 ))
180
+ .endDate (LocalDate .of (2026 , Month .JUNE , 30 ))
181
+ .frequency (Frequency .P6M )
182
+ .businessDayAdjustment (BUSINESS_ADJUST )
183
+ .build ();
184
+ ResolvedFixedCouponBond bond = FixedCouponBond .builder ()
185
+ .securityId (SECURITY_ID )
186
+ .dayCount (DayCounts .ACT_ACT_ISDA )
187
+ .fixedRate (0.085 )
188
+ .legalEntityId (ISSUER_ID )
189
+ .currency (EUR )
190
+ .notional (100 )
191
+ .accrualSchedule (period )
192
+ .settlementDateOffset (DaysAdjustment .ofBusinessDays (2 , EUR_CALENDAR ))
193
+ .yieldConvention (FixedCouponBondYieldConvention .DE_BONDS )
194
+ .exCouponPeriod (EX_COUPON )
195
+ .build ()
196
+ .resolve (REF_DATA );
197
+ double cleanPrice = 1.05 ;
198
+ LocalDate settlementDate = period .getStartDate ();
199
+ double dirtyPrice = PRICER .dirtyPriceFromCleanPrice (bond , settlementDate , cleanPrice );
200
+ assertThat (dirtyPrice ).isCloseTo (cleanPrice , offset (TOL )); // 2.x.
201
+ double yield = PRICER .yieldFromDirtyPrice (bond , settlementDate , dirtyPrice );
202
+ assertThat (yield ).isCloseTo (0.07286881667273096 , offset (TOL )); // 2.x.œœ
203
+ }
204
+
205
+ @ Test
206
+ public void test_yield_act_act_icma () {
207
+ PeriodicSchedule period = PeriodicSchedule .builder ()
208
+ .startDate (LocalDate .of (2021 , Month .JUNE , 30 ))
209
+ .endDate (LocalDate .of (2026 , Month .JUNE , 30 ))
210
+ .frequency (Frequency .P6M )
211
+ .businessDayAdjustment (BUSINESS_ADJUST )
212
+ .build ();
213
+ ResolvedFixedCouponBond bond = FixedCouponBond .builder ()
214
+ .securityId (SECURITY_ID )
215
+ .dayCount (DayCounts .ACT_ACT_ICMA )
216
+ .fixedRate (0.085 )
217
+ .legalEntityId (ISSUER_ID )
218
+ .currency (EUR )
219
+ .notional (100 )
220
+ .accrualSchedule (period )
221
+ .settlementDateOffset (DaysAdjustment .ofBusinessDays (2 , EUR_CALENDAR ))
222
+ .yieldConvention (FixedCouponBondYieldConvention .DE_BONDS )
223
+ .exCouponPeriod (EX_COUPON )
224
+ .build ()
225
+ .resolve (REF_DATA );
226
+ double cleanPrice = 1.05 ;
227
+ LocalDate settlementDate = period .getStartDate ();
228
+ double dirtyPrice = PRICER .dirtyPriceFromCleanPrice (bond , settlementDate , cleanPrice );
229
+ assertThat (dirtyPrice ).isCloseTo (cleanPrice , offset (TOL )); // 2.x.
230
+ double yield = PRICER .yieldFromDirtyPrice (bond , settlementDate , dirtyPrice );
231
+ assertThat (yield ).isCloseTo (0.07288818170674201 , offset (TOL )); // 2.x.œœ
232
+ }
176
233
//-------------------------------------------------------------------------
177
234
@ Test
178
235
public void test_presentValue () {
0 commit comments