Merge branch 'master' into develop

This commit is contained in:
Victor Grau Serrat
2017-10-30 15:08:11 -06:00
5 changed files with 58 additions and 58 deletions
+11 -6
View File
@@ -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 $')
+10
View File
@@ -39,6 +39,7 @@ version:
.. code-block:: bash
$ pip install virtualenv
$ virtualenv catalyst-venv
$ source ./catalyst-venv/bin/activate
$ pip install enigma-catalyst
@@ -132,6 +133,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 <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
~~~~~~~~~~~~~~~~