Skip to content

Problems with NYSE calendar - Xmas eve 1945 and 1956 #196

Open
@cactus1549

Description

This is related to #147 .

I am backtesting with data going back to 1900. If I do:

import pandas as pd
from pytz import UTC
from trading_calendars.exchange_calendar_xnys import XNYSExchangeCalendar

start =  pd.Timestamp('1900-01-02', tz=UTC)
tcal = XNYSExchangeCalendar(start=start)

I get the following errors:

(zipline) xxx@yyy:~/qa/trader$  cd /home/xxx/qa/trader ; /usr/bin/env /home/xxx/anaconda3/envs/zipline/bin/python /home/xxx/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/lib/python/debugpy/launcher 33469 -- /home/xxx/qa/zipline-test/test_trading_calendar.py 
Traceback (most recent call last):
  File "/home/xxx/anaconda3/envs/zipline/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/xxx/anaconda3/envs/zipline/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/xxx/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
    cli.main()
  File "/home/xxx/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/xxx/.vscode/extensions/ms-python.python-2020.11.371526539/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 267, in run_file
    runpy.run_path(options.target, run_name=compat.force_str("__main__"))
  File "/home/xxx/anaconda3/envs/zipline/lib/python3.6/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/home/xxx/anaconda3/envs/zipline/lib/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/xxx/anaconda3/envs/zipline/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/xxx/qa/zipline-test/test_trading_calendar.py", line 8, in <module>
    tcal = XNYSExchangeCalendar(start=start)
  File "/home/xxx/anaconda3/envs/zipline/lib/python3.6/site-packages/trading_calendars/trading_calendar.py", line 143, in __init__
    _overwrite_special_dates(_all_days, self._closes, _special_closes)
  File "/home/xxx/anaconda3/envs/zipline/lib/python3.6/site-packages/trading_calendars/trading_calendar.py", line 1199, in _overwrite_special_dates
    raise ValueError("Special dates %s are not trading days." % bad_dates)
ValueError: Special dates [Timestamp('1945-12-24 19:00:00+0000', tz='UTC'), Timestamp('1956-12-24 19:00:00+0000', tz='UTC')] are not trading days.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions