My quant module for plotting shares

After updating my Arch Linux distribution, I thought I would get back into using Jupyter, the Python notebook. Using my quant module, I was able to produce this plot very simply:

indexIt shows a plot of the share price of DPLM (Diploma) since 2009/02, together with a 200dMA, using the following simple code:
df = quant.load_to_pandas("DPLM.L")
df['dma'] = pd.stats.moments.rolling_mean(df['Close'], 200)
df = df[df['Date']>= "2009-02"]
fig, ax = plt.subplots(nrows = 1, ncols = 1)
fig.set_size_inches(10, 5)
ax.plot(df['DateObj'], df['Close'])
ax.plot(df['DateObj'], df['dma'], color = 'r')

Getting 10 years of data from Yahoo is fairly straightforward:

I had forgotten just how great Python can be. If anyone knows Python fairly well (Windows users probably want the Anaconda “all-in-one” install), and would be interested in a little “sales pitch” (the module is entirely free, mind), then let me know, and I’ll try to put something together a little explanatory document (written in IPython, naturally!) to get your quant juices flowing.

BTW, the module also calculates RSIs and DMAs (rsi14 and dma50 are precalculated for you as part of the process of importing Yahoo data. How cool is that?).


About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s