Day Count Programming Libraries

Q

Is there any programming libraries that use Day Count Conventions to count days?

✍: FYIcenter.com

A

There are a number of programming libraries that you can use to count days for interest calculation.

PHP Language: isda-day-count-convention - A PHP language package to calculate dates difference according to ISDA specification. It offers functions to support 4 Day Count Conventions: 30/360, 30E/360, 30E/360 Eurobond, and Actual/360.

$beginDate = new \DateTime('2007-02-28');
$endDate = new \DateTime('2007-03-31');

print ISDA::dateDiff30360($beginDate, $endDate); // 33 days
print ISDA::dateDiff30E360Isda($beginDate, $endDate); // 30 days
print ISDA::dateDiff30E360Eurobond($beginDate, $endDate); // 32 days
print ISDA::dateDiffActual360($beginDate, $endDate); // 31 days

R Language: BondValuation - A R language package for fixed coupon bond valuation allowing for odd coupon periods and various day count conventions. It offers the AccrInt() function that returns the amount of interest accrued from some starting date up to some end date and the number of days of interest on the end date. AccrInt() also returns the day count of the given period and day count convention.

(AccrInt, DaysAccrued) =  
  AccrInt(
    StartDate = as.Date(NA),
    EndDate = as.Date(NA),
    Coup = as.numeric(NA),
    DCC = as.numeric(NA),
    RV = as.numeric(NA),
    CpY = as.numeric(NA),
    Mat = as.Date(NA),
    YearNCP = as.Date(NA),
    EOM = as.numeric(NA),
    DateOrigin = as.Date("1970-01-01"),
    InputCheck = 1
  )

 

Terms Used in Day Count Conventions

Comparison of 30/360 Conventions

Introduction to Day Count Convention

⇑⇑ Day Count Conventions

2026-02-09, ∼202🔥, 0💬