Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zipline trading calendar error #43

Closed
dimatolsto opened this issue Aug 19, 2021 · 1 comment
Closed

zipline trading calendar error #43

dimatolsto opened this issue Aug 19, 2021 · 1 comment

Comments

@dimatolsto
Copy link

Environment

  • Operating System: Windows 10.0.19042 Build 19042
  • Python Version: Python 3.8.11
  • Python Bitness: 64
  • How did you install Zipline: conda install -c ml4t -c conda-forge -c ranaroussi zipline-reloaded
  • Python packages:
    absl-py==0.13.0
    alembic @ file:///home/conda/feedstock_root/build_artifacts/alembic_1622150326904/work
    anyio @ file:///C:/ci/anyio_1620153418380/work/dist
    argon2-cffi @ file:///C:/ci/argon2-cffi_1613037959010/work
    astunparse==1.6.3
    async-generator @ file:///home/ktietz/src/ci/async_generator_1611927993394/work
    attrs @ file:///tmp/build/80754af9/attrs_1620827162558/work
    Babel @ file:///tmp/build/80754af9/babel_1620871417480/work
    backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
    bcolz-zipline @ file:///C:/Miniconda3/envs/recipe/conda-bld/bcolz-zipline_1617506553916/work
    bleach @ file:///tmp/build/80754af9/bleach_1628110601003/work
    Bottleneck @ file:///D:/bld/bottleneck_1611195728907/work
    brotlipy==0.7.0
    cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
    certifi==2021.5.30
    cffi @ file:///C:/ci/cffi_1625831749120/work
    chardet @ file:///C:/ci/chardet_1607690654534/work
    click @ file:///D:/bld/click_1621503984716/work
    colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work
    cryptography @ file:///C:/ci/cryptography_1616769344312/work
    cycler==0.10.0
    decorator @ file:///tmp/build/80754af9/decorator_1621259047763/work
    defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work
    empyrical-reloaded @ file:///C:/Miniconda3/envs/recipe/conda-bld/empyrical-reloaded_1619114439364/work
    entrypoints==0.3
    flatbuffers==1.12
    gast==0.4.0
    google-auth-oauthlib==0.4.5
    google-pasta==0.2.0
    greenlet @ file:///D:/bld/greenlet_1628272304925/work
    grpcio==1.34.1
    h5py==3.1.0
    idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work
    importlib-metadata @ file:///C:/ci/importlib-metadata_1617877484576/work
    intervaltree==3.0.2
    ipykernel @ file:///C:/ci/ipykernel_1596190155316/work/dist/ipykernel-5.3.4-py3-none-any.whl
    ipython @ file:///C:/ci/ipython_1628244008373/work
    ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work
    iso3166==1.0.1
    iso4217 @ file:///home/conda/feedstock_root/build_artifacts/iso4217_1599436182614/work
    jedi @ file:///C:/ci/jedi_1611315808330/work
    Jinja2 @ file:///tmp/build/80754af9/jinja2_1624781299557/work
    json5 @ file:///tmp/build/80754af9/json5_1624432770122/work
    jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work
    jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1616770841739/work
    jupyter-core @ file:///C:/ci/jupyter_core_1612213356021/work
    jupyter-server @ file:///C:/ci/jupyter_server_1616084298403/work
    jupyterlab @ file:///tmp/build/80754af9/jupyterlab_1629124491270/work
    jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work
    jupyterlab-server @ file:///tmp/build/80754af9/jupyterlab_server_1629224937070/work
    keras-nightly==2.5.0.dev2021032900
    Keras-Preprocessing==1.1.2
    kiwisolver==1.3.1
    Logbook @ file:///C:/Miniconda3/envs/recipe/conda-bld/logbook_1617515633715/work
    lru-dict @ file:///D:/bld/lru-dict_1625138210706/work
    lxml @ file:///D:/bld/lxml_1616532526926/work
    Mako @ file:///home/conda/feedstock_root/build_artifacts/mako_1610659158978/work
    Markdown==3.3.4
    MarkupSafe @ file:///C:/ci/markupsafe_1621528314575/work
    matplotlib==3.4.3
    matplotlib-inline @ file:///tmp/build/80754af9/matplotlib-inline_1628242447089/work
    mistune==0.8.4
    multipledispatch==0.6.0
    multitasking @ file:///home/conda/feedstock_root/build_artifacts/multitasking_1622493113162/work
    nbclassic @ file:///tmp/build/80754af9/nbclassic_1616085367084/work
    nbclient @ file:///tmp/build/80754af9/nbclient_1614364831625/work
    nbconvert @ file:///C:/ci/nbconvert_1624479163777/work
    nbformat @ file:///tmp/build/80754af9/nbformat_1617383369282/work
    nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1613680548246/work
    networkx==2.3
    notebook @ file:///C:/ci/notebook_1629205926310/work
    numexpr @ file:///D:/bld/numexpr_1614971526698/work
    numpy @ file:///D:/bld/numpy_1629092230867/work
    opt-einsum==3.3.0
    packaging @ file:///tmp/build/80754af9/packaging_1625611678980/work
    pandas @ file:///D:/bld/pandas_1629113863488/work
    pandas-datareader @ file:///home/conda/feedstock_root/build_artifacts/pandas-datareader_1626254169655/work
    pandocfilters @ file:///C:/ci/pandocfilters_1605102497129/work
    parso @ file:///tmp/build/80754af9/parso_1617223946239/work
    patsy==0.5.1
    pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work
    Pillow==8.3.1
    prometheus-client @ file:///tmp/build/80754af9/prometheus_client_1623189609245/work
    prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1616415428029/work
    pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work
    Pygments @ file:///tmp/build/80754af9/pygments_1629234116488/work
    pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work
    pyparsing @ file:///home/linux1/recipes/ci/pyparsing_1610983426697/work
    pyreadline @ file:///D:/bld/pyreadline_1611175364000/work
    pyrsistent @ file:///C:/ci/pyrsistent_1600141795814/work
    PySocks @ file:///C:/ci/pysocks_1605287845585/work
    python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work
    python-editor==1.0.4
    python-interface @ file:///home/conda/feedstock_root/build_artifacts/python-interface_1599436021243/work
    pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work
    pywin32==228
    pywinpty==0.5.7
    pyzmq @ file:///C:/ci/pyzmq_1628276144921/work
    requests @ file:///tmp/build/80754af9/requests_1608241421344/work
    scipy @ file:///C:/bld/scipy_1628206591178/work
    Send2Trash @ file:///tmp/build/80754af9/send2trash_1607525499227/work
    six @ file:///tmp/build/80754af9/six_1623709665295/work
    sniffio @ file:///C:/ci/sniffio_1614030707456/work
    sortedcontainers @ file:///home/conda/feedstock_root/build_artifacts/sortedcontainers_1621217038088/work
    SQLAlchemy @ file:///D:/bld/sqlalchemy_1629315096852/work
    statsmodels @ file:///D:/bld/statsmodels_1612273760174/work
    TA-Lib==0.4.19
    tensorboard==2.5.0
    tensorflow==2.5.0
    tensorflow-estimator==2.5.0
    termcolor==1.1.0
    terminado==0.9.4
    testpath @ file:///tmp/build/80754af9/testpath_1624638946665/work
    toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1600973991856/work
    tornado @ file:///C:/ci/tornado_1606942392901/work
    trading-calendars @ file:///home/conda/feedstock_root/build_artifacts/trading-calendars_1609821900982/work
    traitlets @ file:///home/ktietz/src/ci/traitlets_1611929699868/work
    typing-extensions==3.7.4.3
    urllib3 @ file:///tmp/build/80754af9/urllib3_1625084269274/work
    wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work
    webencodings==0.5.1
    win-inet-pton @ file:///C:/ci/win_inet_pton_1605306167264/work
    wincertstore==0.2
    yfinance @ file:///usr/share/miniconda3/envs/recipe/conda-bld/yfinance_1619111496010/work
    zipline-reloaded @ file:///C:/Miniconda3/envs/recipe/conda-bld/zipline-reloaded_1620014385852/work
    zipp @ file:///tmp/build/80754af9/zipp_1625570634446/work

