Collect share prices and plot graphs with Python on a Raspberry Pi



E-mail...  rkn704 DOT norman AT gmail DOT com


I like to track share prices of various shares and study graphs with moving averages on them. What I don't like is the time it takes to do this using a web based package. Many brokers provide systems where you select each share in turn and then open a graph to your preferred time span and then select the moving averages you want shown. Even with the preferences saved it still takes a long time to review thirty or more different shares. Years ago my Dad had a DOS based programme called Microvest that was great for quickly reviewing lots of graphs. The problem with this programme was that each week you had to sit down with the Financial Times and type in each share price. What I wanted is the same fast and simple graphs with an arrangement to get the share prices automatically from the Internet. I decided to stick with the method Dad used and collect each share price once a week.

After a bit of searching I found the Ystockquote module that provides an easy method of collecting share price data from the Internet. I started with the intention of using a SQL database store the collected data. I found I could save data and use queries to extract data but could not get the data to automatically pass to Gnuplot. After a few days of very slow progress decided to keep things simple and go with a separate text file for each share. To pass data between a Python programme and Gnuplot I use Gnuplot.py. When you look at the programs you will find some bits that look like they were written by people who know what they are doing, that's the bits I have borrowed, the rest with its poor structure, inconsistent naming conventions and generally looking a bit crappy is all mine.

My Share Related Programs
Overview of programs Overview.pdf
   
GetHistorical (Not working since Yahoo update May 2017) GetHistorical.py
Collects historical share price data for multiple companies. GetHistorical.pdf Installation Notes
   
GetRegular GetRegular.py
Collects share price data each Friday for multiple companies. GetRegular.pdf Installation Notes
   
PlotShares PlotShares.py
Plots share prices data with rolling averages for all companies. PLotShares.pdf Installation Notes
   
PlotSingle PlotSingle.py
Plots share prices data with rolling averages for one company. PlotSingle.pdf Installation Notes
   
ReOrder ReOrder.py
Fixes data file issues, re-indexes, deletes duplicate records, etc... ReOrder.pdf Installation Notes
   
SetWatch SetWatch.py
Allows user to set a watch/sold/bought price on graphs. SetWatch.pdf Installation Notes
   
AdjPrice AdjPrice.py
Allows adjustment of share price data. AdjPrice.pdf Installation Notes
   
52WeekHiLo (Not working since barchart.com page update) 52WeekHiLo.py
Collects daily the number of shares achieving 52 week Highs and Lows. 52WeekHiLo.pdf Installation Notes
   
PlotHiLo PlotHiLo.py
Plots the 52 week Highs and Lows. PlotHiLo.pdf Installation Notes