You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before I tell you about my issue, let me describe my environment:
Operating System: (MacOs`)
Python Version: $2.8.0 --version
How did you install Zipline: (pip install zipline-loaded)
I am trying to build a custom calendar and all is working except for this error
ValueError: Receieved calendar arguments although twentyFourHourCalendar is registered as a specific instance of class <class 'cutsomCalendar.twentyFourHourCalendar'>, not as a calendar factory.
I am importing a twentyFourHourCalendar class from a customCalendar.py file
from zipline.utils.memoize import lazyval
from pandas.tseries.offsets import CustomBusinessDay
from datetime import time
from pytz import timezone
from zipline.utils.calendar_utils import TradingCalendar
class twentyFourHourCalendar(TradingCalendar):
"""
An exchange calendar for trading assets 24/7.
Open Time: 12AM, UTC
Close Time: 11:59PM, UTC
"""
tz = timezone("UTC")
@property
def name(self):
"""
The name of the exchange, which Zipline will look for
when we run our algorithm and pass TFS to
the --trading-calendar CLI flag.
"""
return "TwentyFourHourCalendar"
@property
def open_times(self):
"""
Method to specify the open times for each trading session.
"""
return ((None, time(0, 0)),)
@property
def close_times(self):
"""
Method to specify the close times for each trading session.
"""
return ((None, time(23, 59)),)
@lazyval
def day(self):
"""
The days on which our exchange will be open.
"""
return CustomBusinessDay(weekmask="Mon Tue Wed Thu Fri Sat Sun")
And using the same way of registering a calendar and this error is caused by the get_calendar() function
Dear Zipline Maintainers,
Before I tell you about my issue, let me describe my environment:
$2.8.0 --version
pip install zipline-loaded
)I am trying to build a custom calendar and all is working except for this error
ValueError: Receieved calendar arguments although twentyFourHourCalendar is registered as a specific instance of class <class 'cutsomCalendar.twentyFourHourCalendar'>, not as a calendar factory.
I am importing a twentyFourHourCalendar class from a customCalendar.py file
from zipline.utils.memoize import lazyval
from pandas.tseries.offsets import CustomBusinessDay
from datetime import time
from pytz import timezone
from zipline.utils.calendar_utils import TradingCalendar
class twentyFourHourCalendar(TradingCalendar):
"""
An exchange calendar for trading assets 24/7.
And using the same way of registering a calendar and this error is caused by the get_calendar() function
start_date = pd.Timestamp('2018-03-31')
end_date = pd.Timestamp('2023-09-21')
TwentyFourHourCalendar = twentyFourHourCalendar(start_date, end_date, side='both')
register_calendar("twentyFourHourCalendar", TwentyFourHourCalendar, force = True)
twenty_four_hr = get_calendar("twentyFourHourCalendar")
What steps have you taken to resolve this already?
I've searched for the error everywhere and couldn't find a solution and will appreciate your help!
Sincerely,
Hossam
The text was updated successfully, but these errors were encountered: