def test_create_fra_rate_helper(self):

        quote = SimpleQuote(0.0096)
        month_to_start = 3
        month_to_end = 9
        fixing_days = 2
        calendar = TARGET()
        convention = ModifiedFollowing
        end_of_month = True
        day_counter = Actual365Fixed()

        helper_from_quote = FraRateHelper(quote, month_to_start, month_to_end,
                                          fixing_days, calendar, convention,
                                          end_of_month, day_counter)
        helper_from_float = FraRateHelper(0.0096, month_to_start, month_to_end,
                                          fixing_days, calendar, convention,
                                          end_of_month, day_counter)
        self.assertIsNotNone(helper_from_float, helper_from_quote)
        self.assertEqual(quote.value, helper_from_quote.quote)
        self.assertEqual(helper_from_quote.quote, helper_from_float.quote)
Ejemplo n.º 2
0
swap_rates = [
    0.00424, 0.00576, 0.00762, 0.00954, 0.011350, 0.014520, 0.015840, 0.018090,
    0.020370, 0.021870, 0.022340, 0.022560, 0.022950, 0.023480, 0.024210,
    0.02463
]
swap_periods = [3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 25, 30, 35, 40, 50, 60]
swap_quotes = {
    p * Years: SimpleQuote(r)
    for r, p in zip(swap_rates, swap_periods)
}

d6M = DepositRateHelper(d6MRate, 6 * Months, 3, calendar, Following, False,
                        depositDayCounter)

fras = [
    FraRateHelper.from_index(r, p, euribor6M)
    for r, p in zip(fra_rates, fra_periods)
]

# setup swaps

swFixedLegFrequency = Annual
swFixedLegConvention = Unadjusted
swFixedLegDayCounter = Thirty360(European)

swFloatingLegIndex = Euribor6M()
swaps = [
    SwapRateHelper.from_tenor(r,
                              p,
                              calendar,
                              swFixedLegFrequency,