Beispiel #1
0
 def __init__(self, timeseries):
     super().__init__(timeseries)
     self._maturity = None
     # Swap Database Attributes
     self._index_tenor = ql.PeriodParser.parse(
         self.ts_attributes[INDEX_TENOR])
     self.fixed_business_convention = to_ql_business_convention(
         self.ts_attributes[BUSINESS_CONVENTION])
     self.settlement_days = int(self.ts_attributes[SETTLEMENT_DAYS])
     self.fixed_calendar = to_ql_calendar(self.ts_attributes[CALENDAR])
     self.fixed_leg_tenor = ql.PeriodParser.parse(
         self.ts_attributes[FIXED_LEG_TENOR])
     self.fixed_leg_day_counter = to_ql_day_counter(
         self.ts_attributes[DAY_COUNTER])
     # QuantLib Objects
     self.index = to_ql_rate_index(self.ts_attributes[INDEX],
                                   self._index_tenor, self.term_structure)
     # QuantLib Attributes
     self.calendar = ql.JointCalendar(self.fixed_calendar,
                                      self.index.fixingCalendar())
     self.day_counter = self.index.dayCounter()
     self.business_convention = self.index.businessDayConvention()
     self.fixing_days = self.index.fixingDays()
     self.month_end = self.index.endOfMonth()
     # Swap Index
     self.swap_index = ql.SwapIndex(self.ts_name, self._tenor,
                                    self.settlement_days, self.currency,
                                    self.calendar, self.fixed_leg_tenor,
                                    self.fixed_business_convention,
                                    self.fixed_leg_day_counter, self.index)
     # Rate Helper
     self.helper_rate = ql.SimpleQuote(0)
     self.helper_convexity = ql.SimpleQuote(0)
Beispiel #2
0
 def __init__(self, timeseries, is_deposit_rate=True):
     super().__init__(timeseries, is_deposit_rate=is_deposit_rate)
     self._tenor = ql.PeriodParser.parse(self.ts_attributes[TENOR_PERIOD])
     self.calendar = to_ql_calendar(self.ts_attributes[CALENDAR])
     self.day_counter = to_ql_day_counter(self.ts_attributes[DAY_COUNTER])
     self.business_convention = to_ql_business_convention(
         self.ts_attributes[BUSINESS_CONVENTION])
     self.fixing_days = int(self.ts_attributes[FIXING_DAYS])
     self.month_end = False
     # Rate Helper
     self.helper_rate = ql.SimpleQuote(0)
 def __init__(self, timeseries, telescopic_value_dates=True):
     super().__init__(timeseries, telescopic_value_dates=telescopic_value_dates)
     self.calendar = to_ql_calendar(self.ts_attributes[CALENDAR])
     self.day_counter = to_ql_day_counter(self.ts_attributes[DAY_COUNTER])
     self.business_convention = to_ql_business_convention(self.ts_attributes[BUSINESS_CONVENTION])
     self._maturity = to_ql_date(self.ts_attributes[MATURITY_DATE])
     self.fixing_days = int(self.ts_attributes[FIXING_DAYS])
     self.month_end = False
     self.index = to_ql_ibor_index(index=self.ts_attributes[SPREAD_TAG], fixing_days=self.fixing_days,
                                   currency=self.currency, calendar=self.calendar, day_counter=self.day_counter,
                                   overnight_index=True)
     # Rate Helper
     self.helper_rate = ql.SimpleQuote(0)
Beispiel #4
0
 def __init__(self, timeseries, first_cc):
     super().__init__(timeseries)
     self.first_cc = first_cc
     self.calendar = to_ql_calendar(self.attributes[CALENDAR])
     try:
         self._tenor = ql.PeriodParser.parse(self.attributes[TENOR_PERIOD])
     except KeyError:
         # If the deposit rate has no tenor, it must have a maturity.
         self._maturity = to_ql_date(to_datetime(self.attributes[MATURITY_DATE]))
     self.day_counter = to_ql_day_counter(self.attributes[DAY_COUNTER])
     self.compounding = to_ql_compounding(self.attributes[COMPOUNDING])
     self.frequency = to_ql_frequency(self.attributes[FREQUENCY])
     self.business_convention = to_ql_business_convention(self.attributes[BUSINESS_CONVENTION])
     self.fixing_days = int(self.attributes[FIXING_DAYS])
Beispiel #5
0
 def __init__(self, timeseries, currency_ts):
     super().__init__(timeseries)
     self._maturity = None
     # Swap Database Attributes
     self.currency_ts = currency_ts
     self._tenor = ql.PeriodParser.parse(self.ts_attributes[TENOR_PERIOD])
     self.calendar = to_ql_calendar(self.ts_attributes[CALENDAR])
     self.day_counter = to_ql_day_counter(self.ts_attributes[DAY_COUNTER])
     self.business_convention = to_ql_business_convention(
         self.ts_attributes[BUSINESS_CONVENTION])
     self.fixing_days = int(self.ts_attributes[FIXING_DAYS])
     self.base_currency = self.ts_attributes[BASE_CURRENCY]
     self.base_calendar = to_ql_calendar(self.ts_attributes[BASE_CALENDAR])
     self.country = self.ts_attributes[COUNTRY]
     self.month_end = False
     # Rate Helper
     self.currency_spot_rate = ql.SimpleQuote(1)
     self.currency_spot_handle = ql.RelinkableQuoteHandle(
         self.currency_spot_rate)
     self.helper_rate = ql.SimpleQuote(0)
     self.helper_spread = ql.SimpleQuote(0)
     self.helper_convexity = ql.SimpleQuote(0)
Beispiel #6
0
 def __init__(self, timeseries):
     super().__init__(timeseries)
     self._tenor = ql.PeriodParser.parse(self.ts_attributes[TENOR_PERIOD])
     self.calendar = to_ql_calendar(self.ts_attributes[CALENDAR])
     self.day_counter = to_ql_day_counter(self.ts_attributes[DAY_COUNTER])
     self.business_convention = to_ql_business_convention(
         self.ts_attributes[BUSINESS_CONVENTION])
     self.fixing_days = int(self.ts_attributes[FIXING_DAYS])
     self.date_generation = to_ql_date_generation(
         self.ts_attributes[DATE_GENERATION])
     self.coupon_frequency = ql.Period(
         to_ql_frequency(self.ts_attributes[FREQUENCY]))
     self.recovery_rate = float(self.ts_attributes[RECOVERY_RATE])
     self.coupon = float(self.ts_attributes[COUPONS])
     self.base_yield = self.ts_attributes[BASE_SPREAD_TAG]
     try:
         self.first_accrual_date = to_ql_date(
             self.ts_attributes[FIRST_ACCRUAL_DATE])
     except KeyError:
         self.first_accrual_date = None
     self.month_end = False
     # Rate Helper
     self.helper_rate = ql.SimpleQuote(0)