How to install Zipline: an algorithm trading tool
It is not easy to install Zipline, Pythonic algorithmic trading library,https://github.com/quantopian/zipline, even following the install instruction. The original package only support Python 3.6, and not support latest version. So I find a version in author’s github of the book: machine learning for trading, which support Python version >= 3.7.
The technical analysis in Zipline uses a third-party library, TA-LIB: technical analysis library. Before installing ta-lib Python package, you need first compile ta-lib C++ library from the source code, following install instruction. After the C library ready in local, you can use pip to install package, e.g.
1. Download source code: ta-lib-0.4.0-src.tar.gz 2. decompress Zip file: tar -xzf ta-lib-0.4.0-src.tar.gz 3. Compile lib and install $ ./configure --prefix=/usr $ make $ sudo make install 4. Install Python package: pipenv install ta-lib (I use Pipenv: tool to manageme Python virtual environment management)
Then when pipenv install zipline-reloaded, it is not success. Check the error, which report key Turkey not in country. After checking source code, it is found Türkiye in the country name list (I remember Turkey changing country name to Türkiye, but code maybe a little old to update).
Country("Türkiye", "TR", "TUR", "792", "Türkiye"),
So I clone the package to my repository,Upgraded zipline, and doing upgrading the zipline for my usage, adding the following key mapping solving the issue.
Country("Turkey", "TR", "TUR", "792", "Türkiye")
If you have any issue to install Zipline, welcome discuss.