stefan-jansen / machine-learning-for-trading

Code for Machine Learning for Algorithmic Trading, 2nd edition.
https://ml4trading.io
13.34k stars 4.21k forks source link

(not a bug) Backtesting env for windows #135

Closed copypasteearth closed 3 years ago

copypasteearth commented 3 years ago

Hello, I have been working on the material from the book, im upto chapter 6 and i ran all of the examples dealing with backtesting with this environment that i made for windows. Im trying to avoid all of the memory overhead that comes with running the docker image. this is a work in progress but i will update as i move forward. it wouldnt let me post the yml here but here is what it consists of

name: python36
channels:
  - conda-forge
  - defaults
dependencies:
  - alembic=1.5.8=pyhd8ed1ab_0
  - argon2-cffi=20.1.0=py36h2bbff1b_1
  - async_generator=1.10=py36h28b3542_0
  - attrs=20.3.0=pyhd3eb1b0_0
  - backcall=0.2.0=pyhd3eb1b0_0
  - bcolz=1.2.1=py36he350917_1001
  - blas=1.0=mkl
  - bleach=3.3.0=pyhd3eb1b0_0
  - blosc=1.21.0=h0e60522_0
  - bokeh=2.3.0=py36ha15d459_0
  - bottleneck=1.3.2=py36h6434af4_3
  - brotlipy=0.7.0=py36h68aa20f_1001
  - bzip2=1.0.8=h8ffe710_4
  - ca-certificates=2021.1.19=haa95532_1
  - cached-property=1.5.2=hd8ed1ab_1
  - cached_property=1.5.2=pyha770c72_1
  - certifi=2020.12.5=py36haa95532_0
  - cffi=1.14.5=py36hcd4344a_0
  - chardet=4.0.0=py36ha15d459_1
  - click=7.1.2=pyh9f0ad1d_0
  - cloudpickle=1.6.0=py_0
  - colorama=0.4.4=pyhd3eb1b0_0
  - contextvars=2.4=py_0
  - cryptography=3.4.6=py36hd0de82c_0
  - cycler=0.10.0=py36haa95532_0
  - cytoolz=0.11.0=py36h68aa20f_3
  - dask=2.10.1=py_0
  - dask-core=2.10.1=py_0
  - decorator=4.4.2=pyhd3eb1b0_0
  - defusedxml=0.7.1=pyhd3eb1b0_0
  - distributed=2.30.1=py36ha15d459_0
  - empyrical=0.5.5=pyh9f0ad1d_0
  - entrypoints=0.3=py36_0
  - freetype=2.10.4=hd328e21_0
  - fsspec=0.8.7=pyhd8ed1ab_0
  - greenlet=1.0.0=py36he2d232f_0
  - h5py=3.1.0=nompi_py36hf359dfe_100
  - hdf5=1.10.6=nompi_h5268f04_1114
  - heapdict=1.0.1=py_0
  - icu=58.2=ha925a31_3
  - idna=2.10=pyh9f0ad1d_0
  - immutables=0.15=py36h68aa20f_0
  - importlib-metadata=3.7.3=py36haa95532_1
  - importlib_metadata=3.7.3=hd3eb1b0_1
  - intel-openmp=2020.2=254
  - intervaltree=3.0.2=py_0
  - ipykernel=5.3.4=py36h5ca1d4c_0
  - ipython=7.16.1=py36h5ca1d4c_0
  - ipython_genutils=0.2.0=pyhd3eb1b0_1
  - ipywidgets=7.6.3=pyhd3eb1b0_1
  - iso3166=1.0.1=pyh9f0ad1d_0
  - iso4217=1.6.20180829=py_0
  - jedi=0.17.0=py36_0
  - jinja2=2.11.3=pyhd3eb1b0_0
  - jpeg=9b=hb83a4c4_2
  - jsonschema=3.2.0=py_2
  - jupyter=1.0.0=py36_7
  - jupyter_client=6.1.7=py_0
  - jupyter_console=6.3.0=pyhd3eb1b0_0
  - jupyter_core=4.7.1=py36haa95532_0
  - jupyterlab_pygments=0.1.2=py_0
  - jupyterlab_widgets=1.0.0=pyhd3eb1b0_1
  - kiwisolver=1.3.1=py36hd77b12b_0
  - krb5=1.17.2=hbae68bd_0
  - libblas=3.8.0=20_mkl
  - libcblas=3.8.0=20_mkl
  - libcurl=7.75.0=hf1763fc_0
  - libiconv=1.16=he774522_0
  - liblapack=3.8.0=20_mkl
  - libpng=1.6.37=h2a8f88b_0
  - libsodium=1.0.18=h62dcd97_0
  - libssh2=1.9.0=h680486a_6
  - libtiff=4.2.0=hd0e1b90_0
  - libxml2=2.9.10=hf5bbc77_3
  - libxslt=1.1.33=h65864e5_2
  - locket=0.2.0=py_2
  - logbook=1.5.3=py36h68aa20f_4
  - lru-dict=1.1.6=py36h68aa20f_3
  - lxml=4.6.3=py36hf8cb5f9_0
  - lz4-c=1.9.3=h2bbff1b_0
  - m2w64-gcc-libgfortran=5.3.0=6
  - m2w64-gcc-libs=5.3.0=7
  - m2w64-gcc-libs-core=5.3.0=7
  - m2w64-gmp=6.1.0=2
  - m2w64-libwinpthread-git=5.0.0.4634.697f757=2
  - mako=1.1.4=pyh44b312d_0
  - markupsafe=1.1.1=py36he774522_0
  - matplotlib=3.3.4=py36haa95532_0
  - matplotlib-base=3.3.4=py36h49ac443_0
  - mistune=0.8.4=py36he774522_0
  - mkl=2020.2=256
  - mkl-service=2.3.0=py36h196d8e1_0
  - mkl_fft=1.3.0=py36h46781fe_0
  - mkl_random=1.1.1=py36h47e9c7a_0
  - mock=4.0.3=py36ha15d459_1
  - msgpack-python=1.0.2=py36he95197e_1
  - msys2-conda-epoch=20160418=1
  - multipledispatch=0.6.0=py_0
  - nb_conda_kernels=2.3.1=py36haa95532_0
  - nbclient=0.5.3=pyhd3eb1b0_0
  - nbconvert=6.0.7=py36_0
  - nbformat=5.1.2=pyhd3eb1b0_1
  - nest-asyncio=1.5.1=pyhd3eb1b0_0
  - networkx=1.11=py36_0
  - notebook=6.3.0=py36haa95532_0
  - numexpr=2.7.3=py36he38d939_0
  - numpy=1.19.2=py36hadc3359_0
  - numpy-base=1.19.2=py36ha3acd2a_0
  - olefile=0.46=py36_0
  - openssl=1.1.1j=h2bbff1b_0
  - packaging=20.9=pyhd3eb1b0_0
  - pandas=0.22.0=py36_1
  - pandas-datareader=0.8.1=py_0
  - pandoc=2.12=haa95532_0
  - pandocfilters=1.4.3=py36haa95532_1
  - parso=0.8.1=pyhd3eb1b0_0
  - partd=1.1.0=py_0
  - patsy=0.5.1=py_0
  - pickleshare=0.7.5=pyhd3eb1b0_1003
  - pillow=8.1.2=py36h4fa10fc_0
  - pip=21.0.1=py36haa95532_0
  - prometheus_client=0.9.0=pyhd3eb1b0_0
  - prompt-toolkit=3.0.17=pyh06a4308_0
  - prompt_toolkit=3.0.17=hd3eb1b0_0
  - psutil=5.8.0=py36h68aa20f_1
  - pycparser=2.20=py_2
  - pygments=2.8.1=pyhd3eb1b0_0
  - pyopenssl=20.0.1=pyhd8ed1ab_0
  - pyparsing=2.4.7=pyhd3eb1b0_0
  - pyqt=5.9.2=py36h6538335_2
  - pyreadline=2.1=py36ha15d459_1003
  - pyrsistent=0.17.3=py36he774522_0
  - pysocks=1.7.1=py36ha15d459_3
  - pytables=3.6.1=py36hccbc503_3
  - python=3.6.13=h3758d61_0
  - python-dateutil=2.8.1=pyhd3eb1b0_0
  - python-editor=1.0.4=py_0
  - python-interface=1.6.0=py_0
  - python_abi=3.6=1_cp36m
  - pytz=2021.1=pyhd3eb1b0_0
  - pywin32=227=py36he774522_1
  - pywinpty=0.5.7=py36_0
  - pyyaml=5.4.1=py36h68aa20f_0
  - pyzmq=20.0.0=py36hd77b12b_1
  - qt=5.9.7=vc14h73c81de_0
  - qtconsole=5.0.2=pyhd3eb1b0_0
  - qtpy=1.9.0=py_0
  - requests=2.25.1=pyhd3deb0d_0
  - scipy=1.5.3=py36h7ff6e69_0
  - send2trash=1.5.0=pyhd3eb1b0_1
  - setuptools=52.0.0=py36haa95532_0
  - sip=4.19.8=py36h6538335_0
  - six=1.15.0=py36haa95532_0
  - sortedcontainers=2.3.0=pyhd8ed1ab_0
  - sqlalchemy=1.4.2=py36h68aa20f_0
  - sqlite=3.35.2=h2bbff1b_0
  - statsmodels=0.11.1=py36h779f372_2
  - tblib=1.7.0=pyhd8ed1ab_0
  - terminado=0.9.3=py36haa95532_0
  - testpath=0.4.4=pyhd3eb1b0_0
  - tk=8.6.10=he774522_0
  - toolz=0.11.1=py_0
  - tornado=6.1=py36h2bbff1b_0
  - trading-calendars=2.1.1=pyhd3deb0d_0
  - traitlets=4.3.3=py36_0
  - typing_extensions=3.7.4.3=pyha847dfd_0
  - urllib3=1.26.4=pyhd8ed1ab_0
  - vc=14.2=h21ff451_1
  - vs2015_runtime=14.27.29016=h5e58377_2
  - wcwidth=0.2.5=py_0
  - webencodings=0.5.1=py36_1
  - wheel=0.36.2=pyhd3eb1b0_0
  - widgetsnbextension=3.5.1=py36_0
  - win_inet_pton=1.1.0=py36ha15d459_2
  - wincertstore=0.2=py36h7fe50ca_0
  - winpty=0.4.3=4
  - xz=5.2.5=h62dcd97_0
  - yaml=0.2.5=he774522_0
  - zeromq=4.3.3=ha925a31_3
  - zict=2.0.0=py_0
  - zipline=1.4.1=py36he774522_0
  - zipp=3.4.1=pyhd3eb1b0_0
  - zlib=1.2.11=h62dcd97_4
  - zstd=1.4.5=h04227a9_0
  - pip:
    - alphalens==0.4.0
    - cvxpy==1.1.11
    - ecos==2.0.7.post1
    - inflection==0.5.1
    - joblib==1.0.1
    - more-itertools==8.7.0
    - osqp==0.6.2.post0
    - pickle5==0.0.11
    - pyfolio==0.9.2
    - pyportfolioopt==1.4.1
    - qdldl==0.1.5.post0
    - quandl==3.6.1
    - scikit-learn==0.24.1
    - scs==2.1.2
    - seaborn==0.10.1
    - threadpoolctl==2.1.0
stefan-jansen commented 3 years ago

Thank you! I'm going to publishe in the coming days a new version of Zipline that works with Python 3.7-3.9. On windows, you can install it using

conda install -c ml4t zipline-reloaded

The functionality remains unchanged, I just removed quite a few unused pieces that were holding back updates. I'll also update the documentation soon at https://zipline.ml4trading.io/.

Feel free to reopen if you have any questions.