• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.TARGET类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中quantlib.time.api.TARGET的典型用法代码示例。如果您正苦于以下问题:Python TARGET类的具体用法?Python TARGET怎么用?Python TARGET使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TARGET类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_create_libor_index

    def test_create_libor_index(self):

        settings = Settings.instance()

        # Market information
        calendar = TARGET()

        # must be a business day
        eval_date = calendar.adjust(today())
        settings.evaluation_date = eval_date

        settlement_days = 2
        settlement_date = calendar.advance(eval_date, settlement_days, Days)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date)

        term_structure = YieldTermStructure(relinkable=True)
        term_structure.link_to(FlatForward(settlement_date, 0.05,
                                           Actual365Fixed()))

        index = Libor('USD Libor', Period(6, Months), settlement_days,
                      USDCurrency(), calendar, Actual360(),
                      term_structure)

        t = index.tenor
        self.assertEqual(t.length, 6)
        self.assertEqual(t.units, 2)
        self.assertEqual('USD Libor6M Actual/360', index.name)
开发者ID:phenaff,项目名称:pyql,代码行数:28,代码来源:test_indexes.py


示例2: FlatHazardRateTestCase

class FlatHazardRateTestCase(unittest.TestCase):

    def setUp(self):
        self.calendar = TARGET()

        todays_date = Date(15, May, 2007)
        self.todays_date = self.calendar.adjust(todays_date)
        self.d = self.todays_date + Period(3, Years)

    def test_create_flat_hazard(self):
        Settings.instance().evaluation_date = self.todays_date
        flat_curve = FlatHazardRate(2, self.calendar, 0.05, Actual365Fixed())
        flat_curve_from_reference_date = FlatHazardRate.from_reference_date(
            self.calendar.advance(self.todays_date, 2, Days), 0.05, Actual365Fixed())
        self.assertIsNotNone(flat_curve)
        self.assertIsNotNone(flat_curve_from_reference_date)
        self.assertEqual(flat_curve.time_from_reference(self.d),
                         flat_curve_from_reference_date.time_from_reference(self.d))
        self.assertAlmostEqual(flat_curve.hazard_rate(self.d), 0.05)
        self.assertAlmostEqual(flat_curve.survival_probability(self.d),
                               math.exp(-0.05*flat_curve.time_from_reference(self.d)))

    def test_flat_hazard_with_quote(self):
        Settings.instance().evaluation_date = self.todays_date
        hazard_rate = SimpleQuote()
        flat_curve = FlatHazardRate(2, self.calendar, hazard_rate, Actual365Fixed())
        for h in [0.01, 0.02, 0.03]:
            hazard_rate.value =  h
            self.assertAlmostEqual(flat_curve.survival_probability(self.d),
                                   math.exp(-h * flat_curve.time_from_reference(self.d)))
开发者ID:enthought,项目名称:pyql,代码行数:30,代码来源:test_credit_termstructures.py


示例3: test_create_swap_index

    def test_create_swap_index(self):

        settings = Settings.instance()

        # Market information
        calendar = TARGET()

        # must be a business day
        eval_date = calendar.adjust(today())
        settings.evaluation_date = eval_date


        settlement_days = 2
        settlement_date = calendar.advance(eval_date, settlement_days, Days)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date);

        ibor_index = Libor('USD Libor', Period(6, Months), settlement_days,
                        USDCurrency(), calendar, Actual360())


        index = SwapIndex(
            'family name', Period(3, Months), 10, USDCurrency(), TARGET(),
            Period(12, Months), Following, Actual360(), ibor_index)

        self.assertIsNotNone(index)
开发者ID:PythonCharmers,项目名称:pyql,代码行数:26,代码来源:test_indexes.py


