FinancePy

FinancePy API Reference

Day Count

financepy.utils.day_count

Classes

DayCount

DayCount(dcc_type: financepy.utils.day_count.DayCountTypes)
Calculate the fractional day count between two dates according to a specified day count convention.

Methods

year_frac

year_frac(self, dt1: financepy.utils.date.Date, dt2: financepy.utils.date.Date, dt3: financepy.utils.date.Date = None, freq_type: financepy.utils.frequency.FrequencyTypes = <FrequencyTypes.ANNUAL: 1>, is_termination_date: bool = False)
This method performs two functions: 1) It calculates the year fraction between dates dt1 and dt2 using the specified day count convention which is useful for calculating year fractions for Libor products whose flows are day count adjusted. In this case we will set dt3 to be None 2) This function is also for calculating bond accrued where dt1 is the last coupon date, dt2 is the settlement date of the bond and date dt3 must be set to the next coupon date. You will also need to provide a coupon frequency for some conventions. Note that if the date is intra-day, i.e. hh,mm and ss do not equal zero then that is used in the calculation of the year frac. This avoids discontinuities for short-dated intraday products. It should not affect normal dates for which hh=mm=ss=0. This seems like a useful source: https://www.eclipsesoftware.biz/DayCountConventions.html Wikipedia also has a decent survey of the conventions https://en.wikipedia.org/wiki/Day_count_convention and http://data.cbonds.info/files/cbondscalc/Calculator.pdf

DayCountTypes

DayCountTypes(*values)
Inherits from: Enum
Enumeration of day count types.

Functions

is_last_day_of_feb

is_last_day_of_feb(dt: financepy.utils.date.Date) -> bool
Return True if the date is the last day of February.
Generated automatically from the FinancePy source code. Do not edit this file manually.