From 96b36c6614ae669805c871f26224afcbccd10f75 Mon Sep 17 00:00:00 2001 From: danim7 Date: Sat, 6 Jan 2018 23:55:07 +0100 Subject: [PATCH 1/4] DOC: wrong year: 2017 --> 2018 --- docs/source/releases.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/releases.rst b/docs/source/releases.rst index e095d0b4..5f642dfe 100644 --- a/docs/source/releases.rst +++ b/docs/source/releases.rst @@ -4,7 +4,7 @@ Release Notes Version 0.4.3 ^^^^^^^^^^^^^ -**Release Date**: 2017-01-05 +**Release Date**: 2018-01-05 Bug Fixes ~~~~~~~~~ @@ -13,7 +13,7 @@ Bug Fixes Version 0.4.2 ^^^^^^^^^^^^^ -**Release Date**: 2017-01-03 +**Release Date**: 2018-01-03 Bug Fixes ~~~~~~~~~ From 93ebbf8b1f4fe22fa157903465d706a7b26a8f40 Mon Sep 17 00:00:00 2001 From: Cam Sweeney Date: Tue, 9 Jan 2018 18:21:47 -0800 Subject: [PATCH 2/4] DOC: fix import and support python3 for beginner tutorial The beginner tutorial Dual Moving Average example attempted to import extract_transactions from the wrong location. The tutorial and corresponding example also would fail using python3 due to indexing the view object returned via context.exchange.values() --- catalyst/examples/dual_moving_average.py | 3 ++- docs/source/beginner-tutorial.rst | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/catalyst/examples/dual_moving_average.py b/catalyst/examples/dual_moving_average.py index 3a0a3f1f..ff5dfc5e 100644 --- a/catalyst/examples/dual_moving_average.py +++ b/catalyst/examples/dual_moving_average.py @@ -84,7 +84,8 @@ def handle_data(context, data): def analyze(context, perf): # Get the base_currency that was passed as a parameter to the simulation - base_currency = context.exchanges.values()[0].base_currency.upper() + exchange = list(context.exchanges.values())[0] + base_currency = exchange.base_currency.upper() # First chart: Plot portfolio value using base_currency ax1 = plt.subplot(411) diff --git a/docs/source/beginner-tutorial.rst b/docs/source/beginner-tutorial.rst index 12792ca4..35db90ee 100644 --- a/docs/source/beginner-tutorial.rst +++ b/docs/source/beginner-tutorial.rst @@ -589,7 +589,7 @@ the ``examples`` directory: from catalyst import run_algorithm from catalyst.api import (order, record, symbol, order_target_percent, get_open_orders) - from catalyst.exchange.stats_utils import extract_transactions + from catalyst.exchange.utils.stats_utils import extract_transactions NAMESPACE = 'dual_moving_average' log = Logger(NAMESPACE) @@ -660,7 +660,8 @@ the ``examples`` directory: def analyze(context, perf): # Get the base_currency that was passed as a parameter to the simulation - base_currency = context.exchanges.values()[0].base_currency.upper() + exchange = list(context.exchanges.values())[0] + base_currency = exchange.base_currency.upper() # First chart: Plot portfolio value using base_currency ax1 = plt.subplot(411) From e0827fe4ad0d3165561fc4acc79fd47a0a69aa6f Mon Sep 17 00:00:00 2001 From: Cam Sweeney Date: Thu, 11 Jan 2018 12:42:13 -0800 Subject: [PATCH 3/4] DOC: present virtualenv info before pip install command Creating a virtualenv is now explained before the command for install via pip. Following the instructions in the current state may cause users to install using the system python, negating the point of the virtualenv --- docs/source/install.rst | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index 13f0b115..4ef78df7 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -180,20 +180,6 @@ use a single tool to install Python and non-Python dependencies, or if you're already using `Anaconda `_ as your Python distribution, refer to the :ref:`Installing with Conda ` section. -Once you've installed the necessary additional dependencies for your system -(see below for your particular platform: :ref:`Linux`, :ref:`MacOS` or -:ref:`Windows`), you should be able to simply run - -.. code-block:: bash - - $ pip install enigma-catalyst matplotlib - -Note that in the command above we install two different packages. The second -one, ``matplotlib`` is a visualization library. While it's not strictly -required to run catalyst simulations or live trading, it comes in very handy -to visualize the performance of your algorithms, and for this reason we -recommend you install it, as well. - If you use Python for anything other than Catalyst, we **strongly** recommend that you install in a `virtualenv `_. The `Hitchhiker's Guide to @@ -206,8 +192,23 @@ summarized version: $ pip install virtualenv $ virtualenv catalyst-venv $ source ./catalyst-venv/bin/activate + + + +Once you've installed the necessary additional dependencies for your system +(:ref:`Linux`, :ref:`MacOS` or :ref:`Windows`) **and have activated your virtualenv**, you should be able to simply run + +.. code-block:: bash + $ pip install enigma-catalyst matplotlib +Note that in the command above we install two different packages. The second +one, ``matplotlib`` is a visualization library. While it's not strictly +required to run catalyst simulations or live trading, it comes in very handy +to visualize the performance of your algorithms, and for this reason we +recommend you install it, as well. + + Troubleshooting ``pip`` Install ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From b7a32656d5ed674657e4950227066fe42753a15d Mon Sep 17 00:00:00 2001 From: Victor Grau Serrat Date: Fri, 12 Jan 2018 12:15:04 -0700 Subject: [PATCH 4/4] DOC: improved doc of matplotlib error after installation --- docs/source/install.rst | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index 13f0b115..a5790372 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -408,20 +408,34 @@ following brew packages: $ brew install freetype pkg-config gcc openssl -MacOS + virtualenv + matplotlib -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +MacOS + virtualenv/conda + matplotlib +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A note about using matplotlib in virtual enviroments on MacOS: it may be -necessary to run +The first time that you try to run an algorithm that loads the ``matplotlib`` +library, you may get the following error: + +.. code-block:: text + + RuntimeError: Python is not installed as a framework. The Mac OS X backend + will not be able to function correctly if Python is not installed as a + framework. See the Python documentation for more information on installing + Python as a framework on Mac OS X. Please either reinstall Python as a + framework, or try one of the other backends. If you are using (Ana)Conda + please install python.app and replace the use of 'python' with 'pythonw'. + See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more + information. + +This is a ``matplotlib``-specific error, that will go away once you run the +following command: .. code-block:: bash echo "backend: TkAgg" > ~/.matplotlib/matplotlibrc in order to override the default ``MacOS`` backend for your system, which -may not be accessible from inside the virtual environment. This will allow -Catalyst to open matplotlib charts from within a virtual environment, which -is useful for displaying the performance of your backtests. To learn more +may not be accessible from inside the virtual or conda environment. This will +allow Catalyst to open matplotlib charts from within a virtual environment, +which is useful for displaying the performance of your backtests. To learn more about matplotlib backends, please refer to the `matplotlib backend documentation `_.