From 306839e6e353c9d728c5427fff24d4457de3c63d Mon Sep 17 00:00:00 2001 From: Andrew Daniels Date: Wed, 15 Jun 2016 11:37:09 -0400 Subject: [PATCH] MAINT: Creates deprecation warning for tradingcalendar imports The tradingcalendar module has been replaced by the new exchange calendars and trading schedules. Issues a ZiplineDeprecationWarning at tradingcalendar module scope to be triggered on imports. --- zipline/utils/tradingcalendar.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zipline/utils/tradingcalendar.py b/zipline/utils/tradingcalendar.py index 8ccd3c99..b59f6e00 100644 --- a/zipline/utils/tradingcalendar.py +++ b/zipline/utils/tradingcalendar.py @@ -14,14 +14,24 @@ # limitations under the License. import pandas as pd import pytz +import warnings from datetime import datetime from dateutil import rrule from functools import partial +from zipline.zipline_warnings import ZiplineDeprecationWarning + # IMPORTANT: This module is deprecated and is only here for temporary backwards # compatibility. Look at the `zipline.utils.calendars.trading_schedule` # module, as well as the calendar definitions in `zipline.utils.calendars`. +warnings.warn( + "The `tradingcalendar` module is deprecated. See the " + "`zipline.utils.calendars.trading_schedule` module, as well as the " + "calendar definitions in `zipline.utils.calendars`.", + category=ZiplineDeprecationWarning, + stacklevel=1, +) start = pd.Timestamp('1990-01-01', tz='UTC') end_base = pd.Timestamp('today', tz='UTC')