示例#1
0
    def setUp(self):
        self.from_date = Date(1, Jan, 2011)
        self.to_date = Date(31, Dec, 2011)
        self.tenor = Period(4, Weeks)
        self.calendar = UnitedKingdom()
        self.convention = Following
        self.termination_convention = Preceding
        self.rule = Twentieth

        self.schedule = Schedule.from_effective_termination(
            self.from_date, self.to_date, self.tenor, self.calendar,
            self.convention, self.termination_convention, self.rule)
示例#2
0
    def test_previous_next_reference_date(self):
        from_date = Date(3, Sep, 2011)
        to_date = Date(15, Dec, 2011)
        tenor = Period(1, Months)
        calendar = UnitedKingdom()
        convention = Following
        termination_convention = Following
        rule = Forward

        fwd_schedule = Schedule.from_effective_termination(from_date, to_date,
                tenor, calendar, convention, termination_convention, rule)

        expected_date = Date(5, Sep, 2011)
        self.assertEqual(expected_date, fwd_schedule.next_date(from_date))

        rule = Backward

        bwd_schedule = Schedule.from_effective_termination(from_date, to_date,
                tenor, calendar, convention, termination_convention, rule)

        expected_date = Date(15, Nov, 2011)
        self.assertEqual(expected_date, bwd_schedule.previous_date(to_date))
示例#3
0
    def setUp(self):
        self.from_date = Date(1, Jan, 2011)
        self.to_date = Date(31, Dec, 2011)
        self.tenor = Period(4, Weeks)
        self.calendar = UnitedKingdom()
        self.convention = Following
        self.termination_convention = Preceding
        self.rule = Twentieth

        self.schedule = Schedule.from_effective_termination(
            self.from_date, self.to_date, self.tenor, self.calendar,
            self.convention, self.termination_convention, self.rule
        )
示例#4
0
    def test_previous_next_reference_date(self):
        from_date = Date(3, Sep, 2011)
        to_date = Date(15, Dec, 2011)
        tenor = Period(1, Months)
        calendar = UnitedKingdom()
        convention = Following
        termination_convention = Following
        rule = Forward

        fwd_schedule = Schedule.from_effective_termination(
            from_date, to_date, tenor, calendar, convention,
            termination_convention, rule)

        expected_date = Date(5, Sep, 2011)
        self.assertEqual(expected_date, fwd_schedule.next_date(from_date))

        rule = Backward

        bwd_schedule = Schedule.from_effective_termination(
            from_date, to_date, tenor, calendar, convention,
            termination_convention, rule)

        expected_date = Date(15, Nov, 2011)
        self.assertEqual(expected_date, bwd_schedule.previous_date(to_date))