aboutsummaryrefslogtreecommitdiffstats
path: root/python/dates.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/dates.py')
-rw-r--r--python/dates.py20
1 files changed, 1 insertions, 19 deletions
diff --git a/python/dates.py b/python/dates.py
index 1309aa17..0d6fe107 100644
--- a/python/dates.py
+++ b/python/dates.py
@@ -2,12 +2,7 @@ import datetime
import pandas as pd
from dateutil.relativedelta import relativedelta, WE
-from pandas.tseries.offsets import CustomBusinessDay, Day, QuarterBegin
-from pandas.tseries.holiday import get_calendar, HolidayCalendarFactory, GoodFriday
-
-fed_cal = get_calendar("USFederalHolidayCalendar")
-bond_cal = HolidayCalendarFactory("BondCalendar", fed_cal, GoodFriday)
-bus_day = CustomBusinessDay(calendar=bond_cal())
+from pandas.tseries.offsets import Day, QuarterBegin
def imm_dates(start_date, end_date):
@@ -40,19 +35,6 @@ def imm_date(d):
return r
-def days_accrued(tradedate):
- tradedate = pd.Timestamp(tradedate)
- start_protection = tradedate + Day()
- # we want the the largest twentieth imm date rolled forward such that
- # it's less than start_protection
- effective_date = pd.Timestamp(
- previous_twentieth(bus_day.rollback(start_protection).date())
- )
- effective_date = bus_day.rollforward(effective_date)
- delta = start_protection - effective_date
- return delta.days
-
-
def isleapyear(date):
return (date.year % 4) == 0 & (~(date.year % 100 == 0) | date.year % 400 == 0)