示例4: test_extrapolation

    def test_extrapolation(self):
        rate_helpers = build_helpers()
        settings = Settings()

        calendar = TARGET()

        # must be a business Days
        dtObs = date(2007, 4, 27)
        eval_date = calendar.adjust(pydate_to_qldate(dtObs))
        settings.evaluation_date = eval_date

        settlement_days = 2
        settlement_date = calendar.advance(eval_date, settlement_days, Days)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date)

        print('dt Obs: %s\ndt Eval: %s\ndt Settle: %s' %
              (dtObs, eval_date, settlement_date))
        ts_day_counter = ActualActual(ISDA)
        tolerance = 1.0e-2

        ts = PiecewiseYieldCurve('discount',
                                 'loglinear',
                                 settlement_date,
                                 rate_helpers,
                                 ts_day_counter,
                                 tolerance)

        # max_date raises an exception without extrapolaiton...
        self.assertFalse(ts.extrapolation)
        with self.assertRaisesRegexp(RuntimeError,
                                     "1st iteration: failed at 2nd alive instrument"):
            dtMax = ts.max_date
开发者ID:ChinaQuants,项目名称:pyql,代码行数:33,代码来源:test_zero_coupon.py


示例5: create_helper

def create_helper():

    calendar = TARGET()

    todays_date = Date(15, May, 2007)
    todays_date = calendar.adjust(todays_date)

    Settings.instance().evaluation_date = todays_date

    flat_rate = SimpleQuote(0.01)
    ts_curve = FlatForward(todays_date, flat_rate, Actual365Fixed())

    recovery_rate = 0.5
    quoted_spreads = 0.0150
    tenor = Period(3, Months)

    helper = SpreadCdsHelper(
        quoted_spreads,
        tenor,
        0,
        calendar,
        Quarterly,
        Following,
        TwentiethIMM,
        Actual365Fixed(),
        recovery_rate,
        ts_curve,
    )

    return todays_date, helper
开发者ID:ducky427,项目名称:pyql,代码行数:30,代码来源:test_cds.py


示例6: test_extrapolation

    def test_extrapolation(self):
        rate_helpers = build_helpers()
        settings = Settings()

        calendar = TARGET()

        # must be a business Days
        dtObs = date(2007, 4, 27)
        eval_date = calendar.adjust(pydate_to_qldate(dtObs))
        settings.evaluation_date = eval_date

        settlement_days = 2
        settlement_date = calendar.advance(eval_date, settlement_days, Days)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date)

        print('dt Obs: %s\ndt Eval: %s\ndt Settle: %s' %
              (dtObs, eval_date, settlement_date))
        ts_day_counter = ActualActual(ISDA)
        tolerance = 1.0e-2

        ts = PiecewiseYieldCurve.from_reference_date(BootstrapTrait.Discount,
                                 Interpolator.LogLinear,
                                 settlement_date,
                                 rate_helpers,
                                 ts_day_counter,
                                 tolerance)

        # max_date raises an exception without extrapolaiton...
        self.assertFalse(ts.extrapolation)
        with self.assertRaises(RuntimeError) as ctx:
            ts.discount(ts.max_date + 1)
        self.assertTrue(str(ctx.exception) in (
            "time (30.011) is past max curve time (30.0082)",
            "1st iteration: failed at 2nd alive instrument"))
开发者ID:enthought,项目名称:pyql,代码行数:35,代码来源:test_zero_coupon.py


示例7: test_zero_curve

    def test_zero_curve(self):
        rate_helpers = build_helpers()
        settings = Settings()

        calendar = TARGET()

        # must be a business Days
        dtObs = date(2007, 4, 27)
        eval_date = calendar.adjust(pydate_to_qldate(dtObs))
        settings.evaluation_date = eval_date

        settlement_days = 2
        settlement_date = calendar.advance(eval_date, settlement_days, Days)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date)

        ts_day_counter = ActualActual(ISDA)
        tolerance = 1.0e-2

        ts = PiecewiseYieldCurve('discount',
                                 'loglinear',
                                 settlement_date,
                                 rate_helpers,
                                 ts_day_counter,
                                 tolerance)

        # max_date raises an exception...
        ts.extrapolation = True
        zr = ts.zero_rate(Date(10, 5, 2027), ts_day_counter, 2)
        self.assertAlmostEqual(zr.rate, 0.0539332)
开发者ID:ChinaQuants,项目名称:pyql,代码行数:30,代码来源:test_zero_coupon.py


