Example #1
0
 def test_weekendsonly_calendar(self):
     wocal = WeekendsOnly()
     first_date = Date(31, Dec, 2014)
     Jan_1_2015 = Date(1, Jan, 2015)
     Jan_5_2015 = Date(5, Jan, 2015)
     period_1_day = Period(1, Days)
     period_3_day = Period(3, Days)
     # do not skip holidays
     self.assertEqual(Jan_1_2015, wocal.advance(first_date, period=period_1_day, convention=Following))
     # but skip weekend dates
     self.assertEqual(Jan_5_2015, wocal.advance(first_date, period=period_3_day, convention=Following))
Example #2
0
 def test_weekendsonly_calendar(self):
     wocal = WeekendsOnly()
     first_date  = Date(31, Dec, 2014)
     Jan_1_2015 = Date(1, Jan, 2015)
     Jan_5_2015 = Date(5, Jan, 2015)
     period_1_day = Period(1, Days)
     period_3_day = Period(3, Days)
     #do not skip holidays
     self.assertEqual(Jan_1_2015, wocal.advance(first_date,
                                                 period=period_1_day,
                                                 convention=Following))
     #but skip weekend dates
     self.assertEqual(Jan_5_2015, wocal.advance(first_date,
                                                 period=period_3_day,
                                                 convention=Following))
Example #3
0
from quantlib.time.calendars.null_calendar import NullCalendar
from quantlib.time.calendars.weekends_only import WeekendsOnly
import quantlib.time.calendars.germany as ger
import quantlib.time.calendars.united_states as us
import quantlib.time.calendars.united_kingdom as uk
import quantlib.time.calendars.japan as jp
import quantlib.time.calendars.switzerland as sw
import quantlib.time.calendars.canada as ca
from quantlib.time.calendars.target import TARGET
from quantlib.util.object_registry import ObjectRegistry

#ISO-3166 country codes (http://en.wikipedia.org/wiki/ISO_3166-1)
ISO_3166_CALENDARS = {
    'TARGET': TARGET(),
    'NULL': NullCalendar(),
    'WO': WeekendsOnly(),
    'DEU': ger.Germany(),
    'EUREX': ger.Germany(ger.EUREX),
    'FSE': ger.Germany(ger.FRANKFURT_STOCK_EXCHANGE),
    'EUWAX': ger.Germany(ger.EUWAX),
    'XETRA': ger.Germany(ger.XETRA),
    'GBR': uk.UnitedKingdom(),
    'LSE': uk.UnitedKingdom(uk.EXCHANGE),
    'LME': uk.UnitedKingdom(uk.METALS),
    'USA': us.UnitedStates(),
    'USA-GVT-BONDS': us.UnitedStates(us.GOVERNMENTBOND),
    'NYSE': us.UnitedStates(us.NYSE),
    'NERC': us.UnitedStates(us.NERC),
    'JPN': jp.Japan(),
    'CHE': sw.Switzerland(),
    'CAN': ca.Canada(),