Skip to main content

pricing.year_fraction()

The year fraction of a date on Werner and Modlin’s half-month grid: the

Usage

pricing.year_fraction(
    year,
    month,
    day,
)

first of a month is its start, a day near the middle is half way, and the last day is the next month’s start (6/30 is 7/1).

It is a ratemaking date, not a calendar: do not assign accident years with it, since year_fraction(2016, 12, 31) is 2017.0. Take the accident year from the date itself.

Parameters

year: int
month: int
day: int

Returns

float

Raises

ValueError
If the month or day does not exist.

Examples

>>> from prospicio.pricing import year_fraction
>>> year_fraction(2013, 6, 30) - year_fraction(2011, 1, 1)

2.5