示例8: test_create_swap_index

    def test_create_swap_index(self):

        settings = Settings.instance()

        # Market information
        calendar = TARGET()

        # must be a business day
        eval_date = calendar.adjust(today())
        settings.evaluation_date = eval_date

        settlement_days = 2
        settlement_date = calendar.advance(eval_date, settlement_days, Days)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date)
        term_structure = YieldTermStructure(relinkable=True)
        term_structure.link_to(FlatForward(settlement_date, 0.05,
                                          Actual365Fixed()))

        ibor_index = Libor('USD Libor', Period(6, Months), settlement_days,
                        USDCurrency(), calendar, Actual360(),
                           term_structure)

        index = SwapIndex(
            'family name', Period(3, Months), 10, USDCurrency(), TARGET(),
            Period(12, Months), Following, Actual360(), ibor_index)

        self.assertIsNotNone(index)
开发者ID:GuidoE,项目名称:pyql,代码行数:28,代码来源:test_indexes.py


示例9: zero_curve

def zero_curve(ts, days, dtObs):
    calendar = TARGET()
    dtMat = [calendar.advance(dateToDate(dtObs), d, Days) for d in days]
    df = np.array([ts.discount(dt) for dt in dtMat])
    dtMat = [QLDateTodate(dt) for dt in dtMat]
    dtToday = QLDateTodate(dtObs)
    dt = np.array([(d-dtToday).days/365.0 for d in dtMat])
    zc = -np.log(df) / dt
    return (dtMat, zc)
开发者ID:adriancdperu,项目名称:pyql,代码行数:9,代码来源:LiborRiskFactors.py


示例10: test_creation

    def test_creation(self):

        settings = Settings()

        # Market information
        calendar = TARGET()

        # must be a business day
        settings.evaluation_date = calendar.adjust(today())

        settlement_date = Date(18, September, 2008)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date);

        quotes = [0.0096, 0.0145, 0.0194]
        tenors =  [3, 6, 12]

        rate_helpers = []

        calendar =  TARGET()
        deposit_day_counter = Actual365Fixed()
        convention = ModifiedFollowing
        end_of_month = True

        for quote, month in zip(quotes, tenors):
            tenor = Period(month, Months)
            fixing_days = 3

            helper = DepositRateHelper(
                quote, tenor, fixing_days, calendar, convention, end_of_month,
                deposit_day_counter
            )

            rate_helpers.append(helper)


        ts_day_counter = ActualActual(ISDA)

        tolerance = 1.0e-15

        ts = term_structure_factory(
            'discount', 'loglinear', settlement_date, rate_helpers,
            ts_day_counter, tolerance
        )

        self.assertIsNotNone(ts)

        self.assertEquals( Date(18, September, 2008), ts.reference_date)

        # this is not a real test ...
        self.assertAlmostEquals(0.9975, ts.discount(Date(21, 12, 2008)), 4)
        self.assertAlmostEquals(0.9944, ts.discount(Date(21, 4, 2009)), 4)
        self.assertAlmostEquals(0.9904, ts.discount(Date(21, 9, 2009)), 4)
开发者ID:bondgeek,项目名称:pyql,代码行数:53,代码来源:test_piecewise_yield_curve.py


示例11: test_creation

    def test_creation(self):

        settings = Settings()

        # Market information
        calendar = TARGET()

        # must be a business day
        settings.evaluation_date = calendar.adjust(today())

        settlement_date = Date(18, September, 2008)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date);

        quotes = [SimpleQuote(0.0096), SimpleQuote(0.0145), SimpleQuote(0.0194)]
        tenors =  [3, 6, 12]

        rate_helpers = []

        calendar =  TARGET()
        deposit_day_counter = Actual365Fixed()
        convention = ModifiedFollowing
        end_of_month = True

        for quote, month in zip(quotes, tenors):
            tenor = Period(month, Months)
            fixing_days = 3

            helper = DepositRateHelper(
                quote, tenor, fixing_days, calendar, convention, end_of_month,
                deposit_day_counter
            )

            rate_helpers.append(helper)


        ts_day_counter = ActualActual(ISDA)

        tolerance = 1.0e-15

        ts = PiecewiseYieldCurve.from_reference_date(
            BootstrapTrait.Discount, Interpolator.LogLinear, settlement_date, rate_helpers,
            ts_day_counter, tolerance
        )

        self.assertIsNotNone(ts)

        self.assertEqual( Date(18, September, 2008), ts.reference_date)

        # this is not a real test ...
        self.assertAlmostEqual(0.9975, ts.discount(Date(21, 12, 2008)), 4)
        self.assertAlmostEqual(0.9944, ts.discount(Date(21, 4, 2009)), 4)
        self.assertAlmostEqual(0.9904, ts.discount(Date(21, 9, 2009)), 4)