Description of Issue

  • What did you expect to happen?
    run:
    /Machine-Learning-for-Algorithmic-Trading-Second-Edition_Original/02_market_and_fundamental_data/03_data_providers/05_zipline_data_demo.ipynb

  • What happened instead?


TypeError Traceback (most recent call last)
in
1 import matplotlib.pyplot as plt
2 import pandas as pd
----> 3 from zipline.api import order_target, record, symbol
4 from zipline.examples import buyapple

~\anaconda3\envs\env_zipline\lib\site-packages\zipline_init_.py in
19 # This is not a place to dump arbitrary classes/modules for convenience,
20 # it is a place to expose the public interfaces.
---> 21 from trading_calendars import get_calendar
22
23 from . import data

~\anaconda3\envs\env_zipline\lib\site-packages\trading_calendars_init_.py in
14 # limitations under the License.
15
---> 16 from .trading_calendar import TradingCalendar
17 from .calendar_utils import (
18 clear_calendars,

~\anaconda3\envs\env_zipline\lib\site-packages\trading_calendars\trading_calendar.py in
31 import toolz
32
---> 33 from .calendar_helpers import (
34 NP_NAT,
35 compute_all_minutes,

~\anaconda3\envs\env_zipline\lib\site-packages\trading_calendars\calendar_helpers.py in
4 NANOSECONDS_PER_MINUTE = int(6e10)
5
----> 6 NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
7
8

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NaTType'

It seems it is a known issue: quantopian/trading_calendars#224

Sincerely,
$ Dmitry

@dimatolsto
Copy link
Author

installed pandas 1.2.5, the issue has resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant