Pages

Wednesday, December 21, 2016

Quantopian(Python) vs Quantmod(R)

1, Sid-by-side comparison

2, Code snippet:

    from rpy2.robjects import r
    from pandas_datareader import data, wb
    import talib
    import numpy
    import matplotlib.pyplot as plt

    IBM = r("getSymbols('IBM', src='google', from='2013-01-01')")
    f = data.DataReader(ticker,'google')
    f['SMA_50'] = talib.SMA(numpy.asarray(f['Close']), 50)
    f.plot(y= ['Close','SMA_20','SMA_50'], title='AAPL Close & Moving Averages')
    plt.show()

3. Module Installation

    conda install rpy2
    conda install -c quantopian ta-lib

    # more inteteresting modules
    conda install -c quantopian zipline
    conda install -c quantopian pyfolio
    conda install seaborn
    conda install quandl

No comments:

Post a Comment