开发者ID:enthought,项目名称:pyql,代码行数:53,代码来源:test_piecewise_yield_curve.py


示例12: zero_curve

def zero_curve(ts, dtObs):
    dtMax = ts.max_date

    calendar = TARGET()
    days = range(10, 365 * 20, 30)
    dtMat = [min(dtMax, calendar.advance(dateToDate(dtObs), d, Days))
             for d in days]
    # largest dtMat < dtMax, yet QL run time error

    df = np.array([ts.discount(dt, extrapolate=True) for dt in dtMat])
    dtMat = [QLDateTodate(dt) for dt in dtMat]
    dtToday = QLDateTodate(dtObs)
    dt = np.array([(d - dtToday).days / 365.0 for d in dtMat])
    zc = -np.log(df) / dt
    return (dtMat, zc)
开发者ID:ChinaQuants,项目名称:pyql,代码行数:15,代码来源:make_zero_coupon.py


示例13: test_bond_schedule_anotherday

    def test_bond_schedule_anotherday(self):
        '''Test date calculations and role of settings when evaluation date
        set to arbitrary date.

        This test is known to fail with boost 1.42.

        '''

        todays_date = Date(30, August, 2011)

        settings = Settings()
        settings.evaluation_date =  todays_date

        calendar = TARGET()
        effective_date = Date(10, Jul, 2006)
        termination_date = calendar.advance(
            effective_date, 10, Years, convention=Unadjusted)

        settlement_days = 3
        face_amount = 100.0
        coupon_rate = 0.05
        redemption = 100.0

        fixed_bond_schedule = Schedule.from_rule(
            effective_date,
            termination_date,
            Period(Annual),
            calendar,
            ModifiedFollowing,
            ModifiedFollowing,
            Rule.Backward
        )

        issue_date = effective_date

        bond = FixedRateBond(
            settlement_days,
		    face_amount,
		    fixed_bond_schedule,
		    [coupon_rate],
            ActualActual(ISMA),
		    Following,
            redemption,
            issue_date
        )

        self.assertEqual(
            calendar.advance(todays_date, 3, Days), bond.settlement_date())
开发者ID:enthought,项目名称:pyql,代码行数:48,代码来源:test_settings.py


示例14: test_all_types_of_piecewise_curves

    def test_all_types_of_piecewise_curves(self):

        settings = Settings()

        # Market information
        calendar = TARGET()

        todays_date = Date(12, September, 2008)
        # must be a business day
        settings.evaluation_date = calendar.adjust(todays_date)

        settlement_date = Date(18, September, 2008)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date);
        
        quotes = [SimpleQuote(0.0096), SimpleQuote(0.0145), SimpleQuote(0.0194)]

        tenors =  [3, 6, 12]

        rate_helpers = []

        deposit_day_counter = Actual365Fixed()
        convention = ModifiedFollowing
        end_of_month = True

        for quote, month in zip(quotes, tenors):
            tenor = Period(month, Months)
            fixing_days = 3

            helper = DepositRateHelper(
                quote, tenor, fixing_days, calendar, convention, end_of_month,
                deposit_day_counter
            )

            rate_helpers.append(helper)


        tolerance = 1.0e-15 

        for trait in VALID_TRAITS:
            for interpolation in VALID_INTERPOLATORS:
                ts = PiecewiseYieldCurve(
                    trait, interpolation, settlement_date, rate_helpers,
                    deposit_day_counter, tolerance
                )

                self.assertIsNotNone(ts)
                self.assertEqual( Date(18, September, 2008), ts.reference_date)
开发者ID:ChinaQuants,项目名称:pyql,代码行数:48,代码来源:test_piecewise_yield_curve.py


