Calc of IRR vs MS XIRR

Hi!
I try to calculate IRR for a bond with
start date: 2022-01-03
maturity date: 2025-01-03
settlement date: 2022-11-04
coupon: 2% (annual)
frequency: semiannual (Frequency.P6M)
day count: act/365 (DayCounts.ACT_365L)
clean price: 97

Using yieldFromDirtyPrice, I’ve a irr of 0.0345149172.
Using MS XIRR I’ve a irr of 0.0347078830.

Discounting cashflow with MS XIRR I got, exactly, the dirty price (97.6794520548),
Using strata irr I got 97.7180266080.

this is my code

public static void test() {
LocalDate settlementDate = LocalDate.of(2022,11, 4);
LocalDate startDate = LocalDate.of(2022,1, 3);
LocalDate maturityDate = LocalDate.of(2025,1, 3);
double couponRate = 0.02;

    BusinessDayAdjustment businessDayAdj = BusinessDayAdjustment.of(
            BusinessDayConventions.NO_ADJUST, HolidayCalendarIds.NO_HOLIDAYS);

    PeriodicSchedule accrualSchedule = PeriodicSchedule
            .builder()
            .startDate(startDate)
            .endDate(maturityDate)
            .lastRegularEndDate(maturityDate)
            .businessDayAdjustment(businessDayAdj)
            .frequency(Frequency.P6M)
            .stubConvention(StubConvention.NONE)
            .rollConvention(RollConventions.EOM)
            .build();

    FixedCouponBond fcb = FixedCouponBond
            .builder()
            .accrualSchedule(accrualSchedule)
            .currency(Currency.EUR)
            .securityId(SecurityId.of("CUSIP", "135087WL4"))
            .notional(100.)
            .fixedRate(couponRate)
            .dayCount(DayCounts.ACT_365L)
            .yieldConvention(FixedCouponBondYieldConvention.DE_BONDS)
            .legalEntityId(LegalEntityId.of("LegalEntity", "DUMMY"))
            .settlementDateOffset(DaysAdjustment.ofBusinessDays(3, HolidayCalendarIds.CATO))
            .build();

    ResolvedFixedCouponBond resolvedBond = fcb.resolve(ReferenceData.standard());
    double cleanPrice = 97 / 100.;
    double dirtyPrice = DiscountingFixedCouponBondProductPricer.DEFAULT.dirtyPriceFromCleanPrice(resolvedBond, settlementDate,cleanPrice);
    double accrual = DiscountingFixedCouponBondProductPricer.DEFAULT.accruedInterest(resolvedBond, settlementDate);
    double yield = DiscountingFixedCouponBondProductPricer.DEFAULT.yieldFromDirtyPrice(resolvedBond, settlementDate, dirtyPrice);
    double calculatedDirty = DiscountingFixedCouponBondProductPricer.DEFAULT.dirtyPriceFromYield(resolvedBond, settlementDate, yield);
    double macaulayDuration = DiscountingFixedCouponBondProductPricer.DEFAULT.macaulayDurationFromYield(resolvedBond, settlementDate, yield);
    double modifiedDuration = DiscountingFixedCouponBondProductPricer.DEFAULT.modifiedDurationFromYield(resolvedBond, settlementDate, yield);

    System.out.println("yield: " + yield);
    System.out.println("dirty: " + dirtyPrice);
    System.out.println("calculatedDirty: " + calculatedDirty);
    System.out.println("macaulayDuration: " + macaulayDuration);
    System.out.println("modifiedDuration: " + modifiedDuration);
    System.out.println("accrual: " + accrual);
    System.out.println("accrual days: " + DiscountingFixedCouponBondProductPricer.DEFAULT.accruedYearFraction(resolvedBond, settlementDate) * 365.);
}

img

What it’s wrong?

Nobody can’t help me?

Can you indicate what MS XIRR represents? It is not a strata terminology that I recognize.

The XIRR is an excel function that returns the internal rate of return for a schedule of cash flows that is not necessarily periodic. If I use xirr for discounting, i get the dirty-price (see print-screen). If i use irr (strata yield >
yieldFromDirtyPrice) i get a different value

No news for this issue?

Strata is not compared to Excel, which is a tool that we don’t control/use. The “yield” methods in Strata are tested against actual specification of the “yield” method for several conventions. It is also tested against other provider of specific financial tools.
It is worth noting that the financial market specifications of “yield” are a conventional quantities. For example it does not take into account the exact dates (only the payment frequency) and computed “time” using specific methods. You should check if the external tools you are comparing with use the financial market conventional definition of yield (e.g. Street convention) or their own personal internal conventions.

Ok, but i’ve
BusinessDayConventions.NO_ADJUST
HolidayCalendarIds.NO_HOLIDAYS
StubConvention.NONE
RollConventions.EOM
with no holidays on maturity date
So i don’t understand why, if i discount cashflow with strata yield, I don’t got (exactly) the dirty price.
For tenor I use ACT_365L so I calculate time as (maturity - starting)/365.
Call you tell me about other provider of specific financial tools?
Thanks for your reply