@@ -36,34 +36,61 @@ cdef class Calendar:
3636 return self .name
3737
3838 def is_holiday (self , date.Date test_date not None ):
39- ''' Returns true iff the weekday is part of the
40- weekend for the given market.
41- '''
39+ """ Returns `True` if the date is a holiday for the given market.
40+
41+ Parameters
42+ ----------
43+ test_date : :class:`~quantlib.time.date.Date`
44+ The date to check.
45+ """
4246 return self ._thisptr.isHoliday(test_date._thisptr)
4347
4448 def is_weekend (self , int week_day ):
45- ''' Returns true iff the date is last business day for the
46- month in given market.
47- '''
49+ """ Returns `True` if the weekday is part of the weekend for the given market.
50+
51+ Parameters
52+ ----------
53+ week_day : int
54+ The weekday to check (e.g., `quantlib.time.date.Monday`).
55+ """
4856 return self ._thisptr.isWeekend(< _date.Weekday> week_day)
4957
5058 def is_business_day (self , date.Date test_date not None ):
51- ''' Returns true iff the date is a business day for the
52- given market.
53- '''
59+ """ Returns `True` if the date is a business day for the given market.
60+
61+ Parameters
62+ ----------
63+ test_date : :class:`~quantlib.time.date.Date`
64+ The date to check.
65+ """
5466 return self ._thisptr.isBusinessDay(test_date._thisptr)
5567
5668 def is_end_of_month (self , date.Date test_date not None ):
57- ''' Is this date the last business day of the month to which the given
58- date belongs
59- '''
69+ """ Returns `True` if the date is the last business day of the month in the given market.
70+
71+ Parameters
72+ ----------
73+ test_date : :class:`~quantlib.time.date.Date`
74+ The date to check.
75+ """
6076 return self ._thisptr.isBusinessDay(test_date._thisptr)
6177
6278 def business_days_between (self , date.Date date1 not None ,
6379 date.Date date2 not None ,
6480 include_first = True , include_last = False ):
65- """ Returns the number of business days between date1 and date2. """
66-
81+ """ Returns the number of business days between two dates.
82+
83+ Parameters
84+ ----------
85+ date1 : :class:`~quantlib.time.date.Date`
86+ The start date.
87+ date2 : :class:`~quantlib.time.date.Date`
88+ The end date.
89+ include_first : bool, optional
90+ Whether to include the start date in the calculation.
91+ include_last : bool, optional
92+ Whether to include the end date in the calculation.
93+ """
6794 return self ._thisptr.businessDaysBetween(
6895 date1._thisptr,
6996 date2._thisptr,
@@ -72,27 +99,47 @@ cdef class Calendar:
7299 )
73100
74101 def end_of_month (self , date.Date current_date not None ):
75- """ Returns the ending date for the month that contains the given
76- date.
102+ """ Returns the last business day of the month to which the given date belongs.
77103
104+ Parameters
105+ ----------
106+ current_date : :class:`~quantlib.time.date.Date`
107+ The date to check.
78108 """
79-
80109 cdef _date.Date eom_date = self ._thisptr.endOfMonth(current_date._thisptr)
81-
82110 return date.date_from_qldate(eom_date)
83111
84112 def add_holiday (self , date.Date holiday not None ):
85- ''' Adds a date to the set of holidays for the given calendar. '''
113+ """ Adds a date to the set of holidays for the given calendar.
114+
115+ Parameters
116+ ----------
117+ holiday : :class:`~quantlib.time.date.Date`
118+ The holiday to add.
119+ """
86120 self ._thisptr.addHoliday(holiday._thisptr)
87121
88122 def remove_holiday (self , date.Date holiday not None ):
89- ''' Removes a date from the set of holidays for the given calendar.'''
123+ """ Removes a date from the set of holidays for the given calendar.
124+
125+ Parameters
126+ ----------
127+ holiday : :class:`~quantlib.time.date.Date`
128+ The holiday to remove.
129+ """
90130 self ._thisptr.removeHoliday(holiday._thisptr)
91131
92132 def adjust (self , date.Date given_date not None , int convention = Following):
93- ''' Adjusts a non-business day to the appropriate near business day
94- with respect to the given convention.
95- '''
133+ """ Adjusts a non-business day to the appropriate near business day
134+ with respect to the given convention.
135+
136+ Parameters
137+ ----------
138+ given_date : :class:`~quantlib.time.date.Date`
139+ The date to adjust.
140+ convention : int, optional
141+ The business day convention to use.
142+ """
96143 cdef _date.Date adjusted_date = self ._thisptr.adjust(
97144 given_date._thisptr,
98145 < _calendar.BusinessDayConvention> convention)
@@ -102,12 +149,23 @@ cdef class Calendar:
102149 def advance (self , date.Date given_date not None , int step = 0 , int units = - 1 ,
103150 date.Period period = None , int convention = Following,
104151 end_of_month = False ):
105- ''' Advances the given date of the given number of business days,
106- or period and returns the result.
107-
108- You must provide either a step and unit or a Period.
109-
110- '''
152+ """ Advances the given date by the given number of business days or period.
153+
154+ Parameters
155+ ----------
156+ given_date : :class:`~quantlib.time.date.Date`
157+ The date to advance.
158+ step : int, optional
159+ The number of steps to advance.
160+ units : int, optional
161+ The time unit for the step.
162+ period : :class:`~quantlib.time.date.Period`, optional
163+ The period to advance the date by.
164+ convention : int, optional
165+ The business day convention to use.
166+ end_of_month : bool, optional
167+ Whether to preserve the end-of-month status.
168+ """
111169 cdef _date.Date advanced_date
112170
113171 # fixme: add better checking on inputs
@@ -143,7 +201,17 @@ cdef class Calendar:
143201
144202 def holiday_list (self , date.Date from_date not None ,
145203 date.Date to_date not None , bool include_weekends = False ):
146- ''' Returns the holidays between two dates. '''
204+ """ Returns a list of holidays between two dates.
205+
206+ Parameters
207+ ----------
208+ from_date : :class:`~quantlib.time.date.Date`
209+ The start date.
210+ to_date : :class:`~quantlib.time.date.Date`
211+ The end date.
212+ include_weekends : bool, optional
213+ Whether to include weekends in the list of holidays.
214+ """
147215 cdef vector[_date.Date] dates = self ._thisptr.holidayList(
148216 from_date._thisptr,
149217 to_date._thisptr,
@@ -157,7 +225,15 @@ cdef class Calendar:
157225
158226 def business_day_list (self , date.Date from_date not None ,
159227 date.Date to_date not None ):
160- ''' Returns the business days between two dates. '''
228+ """ Returns a list of business days between two dates.
229+
230+ Parameters
231+ ----------
232+ from_date : :class:`~quantlib.time.date.Date`
233+ The start date.
234+ to_date : :class:`~quantlib.time.date.Date`
235+ The end date.
236+ """
161237 cdef vector[_date.Date] dates = self ._thisptr.businessDayList(
162238 from_date._thisptr,
163239 to_date._thisptr,
0 commit comments