示例15: test_bond_schedule_today

    def test_bond_schedule_today(self):
        '''Test date calculations and role of settings when evaluation date 
        set to current date. 

        
        '''
        
        todays_date = today()

        settings = Settings()
        settings.evaluation_date =  todays_date

        calendar = TARGET()
        effective_date = Date(10, Jul, 2006)
        termination_date = calendar.advance(
            effective_date, 10, Years, convention=Unadjusted)

        settlement_days = 3
        face_amount = 100.0
        coupon_rate = 0.05
        redemption = 100.0
        
        fixed_bond_schedule = Schedule(
            effective_date,
            termination_date,
            Period(Annual),
            calendar,
            ModifiedFollowing,
            ModifiedFollowing,
            Backward
        )

        issue_date = effective_date

        bond = FixedRateBond(
            settlement_days,
		    face_amount,
		    fixed_bond_schedule,
		    [coupon_rate],
            ActualActual(ISMA), 
		    Following,
            redemption,
            issue_date
        )

        self.assertEquals(
            calendar.advance(todays_date, 3, Days), bond.settlement_date())
开发者ID:AlexArgus,项目名称:pyql,代码行数:47,代码来源:test_settings.py


示例16: setUp

    def setUp(self):
        calendar = TARGET()
        today_date = today()

        Settings().evaluation_date = today_date

        hazard_rate = SimpleQuote(0.01234)
        probability_curve = FlatHazardRate(0, calendar, hazard_rate, Actual360())
        discount_curve = FlatForward(today_date, 0.06, Actual360())
        issue_date  = today_date
        #calendar.advance(today_date, -1, Years)
        maturity = calendar.advance(issue_date, 10, Years)
        self.convention = Following
        self.schedule = Schedule(issue_date, maturity, Period("3M"), calendar,
                self.convention, self.convention, Rule.TwentiethIMM)
        recovery_rate = 0.4
        self.engine = MidPointCdsEngine(probability_curve, recovery_rate, discount_curve, True)
开发者ID:enthought,项目名称:pyql,代码行数:17,代码来源:test_cds.py


示例17: example02

def example02():
    print("example 2:\n")
    todays_date = Date(25, 9, 2014)
    Settings.instance().evaluation_date = todays_date

    calendar = TARGET()
    term_date = calendar.adjust(todays_date + Period(2, Years), Following)
    cds_schedule =  Schedule(todays_date, term_date, Period(Quarterly),
                             WeekendsOnly(), ModifiedFollowing,
                             ModifiedFollowing,
                             date_generation_rule=Rule.CDS)
    for date in cds_schedule:
        print(date)
    print()

    todays_date = Date(21, 10, 2014)
    Settings.instance().evaluation_date = todays_date
    quotes = [0.00006, 0.00045, 0.00081, 0.001840, 0.00256, 0.00337]
    tenors = [1, 2, 3, 6, 9, 12]
    deps = [DepositRateHelper(q, Period(t, Months), 2, calendar, ModifiedFollowing, False, Actual360())
           for q, t in zip(quotes, tenors)]
    tenors = [2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30]
    quotes = [0.00223, 0.002760, 0.003530, 0.004520, 0.005720, 0.007050, 0.008420, 0.009720, 0.010900,
              0.012870, 0.014970, 0.017, 0.01821]
    swaps = [SwapRateHelper.from_tenor(q, Period(t, Years),
                                       calendar, Annual, ModifiedFollowing,
                                       Thirty360(), Euribor6M(), SimpleQuote(0))
             for q, t in zip(quotes, tenors)]
    helpers = deps + swaps
    YC = PiecewiseYieldCurve.from_reference_date(BootstrapTrait.Discount, Interpolator.LogLinear,
            todays_date, helpers, Actual365Fixed())
    YC.extrapolation = True
    print("ISDA rate curve:")
    for h in helpers:
        print("{0}: {1:.6f}\t{2:.6f}".format(h.latest_date,
                                             YC.zero_rate(h.latest_date, Actual365Fixed(), 2).rate,
                                             YC.discount(h.latest_date)))
    defaultTs0 = FlatHazardRate(0, WeekendsOnly(), 0.016739207493630, Actual365Fixed())
    cds_schedule = Schedule.from_rule(Date(22, 9, 2014), Date(20, 12, 2019), Period(3, Months),
                            WeekendsOnly(), Following, Unadjusted, Rule.CDS, False)
    nominal = 100000000
    trade = CreditDefaultSwap(Side.Buyer, nominal, 0.01, cds_schedule, Following,
                            Actual360(), True, True, Date(22, 10, 2014), Actual360(True), True)
    engine = IsdaCdsEngine(defaultTs0, 0.4, YC, False)
    trade.set_pricing_engine(engine)
    print("reference trade NPV = {0}\n".format(trade.npv))
