:py:mod:`finpricing.utils` ========================== .. py:module:: finpricing.utils Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 bus_day_adj/index.rst calendar/index.rst cds_style/index.rst date/index.rst date_generator/index.rst day_count/index.rst error/index.rst frequency/index.rst holiday/index.rst instaplot/index.rst interpolator/index.rst literal/index.rst pandas_holiday/index.rst payment_schedule/index.rst tools/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: finpricing.utils.TimeInterval finpricing.utils.Date finpricing.utils.Date finpricing.utils.DayCountTypes finpricing.utils.DayCount finpricing.utils.Date finpricing.utils.BusDayAdjustTypes finpricing.utils.Holiday finpricing.utils.CalendarTypes finpricing.utils.DateGenRuleTypes finpricing.utils.Calendar finpricing.utils.FrequencyTypes finpricing.utils.BusDayAdjustTypes finpricing.utils.TimeInterval finpricing.utils.FrequencyTypes finpricing.utils.BusDayAdjustTypes finpricing.utils.CalendarTypes finpricing.utils.DayCountTypes finpricing.utils.ClassUtil finpricing.utils.CDSStubType finpricing.utils.CDSEffectiveDateStyle finpricing.utils.CDSTermStyle finpricing.utils.CDSAccruedStyle finpricing.utils.CDSStyle finpricing.utils.CDSStyleBase finpricing.utils.CDSStyleCorpNA finpricing.utils.Date finpricing.utils.ClassUtil finpricing.utils.TimeInterval finpricing.utils.Date finpricing.utils.CDSStyle finpricing.utils.CDSStubType finpricing.utils.CDSTermStyle finpricing.utils.Calendar finpricing.utils.DateGenerator finpricing.utils.Literal Functions ~~~~~~~~~ .. autoapisummary:: finpricing.utils.dict_to_obj_str finpricing.utils.prettyTableByColumn finpricing.utils.prettyTableByRow finpricing.utils.datetimeToDates finpricing.utils.datetimeToDates .. py:class:: TimeInterval(value: int, period: str) .. py:method:: from_string(interval_string) :classmethod: .. py:method:: __neg__() .. py:method:: __repr__() -> str Return repr(self). .. py:method:: __mul__(other: int) .. py:method:: __rmul__(other: int) .. py:class:: Date(year: int, month: int, day: int) .. py:property:: is_weekend :type: bool Return True if the date is a weekend, False otherwise Monday is 0 and Sunday is 6. .. py:attribute:: MON :value: 0 .. py:attribute:: TUE :value: 1 .. py:attribute:: WED :value: 2 .. py:attribute:: THU :value: 3 .. py:attribute:: FRI :value: 4 .. py:attribute:: SAT :value: 5 .. py:attribute:: SUN :value: 6 .. py:method:: to_tuple() -> tuple Return a tuple of (year, month, day) .. py:method:: convert_from_datetime(date: Union[datetime.date, Date]) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: convert_from_datetimes(dates: list[Union[datetime.date, Date]]) -> list[Date] :classmethod: Return a list of Date objects from a list of datetime.date objects .. py:method:: from_datetime(date: datetime.date) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: from_tuple(date_tuple: tuple) -> Date :classmethod: Return a Date object from a tuple of (year, month, day) .. py:method:: __sub__(other: object) -> int .. py:method:: __add__(days: int) -> Date .. py:method:: __eq__(other: object) -> bool Return self==value. .. py:method:: __lt__(other: object) -> bool Return self str Return repr(self). .. py:method:: add_days(days: int) -> Date Return a new Date object by adding days to self .. py:method:: add_months(months: int) -> Date Return a new Date object by adding months to self .. py:method:: add_weeks(weeks: int) -> Date Return a new Date object by adding weeks to self .. py:method:: add_years(years: int) -> Date Return a new Date object by adding years to self .. py:method:: add_tenor(tenor: str) -> Date Return a new Date object by adding tenor to self .. py:method:: add_interval(time_interval: TimeInterval) -> Date .. py:method:: strftime(fmt: str) -> str Return a string representing the date, controlled by an explicit format string .. py:method:: __hash__() -> int Return hash(self). .. py:class:: Date(year: int, month: int, day: int) .. py:property:: is_weekend :type: bool Return True if the date is a weekend, False otherwise Monday is 0 and Sunday is 6. .. py:attribute:: MON :value: 0 .. py:attribute:: TUE :value: 1 .. py:attribute:: WED :value: 2 .. py:attribute:: THU :value: 3 .. py:attribute:: FRI :value: 4 .. py:attribute:: SAT :value: 5 .. py:attribute:: SUN :value: 6 .. py:method:: to_tuple() -> tuple Return a tuple of (year, month, day) .. py:method:: convert_from_datetime(date: Union[datetime.date, Date]) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: convert_from_datetimes(dates: list[Union[datetime.date, Date]]) -> list[Date] :classmethod: Return a list of Date objects from a list of datetime.date objects .. py:method:: from_datetime(date: datetime.date) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: from_tuple(date_tuple: tuple) -> Date :classmethod: Return a Date object from a tuple of (year, month, day) .. py:method:: __sub__(other: object) -> int .. py:method:: __add__(days: int) -> Date .. py:method:: __eq__(other: object) -> bool Return self==value. .. py:method:: __lt__(other: object) -> bool Return self str Return repr(self). .. py:method:: add_days(days: int) -> Date Return a new Date object by adding days to self .. py:method:: add_months(months: int) -> Date Return a new Date object by adding months to self .. py:method:: add_weeks(weeks: int) -> Date Return a new Date object by adding weeks to self .. py:method:: add_years(years: int) -> Date Return a new Date object by adding years to self .. py:method:: add_tenor(tenor: str) -> Date Return a new Date object by adding tenor to self .. py:method:: add_interval(time_interval: TimeInterval) -> Date .. py:method:: strftime(fmt: str) -> str Return a string representing the date, controlled by an explicit format string .. py:method:: __hash__() -> int Return hash(self). .. py:exception:: NotSupportedError Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. .. py:class:: DayCountTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: ACT_360 :value: 0 .. py:attribute:: ACT_365 :value: 1 .. py:attribute:: THIRTY_360 :value: 2 .. py:attribute:: ACT_ACT_ISDA :value: 3 .. py:attribute:: Thirty_E_360 :value: 4 .. py:attribute:: Thirty_E_360_ISDA :value: 5 .. py:class:: DayCount(dccType: DayCountTypes) .. py:attribute:: year_frac .. py:method:: days_between(start_date: finpricing.utils.date.Date, end_date: finpricing.utils.date.Date, include_end=False) -> tuple Return the number of days and year fraction using a specific day count convention :returns: (days, fraction of year) :rtype: tuple .. py:method:: year_fraction(start_date: Union[finpricing.utils.date.Date, datetime.date], end_date: Union[finpricing.utils.date.Date, datetime.date], next_coupon_date: finpricing.utils.date.Date = None) -> float Return the fraction of year between two dates using a specific day count convention The actual calculation is done in days_between() method. :param start_date: start date of the accrual period :type start_date: Date :param end_date: end date of the accrual period. For a bond trade, it is the settlement date of the trade. :type end_date: Date :param next_coupon_date: next coupon date of the bond / maturity date of the bond if no more coupon payment :type next_coupon_date: Date .. py:method:: convert_dates_to_times(anchor_date: finpricing.utils.date.Date, dates: list[finpricing.utils.date.Date]) -> list[float] Return a list of time fraction (year fraction) between anchor date and each date in the list :param anchor_date: anchor date :type anchor_date: Date :param dates: list of dates :type dates: list[Date] :returns: list of time fraction (year fraction) :rtype: list[float] .. py:method:: __repr__() -> str Return the string representation of the object .. py:exception:: NotSupportedError Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. .. py:class:: Date(year: int, month: int, day: int) .. py:property:: is_weekend :type: bool Return True if the date is a weekend, False otherwise Monday is 0 and Sunday is 6. .. py:attribute:: MON :value: 0 .. py:attribute:: TUE :value: 1 .. py:attribute:: WED :value: 2 .. py:attribute:: THU :value: 3 .. py:attribute:: FRI :value: 4 .. py:attribute:: SAT :value: 5 .. py:attribute:: SUN :value: 6 .. py:method:: to_tuple() -> tuple Return a tuple of (year, month, day) .. py:method:: convert_from_datetime(date: Union[datetime.date, Date]) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: convert_from_datetimes(dates: list[Union[datetime.date, Date]]) -> list[Date] :classmethod: Return a list of Date objects from a list of datetime.date objects .. py:method:: from_datetime(date: datetime.date) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: from_tuple(date_tuple: tuple) -> Date :classmethod: Return a Date object from a tuple of (year, month, day) .. py:method:: __sub__(other: object) -> int .. py:method:: __add__(days: int) -> Date .. py:method:: __eq__(other: object) -> bool Return self==value. .. py:method:: __lt__(other: object) -> bool Return self str Return repr(self). .. py:method:: add_days(days: int) -> Date Return a new Date object by adding days to self .. py:method:: add_months(months: int) -> Date Return a new Date object by adding months to self .. py:method:: add_weeks(weeks: int) -> Date Return a new Date object by adding weeks to self .. py:method:: add_years(years: int) -> Date Return a new Date object by adding years to self .. py:method:: add_tenor(tenor: str) -> Date Return a new Date object by adding tenor to self .. py:method:: add_interval(time_interval: TimeInterval) -> Date .. py:method:: strftime(fmt: str) -> str Return a string representing the date, controlled by an explicit format string .. py:method:: __hash__() -> int Return hash(self). .. py:class:: BusDayAdjustTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: NONE :value: 1 .. py:attribute:: FOLLOWING :value: 2 .. py:attribute:: MODIFIED_FOLLOWING :value: 3 .. py:attribute:: PREVIOUS :value: 4 .. py:attribute:: MODIFIED_PREVIOUS :value: 5 .. py:class:: Holiday(calendarType: CalendarTypes) .. py:method:: is_holiday(date: finpricing.utils.date.Date) -> bool .. py:method:: holiday_united_states(date: finpricing.utils.date.Date) -> bool Return True if the date is a holiday in the United States, False otherwise Need to verify and enhance the dates. Reference: https://github.com/domokane/FinancePy/blob/master/financepy/utils/calendar.py#L830 .. py:class:: CalendarTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: NONE :value: 0 .. py:attribute:: WEEKEND :value: 1 .. py:attribute:: UNITED_STATES :value: 2 .. py:class:: DateGenRuleTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: FORWARD :value: 1 .. py:attribute:: BACKWARD :value: 2 .. py:class:: Calendar(calendarType: finpricing.utils.holiday.CalendarTypes) .. py:method:: is_holiday(date: finpricing.utils.date.Date) -> bool .. py:method:: is_business_day(date: finpricing.utils.date.Date) -> bool Return True if the date is a business day Weekend or not is determined solely by the date itself. Holiday or not is determined by the calendar. .. py:method:: add_business_days(date: finpricing.utils.date.Date, num_days: int) -> finpricing.utils.date.Date Return a new Date object by adding num_days business days to the date .. py:method:: adjust(date: finpricing.utils.date.Date, busDayAdjType: finpricing.utils.bus_day_adj.BusDayAdjustTypes) -> finpricing.utils.date.Date Return a new Date object by adjusting the date according to the Business Day Convention For details, https://jollycontrarian.com/index.php?title=Business_Day_Convention_-_ISDA_Definition .. py:class:: FrequencyTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: ANNUAL :value: 1 .. py:attribute:: SEMI_ANNUAL :value: 2 .. py:attribute:: QUARTERLY :value: 4 .. py:attribute:: MONTHLY :value: 12 .. py:attribute:: CONTINUOUS :value: 99 .. py:class:: BusDayAdjustTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: NONE :value: 1 .. py:attribute:: FOLLOWING :value: 2 .. py:attribute:: MODIFIED_FOLLOWING :value: 3 .. py:attribute:: PREVIOUS :value: 4 .. py:attribute:: MODIFIED_PREVIOUS :value: 5 .. py:class:: TimeInterval(value: int, period: str) .. py:method:: from_string(interval_string) :classmethod: .. py:method:: __neg__() .. py:method:: __repr__() -> str Return repr(self). .. py:method:: __mul__(other: int) .. py:method:: __rmul__(other: int) .. py:class:: FrequencyTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: ANNUAL :value: 1 .. py:attribute:: SEMI_ANNUAL :value: 2 .. py:attribute:: QUARTERLY :value: 4 .. py:attribute:: MONTHLY :value: 12 .. py:attribute:: CONTINUOUS :value: 99 .. py:class:: BusDayAdjustTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: NONE :value: 1 .. py:attribute:: FOLLOWING :value: 2 .. py:attribute:: MODIFIED_FOLLOWING :value: 3 .. py:attribute:: PREVIOUS :value: 4 .. py:attribute:: MODIFIED_PREVIOUS :value: 5 .. py:class:: CalendarTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: NONE :value: 0 .. py:attribute:: WEEKEND :value: 1 .. py:attribute:: UNITED_STATES :value: 2 .. py:class:: DayCountTypes Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: ACT_360 :value: 0 .. py:attribute:: ACT_365 :value: 1 .. py:attribute:: THIRTY_360 :value: 2 .. py:attribute:: ACT_ACT_ISDA :value: 3 .. py:attribute:: Thirty_E_360 :value: 4 .. py:attribute:: Thirty_E_360_ISDA :value: 5 .. py:class:: ClassUtil .. py:method:: save_attributes(ignore=[]) .. py:method:: resolve_dates(start_date, maturity_date_or_tenor) .. py:method:: first_valid(*args) .. py:class:: CDSStubType Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: NO_STUB :value: 'NO_STUB' .. py:class:: CDSEffectiveDateStyle Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: PCD :value: 'PCD' .. py:class:: CDSTermStyle Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: IMM_CORPORATE :value: 'IMM_CORPORATE' .. py:class:: CDSAccruedStyle Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: SNAC :value: 'SNAC' .. py:attribute:: CONVENTIONAL :value: 'CONVENTIONAL' .. py:class:: CDSStyle Bases: :py:obj:`finpricing.utils.tools.ClassUtil` .. py:method:: from_name(name) :classmethod: Return a CDSStyle instance from a string of name .. py:method:: CORP_NA() :classmethod: .. py:class:: CDSStyleBase(name, day_count_type, frequency_type, bus_day_adj_type, cds_term_style, cds_effective_date_style, cds_stub_length, minimal_stub_period: int, eom_adj: bool, calendar_type, accrued_style) Bases: :py:obj:`finpricing.utils.tools.ClassUtil` .. py:class:: CDSStyleCorpNA Bases: :py:obj:`CDSStyleBase` .. py:class:: Date(year: int, month: int, day: int) .. py:property:: is_weekend :type: bool Return True if the date is a weekend, False otherwise Monday is 0 and Sunday is 6. .. py:attribute:: MON :value: 0 .. py:attribute:: TUE :value: 1 .. py:attribute:: WED :value: 2 .. py:attribute:: THU :value: 3 .. py:attribute:: FRI :value: 4 .. py:attribute:: SAT :value: 5 .. py:attribute:: SUN :value: 6 .. py:method:: to_tuple() -> tuple Return a tuple of (year, month, day) .. py:method:: convert_from_datetime(date: Union[datetime.date, Date]) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: convert_from_datetimes(dates: list[Union[datetime.date, Date]]) -> list[Date] :classmethod: Return a list of Date objects from a list of datetime.date objects .. py:method:: from_datetime(date: datetime.date) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: from_tuple(date_tuple: tuple) -> Date :classmethod: Return a Date object from a tuple of (year, month, day) .. py:method:: __sub__(other: object) -> int .. py:method:: __add__(days: int) -> Date .. py:method:: __eq__(other: object) -> bool Return self==value. .. py:method:: __lt__(other: object) -> bool Return self str Return repr(self). .. py:method:: add_days(days: int) -> Date Return a new Date object by adding days to self .. py:method:: add_months(months: int) -> Date Return a new Date object by adding months to self .. py:method:: add_weeks(weeks: int) -> Date Return a new Date object by adding weeks to self .. py:method:: add_years(years: int) -> Date Return a new Date object by adding years to self .. py:method:: add_tenor(tenor: str) -> Date Return a new Date object by adding tenor to self .. py:method:: add_interval(time_interval: TimeInterval) -> Date .. py:method:: strftime(fmt: str) -> str Return a string representing the date, controlled by an explicit format string .. py:method:: __hash__() -> int Return hash(self). .. py:function:: dict_to_obj_str(d: dict) -> str Return the string representation of a dictionary .. py:function:: prettyTableByColumn(d: dict, align='') -> str Return the string representation of a dictionary in a pretty table format where dictionary values can be either iterables for direct use or tuples where the first element is an iterable and the second is a format string. Args: d (dict): Dictionary with data to be displayed by the table. align (str): String with column alignments. Use 'l' for left, 'r' for right, and 'c' for center. Returns: str: A string representation of the table. .. py:function:: prettyTableByRow(d: dict) -> str Return the string representation of a dictionary in a pretty table format The dictionary contains the row names as keys and the list of values as values. .. py:function:: datetimeToDates(func) .. py:class:: ClassUtil .. py:method:: save_attributes(ignore=[]) .. py:method:: resolve_dates(start_date, maturity_date_or_tenor) .. py:method:: first_valid(*args) .. py:class:: TimeInterval(value: int, period: str) .. py:method:: from_string(interval_string) :classmethod: .. py:method:: __neg__() .. py:method:: __repr__() -> str Return repr(self). .. py:method:: __mul__(other: int) .. py:method:: __rmul__(other: int) .. py:class:: Date(year: int, month: int, day: int) .. py:property:: is_weekend :type: bool Return True if the date is a weekend, False otherwise Monday is 0 and Sunday is 6. .. py:attribute:: MON :value: 0 .. py:attribute:: TUE :value: 1 .. py:attribute:: WED :value: 2 .. py:attribute:: THU :value: 3 .. py:attribute:: FRI :value: 4 .. py:attribute:: SAT :value: 5 .. py:attribute:: SUN :value: 6 .. py:method:: to_tuple() -> tuple Return a tuple of (year, month, day) .. py:method:: convert_from_datetime(date: Union[datetime.date, Date]) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: convert_from_datetimes(dates: list[Union[datetime.date, Date]]) -> list[Date] :classmethod: Return a list of Date objects from a list of datetime.date objects .. py:method:: from_datetime(date: datetime.date) -> Date :classmethod: Return a Date object from a datetime.date object .. py:method:: from_tuple(date_tuple: tuple) -> Date :classmethod: Return a Date object from a tuple of (year, month, day) .. py:method:: __sub__(other: object) -> int .. py:method:: __add__(days: int) -> Date .. py:method:: __eq__(other: object) -> bool Return self==value. .. py:method:: __lt__(other: object) -> bool Return self str Return repr(self). .. py:method:: add_days(days: int) -> Date Return a new Date object by adding days to self .. py:method:: add_months(months: int) -> Date Return a new Date object by adding months to self .. py:method:: add_weeks(weeks: int) -> Date Return a new Date object by adding weeks to self .. py:method:: add_years(years: int) -> Date Return a new Date object by adding years to self .. py:method:: add_tenor(tenor: str) -> Date Return a new Date object by adding tenor to self .. py:method:: add_interval(time_interval: TimeInterval) -> Date .. py:method:: strftime(fmt: str) -> str Return a string representing the date, controlled by an explicit format string .. py:method:: __hash__() -> int Return hash(self). .. py:class:: CDSStyle Bases: :py:obj:`finpricing.utils.tools.ClassUtil` .. py:method:: from_name(name) :classmethod: Return a CDSStyle instance from a string of name .. py:method:: CORP_NA() :classmethod: .. py:class:: CDSStubType Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: NO_STUB :value: 'NO_STUB' .. py:class:: CDSTermStyle Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: IMM_CORPORATE :value: 'IMM_CORPORATE' .. py:function:: datetimeToDates(func) .. py:class:: Calendar(calendarType: finpricing.utils.holiday.CalendarTypes) .. py:method:: is_holiday(date: finpricing.utils.date.Date) -> bool .. py:method:: is_business_day(date: finpricing.utils.date.Date) -> bool Return True if the date is a business day Weekend or not is determined solely by the date itself. Holiday or not is determined by the calendar. .. py:method:: add_business_days(date: finpricing.utils.date.Date, num_days: int) -> finpricing.utils.date.Date Return a new Date object by adding num_days business days to the date .. py:method:: adjust(date: finpricing.utils.date.Date, busDayAdjType: finpricing.utils.bus_day_adj.BusDayAdjustTypes) -> finpricing.utils.date.Date Return a new Date object by adjusting the date according to the Business Day Convention For details, https://jollycontrarian.com/index.php?title=Business_Day_Convention_-_ISDA_Definition .. py:class:: DateGenerator .. py:method:: generate_extended(start_date: Union[datetime.date, finpricing.utils.date.Date], maturity_date: Union[datetime.date, finpricing.utils.date.Date], time_interval: Union[finpricing.utils.date.TimeInterval, str], stub_at_end: bool) :staticmethod: generate a list of dates from start_date to maturity_date with given time_interval .. note:: if stub_at_end is True, the dates will be generated from start_date and roll forward until and after maturity_date if stub_at_end is False, the dates will be generated from maturity_date and roll backward until and before start_date :param start_date: start date :type start_date: Union[datetime.date, Date] :param maturity_date: maturity date :type maturity_date: Union[datetime.date, Date] :param time_interval: time interval :type time_interval: Union[TimeInterval, str] :param stub_at_end: whether the stub is at the end of the period :type stub_at_end: bool .. py:method:: generate_cds(start_date, maturity_date, cds_style: finpricing.utils.cds_style.CDSStyle, stub_at_end: bool = False) :staticmethod: generate a list of dates from start_date to maturity_date with given cds_style .. note:: Most likely, the stub is at the end of the period. In a NO_STUB case, the first date will be removed. So the first date will be after start_date. .. py:method:: generate_cds_adjust(start_date, maturity_date, cds_style: finpricing.utils.cds_style.CDSStyle, stub_at_end: bool = False) :staticmethod: generate accrual start dates, accrual end dates, and calendar adjusted payment dates for a cds contract NOTE only the payment dates are adjusted! .. py:method:: generate_cds_maturity_date(market_date: Union[finpricing.utils.date.Date, datetime.date], maturity_date: Union[finpricing.utils.date.Date, datetime.date], term_style: str = None) :staticmethod: return the adjusted maturity date for a cds contract by its term style FIXME This is not effectively implemented yet. It seems IMM CORPORATE returns the same maturity date as the input. .. py:method:: generate_cds_effective_date(market_date: Union[finpricing.utils.date.Date, datetime.date], maturity_date: Union[finpricing.utils.date.Date, datetime.date], cds_style: Union[finpricing.utils.cds_style.CDSStyle, str]) :staticmethod: generate the effective date for a cds contract when market date is in between coupon dates .. py:class:: Literal Bases: :py:obj:`enum.Enum` Literal constants .. py:attribute:: ONE_BASIS_POINT :value: 0.0001 .. py:attribute:: ONE_PERCENT :value: 0.01 .. py:attribute:: ZERO :value: 0 .. py:attribute:: UNIT :value: 1 .. py:attribute:: ONE_HUNDRED :value: 100 .. py:attribute:: ONE_THOUSAND :value: 1000 .. py:attribute:: ONE_MILLION :value: 1000000 .. py:attribute:: ONE_BILLION :value: 1000000000