From 73eca75ed99bd54589e1ce3e7214e5482a3b8ed7 Mon Sep 17 00:00:00 2001 From: Abner Ayala-Acevedo Date: Fri, 20 Oct 2017 14:30:06 -0700 Subject: [PATCH 1/7] Updated conda .yml file to work with enigma 0.3 or above. Removed unnecessary libraries that were giving issues. --- etc/python2.7-environment.yml | 48 +++++++++-------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/etc/python2.7-environment.yml b/etc/python2.7-environment.yml index 34fabcbb..50754b44 100644 --- a/etc/python2.7-environment.yml +++ b/etc/python2.7-environment.yml @@ -1,30 +1,24 @@ name: catalyst channels: -- statiskit - defaults dependencies: - certifi=2016.2.28=py27_0 -- coverage=4.4.1=py27_0 -- nose=1.3.7=py27_1 +- libgfortran=3.0.0=1 +- mkl=2017.0.3=0 +- numpy=1.13.1=py27_0 - openssl=1.0.2l=0 -- path.py=10.3.1=py27_0 - pip=9.0.1=py27_1 - python=2.7.13=0 -- pyyaml=3.12=py27_0 - readline=6.2=2 -- setuptools=36.4.0=py27_0 -- six=1.10.0=py27_0 +- scipy=0.19.1=np113py27_0 +- setuptools=36.4.0=py27_1 - sqlite=3.13.0=0 - tk=8.5.18=0 - wheel=0.29.0=py27_0 -- yaml=0.1.6=0 - zlib=1.2.11=0 -- libdev=1.0.0=py27_0 -- python-dev=1.0.0=py27_0 -- python-scons=3.0.0=py27_0 - pip: - - alembic==0.9.5 - - backports.shutil-get-terminal-size==1.0.0 + - alembic==0.9.6 + - backports.functools-lru-cache==1.4 - bcolz==0.12.1 - bottleneck==1.2.1 - chardet==3.0.4 @@ -32,36 +26,22 @@ dependencies: - contextlib2==0.5.5 - cycler==0.10.0 - cyordereddict==1.0.0 - - cython==0.26.1 + - cython==0.27.1 - decorator==4.1.2 - empyrical==0.2.1 - - enigma-catalyst>=0.2.dev2 - - enum34==1.1.6 - - functools32==3.2.3.post2 - idna==2.6 - intervaltree==2.1.0 - - ipdb==0.10.3 - - ipdbplugin==1.4.5 - - ipython==5.5.0 - - ipython-genutils==0.2.0 - logbook==1.1.0 - lru-dict==1.1.6 - mako==1.0.7 - markupsafe==1.0 - - matplotlib==2.0.2 + - matplotlib==2.1.0 - multipledispatch==0.4.9 - - networkx==1.11 + - networkx==2.0 - numexpr==2.6.4 - - numpy==1.13.1 - pandas==0.19.2 - pandas-datareader==0.5.0 - - pathlib2==2.3.0 - patsy==0.4.1 - - pexpect==4.2.1 - - pickleshare==0.7.4 - - prompt-toolkit==1.0.15 - - ptyprocess==0.5.2 - - pygments==2.2.0 - pyparsing==2.2.0 - python-dateutil==2.6.1 - python-editor==1.0.3 @@ -69,16 +49,12 @@ dependencies: - requests==2.18.4 - requests-file==1.4.2 - requests-ftp==0.3.1 - - scandir==1.5 - - scipy==0.19.1 - - scons==3.0.0a20170821 - - simplegeneric==0.8.1 + - six==1.11.0 - sortedcontainers==1.5.7 - sqlalchemy==1.1.14 - statsmodels==0.8.0 - subprocess32==3.2.7 - tables==3.4.2 - toolz==0.8.2 - - traitlets==4.3.2 - urllib3==1.22 - - wcwidth==0.1.7 + - enigma-catalyst>=0.3 From 2f7cd978524f36012a0ddfdf8af068cbe5ad0838 Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Fri, 20 Oct 2017 15:37:04 -0600 Subject: [PATCH 2/7] DOC: WIP fix tutorial --- docs/source/beginner-tutorial.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/source/beginner-tutorial.rst b/docs/source/beginner-tutorial.rst index a19374ee..6b68f7db 100644 --- a/docs/source/beginner-tutorial.rst +++ b/docs/source/beginner-tutorial.rst @@ -429,6 +429,10 @@ and allows us to plot the price of bitcoin. For example, we could easily examine now how our portfolio value changed over time compared to the bitcoin price. +.. code-block:: python + + %load_ext catalyst + .. code-block:: python %pylab inline @@ -484,7 +488,8 @@ a function we use in the ``handle_data()`` section: .. code-block:: python - %%catalyst --start 2016-1-1 --end 2017-9-30 -x bitfinex -o dma.pickle + %%catalyst --start 2016-4-1 --end 2017-9-30 -x bitfinex + from catalyst.api import order, record, symbol, order_target def initialize(context): @@ -492,16 +497,16 @@ a function we use in the ``handle_data()`` section: context.asset = symbol('btc_usd') def handle_data(context, data): - # Skip first 300 days to get full windows + # Skip first 150 days to get full windows context.i += 1 - if context.i < 300: + if context.i < 150: return # Compute averages # data.history() has to be called with the same params # from above and returns a pandas dataframe. - short_mavg = data.history(context.asset, 'price', bar_count=100, frequency="1d").mean() - long_mavg = data.history(context.asset, 'price', bar_count=300, frequency="1d").mean() + short_mavg = data.history(context.asset, 'price', bar_count=50, frequency="1d").mean() + long_mavg = data.history(context.asset, 'price', bar_count=150, frequency="1d").mean() # Trading logic if short_mavg > long_mavg: @@ -518,7 +523,7 @@ a function we use in the ``handle_data()`` section: def analyze(context, perf): import matplotlib.pyplot as plt - fig = plt.figure() + fig = plt.figure(figsize=(12,12)) ax1 = fig.add_subplot(211) perf.portfolio_value.plot(ax=ax1) ax1.set_ylabel('portfolio value in $') From 7d2cf97fbfca7c20e62fc39eb351ed6ec475aff1 Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Mon, 23 Oct 2017 16:02:28 -0600 Subject: [PATCH 3/7] FIX: Conda install for Windows --- etc/python2.7-environment.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/etc/python2.7-environment.yml b/etc/python2.7-environment.yml index 50754b44..06a19677 100644 --- a/etc/python2.7-environment.yml +++ b/etc/python2.7-environment.yml @@ -3,17 +3,15 @@ channels: - defaults dependencies: - certifi=2016.2.28=py27_0 -- libgfortran=3.0.0=1 - mkl=2017.0.3=0 - numpy=1.13.1=py27_0 -- openssl=1.0.2l=0 +- openssl=1.0.2l - pip=9.0.1=py27_1 - python=2.7.13=0 -- readline=6.2=2 - scipy=0.19.1=np113py27_0 - setuptools=36.4.0=py27_1 -- sqlite=3.13.0=0 -- tk=8.5.18=0 +- sqlite=3.13.0 +- tk=8.5.18 - wheel=0.29.0=py27_0 - zlib=1.2.11=0 - pip: From 5f8016c67e473b2d998496b79d1e7f1daa8409de Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Thu, 26 Oct 2017 14:08:47 -0600 Subject: [PATCH 4/7] improving buy_btc_simple.py example --- catalyst/examples/buy_btc.py | 10 ---------- catalyst/examples/buy_btc_simple.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) delete mode 100644 catalyst/examples/buy_btc.py diff --git a/catalyst/examples/buy_btc.py b/catalyst/examples/buy_btc.py deleted file mode 100644 index e23b79b0..00000000 --- a/catalyst/examples/buy_btc.py +++ /dev/null @@ -1,10 +0,0 @@ -from catalyst.api import order, record, symbol - - -def initialize(context): - context.asset = symbol('btc_usd') - - -def handle_data(context, data): - order(context.asset, 1) - record(btc=data.current(context.asset, 'price')) diff --git a/catalyst/examples/buy_btc_simple.py b/catalyst/examples/buy_btc_simple.py index 78888715..ef64513b 100644 --- a/catalyst/examples/buy_btc_simple.py +++ b/catalyst/examples/buy_btc_simple.py @@ -1,3 +1,24 @@ +''' + This is a very simple example referenced in the beginner's tutorial: + https://enigmampc.github.io/catalyst/beginner-tutorial.html + + Run this example, by executing the following from your terminal: + catalyst run -f buy_btc_simple.py -x bitfinex --start 2016-1-1 --end 2017-9-30 -o buy_btc_simple_out.pickle + + If you want to run this code using another exchange, make sure that + the asset is available on that exchange. For example, if you were to run + it for exchange Poloniex, you would need to edit the following line: + + context.asset = symbol('btc_usdt') # note 'usdt' instead of 'usd' + + and specify exchange poloniex as follows: + + catalyst run -f buy_btc_simple.py -x poloniex --start 2016-1-1 --end 2017-9-30 -o buy_btc_simple_out.pickle + + To see which assets are available on each exchange, visit: + https://www.enigma.co/catalyst/status +''' + from catalyst.api import order, record, symbol def initialize(context): From b749d47a61abba7edcf0021ef06c509c51a4d1ce Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Fri, 27 Oct 2017 10:31:14 -0600 Subject: [PATCH 5/7] FIX: DOCS install --- docs/source/install.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index 028f9295..f663d4fb 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -41,7 +41,7 @@ version: $ virtualenv catalyst-venv $ source ./catalyst-venv/bin/activate - $ pip install enigma- + $ pip install enigma-catalyst Though not required by Catalyst directly, our example algorithms use matplotlib to visually display the results of the trading algorithms. If you wish to run @@ -132,6 +132,15 @@ it and install it before proceeding to the next step. For windows, the easiest and best supported way to install Catalyst is to use :ref:`Conda `. +Troubleshooting Visual C++ Compiler Install +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +We run into two different errors when trying to install the the `Microsoft Visual C++ +Compiler for Python 2.7` mentioned above: + +- + + Amazon Linux AMI ~~~~~~~~~~~~~~~~ From 86ab3804e5465d812685ba1946ef4c3e02507547 Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Fri, 27 Oct 2017 10:46:14 -0600 Subject: [PATCH 6/7] DOC: install --- docs/source/install.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/install.rst b/docs/source/install.rst index f663d4fb..3db00966 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -39,6 +39,7 @@ version: .. code-block:: bash + $ pip install virtualenv $ virtualenv catalyst-venv $ source ./catalyst-venv/bin/activate $ pip install enigma-catalyst From f47b657c6f46dda7f45c7425a44b6c8d85462ba1 Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Mon, 30 Oct 2017 11:57:26 -0600 Subject: [PATCH 7/7] fix conda install --- etc/python2.7-environment.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/python2.7-environment.yml b/etc/python2.7-environment.yml index 06a19677..d59c36ae 100644 --- a/etc/python2.7-environment.yml +++ b/etc/python2.7-environment.yml @@ -3,17 +3,17 @@ channels: - defaults dependencies: - certifi=2016.2.28=py27_0 -- mkl=2017.0.3=0 +- mkl=2017.0.3 - numpy=1.13.1=py27_0 - openssl=1.0.2l - pip=9.0.1=py27_1 -- python=2.7.13=0 +- python=2.7.13 - scipy=0.19.1=np113py27_0 - setuptools=36.4.0=py27_1 - sqlite=3.13.0 - tk=8.5.18 - wheel=0.29.0=py27_0 -- zlib=1.2.11=0 +- zlib=1.2.11 - pip: - alembic==0.9.6 - backports.functools-lru-cache==1.4