开发者ID:enthought,项目名称:pyql,代码行数:46,代码来源:cds.py


示例18: test_create_libor_index

    def test_create_libor_index(self):

        settings = Settings.instance()

        # Market information
        calendar = TARGET()

        # must be a business day
        eval_date = calendar.adjust(today())
        settings.evaluation_date = eval_date

        settlement_days = 2
        settlement_date = calendar.advance(eval_date, settlement_days, Days)
        # must be a business day
        settlement_date = calendar.adjust(settlement_date)

        index = Libor("USD Libor", Period(6, Months), settlement_days, USDCurrency(), calendar, Actual360())

        self.assertEquals("USD Libor6M Actual/360", index.name)
开发者ID:harpone,项目名称:pyql,代码行数:19,代码来源:test_indexes.py


示例19: test_relative_yieldcurve

    def test_relative_yieldcurve(self):
        settings = Settings()
        settings.evaluation_date = Date(6, 10, 2016)

        # Market information
        calendar = TARGET()

        quotes = [0.0096, 0.0145, 0.0194]
        tenors =  [3, 6, 12]

        deposit_day_counter = Actual365Fixed()
        convention = ModifiedFollowing
        end_of_month = True
        fixing_days = 3
        rate_helpers = [DepositRateHelper(
            quote, Period(month, Months), fixing_days, calendar, convention, end_of_month,
            deposit_day_counter) for quote, month in zip(quotes, tenors)]

        ts_day_counter = ActualActual(ISDA)

        tolerance = 1.0e-15

        ts_relative = PiecewiseYieldCurve(
            BootstrapTrait.Discount, Interpolator.LogLinear, 2, calendar, rate_helpers,
            ts_day_counter, tolerance
        )
        self.assertEqual(ts_relative.reference_date,
                         calendar.advance(settings.evaluation_date, period = Period(2, Days)))

        settings.evaluation_date = Date(10, 10, 2016)
        settlement_date =  calendar.advance(settings.evaluation_date, period = Period(2, Days))
        self.assertEqual(ts_relative.reference_date, settlement_date)

        ts_absolute = PiecewiseYieldCurve.from_reference_date(
            BootstrapTrait.Discount, Interpolator.LogLinear, settlement_date, rate_helpers,
            ts_day_counter, tolerance
        )
        self.assertEqual(ts_absolute.data, ts_relative.data)
        self.assertEqual(ts_absolute.dates, ts_relative.dates)
        self.assertEqual(ts_absolute.times, ts_relative.times)
开发者ID:enthought,项目名称:pyql,代码行数:40,代码来源:test_piecewise_yield_curve.py


示例20: setUp

    def setUp(self):
        self.calendar = TARGET()
        self.today = Date(9, 6, 2009)
        settlement_date = self.calendar.advance(self.today, 2, Days)
        Settings().evaluation_date = self.today
        rates = [0.035, 0.035, 0.033, 0.034, 0.034, 0.036, 0.037, 0.039, 0.04]
        ts = [13, 41, 75, 165, 256, 345, 524, 703]
        dates = [settlement_date] + [self.calendar.advance(self.today, d, Days) for d in ts]
        self.day_counter = Actual360()
        self.term_structure = ZeroCurve(dates, rates, self.day_counter)
        self.spreads = [SimpleQuote(0.02), SimpleQuote(0.03)]
        self.spread_dates = [self.calendar.advance(self.today, 8, Months),
                             self.calendar.advance(self.today, 15, Months)]

        self.spreaded_term_structure = PiecewiseZeroSpreadedTermStructure(
            self.term_structure,
            self.spreads,
            self.spread_dates)
        self.spreaded_term_structure.extrapolation = True
开发者ID:enthought,项目名称:pyql,代码行数:19,代码来源:test_piecewise_zero_spreaded_termstructure.py



注:本文中的quantlib.time.api.TARGET类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python calendar.TARGET类代码示例发布时间:2022-05-26
下一篇:
Python api.today函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap