Stock Picking using Python
- Financial data for 1600 public companies listed on the TSX is downloaded from http://finance.google.com.
- The annual and quarterly revenue and earnings is scraped from the HTML file using an sgrep query.
- Each company is filtered according to the following criteria:
- Resource, mining, and energy stocks are excluded.
- Stocks with PE ratio higher than 50 are excluded.
- Stocks which had negative revenue or earnings in the past two years are excluded.
- The remaining stocks are sorted by growth and displayed here.
Source code on Github
Data are from October 18, 2008.
SYMBOL COMPANY NAME Revenue Growth EPS Growth Price P/E
(Years positive) (Years Positive)
--------------------------------------------------------------------------------------------
cvg Clairvest Group Inc. 183% (2) 509% (2) 12.50 5
aui AltaGas Utility Group Inc. 165% (2) 127% (2) 5.59 8
chl.un Canadian Helicopters Income Fund 140% (2) 629% (2) 6.36 3
ibg.un IBI Income Fund 94% (3) 58% (2) 14.50 6
gvc Glacier Media Inc. 88% (3) 57% (3) 3.07 7
drx ADF Group, Inc. 82% (2) 785% (3) 1.95 1
rcm RuggedCom Inc. 78% (3) 35% (2) 12.00 22
prk Parkbridge Lifestyle Communities Inc. 70% (3) 119% (2) 4.00 12
rim Research In Motion Limited 65% (3) 86% (3) 70.25 22
mre Martinrea International Inc. 58% (3) 68% (3) 4.67 6
cjt.un Cargojet Income Fund 53% (2) 477% (2) 3.10 44
pbl.un Pollard Banknote Income Fund 52% (2) 68% (2) 7.12 7
cwa.un Coast Wholesale Appliances Income Fund 51% (2) 5% (2) 3.99 5
vnp 5N Plus Inc. 44% (3) 241% (2) 4.08 14
arf.un Armtec Infrastructure Income Fund 43% (3) 46% (3) 15.21 7
wpo World Point Terminals Inc. 43% (2) 43% (2) 12.07 14
et Evertz Technologies Limited 40% (3) 977% (3) 14.00 12
aah Aastra Technologies Limited 38% (3) 34% (2) 10.13 6
etc Equitable Group Inc. 37% (3) 23% (3) 15.00 5
ylo.un Yellow Pages Income Fund 37% (3) 42% (3) 8.40 9
mrd Melcor Developments Ltd. 36% (3) 55% (3) 6.50 4
gmp.un GMP Capital Trust 35% (3) 39% (3) 6.39 4
pki.un Parkland Income Fund 35% (3) 209% (3) 6.78 5
otc Open Text Corporation 33% (2) 232% (2) 31.07 31
wes Western Financial Group 33% (3) 21% (2) 2.90 13
cuq The Churchill Corporation 30% (3) 123% (2) 5.91 3
sz Sceptre Investment Counsel Limited 29% (2) 41% (2) 6.75 12
mlx Marsulex Inc. 28% (3) 302% (2) 8.00 11
sj Stella-Jones Inc. 28% (3) 44% (3) 23.00 10
wja WestJet Airlines Ltd. 26% (3) 215% (2) 10.87 6
sfi Saxon Financial Inc. 25% (3) 19% (3) 20.86 19
gna Gerdau Ameristeel Corporation 24% (3) 30% (2) 7.30 4
sif.un Energy Savings Income Fund 23% (3) 67% (3) 10.95 7
cmg Computer Modelling Group Ltd. 23% (3) 28% (3) 8.50 15
stn Stantec Inc. 23% (3) 24% (3) 18.64 11
pbi.un Premium Brands Income Fund 22% (3) 79% (2) 9.20 7
cca Cogeco Cable Inc. 22% (3) 72% (2) 35.30 12
inn.un InnVest Real Estate Investment Trust 22% (3) 45% (2) 5.66 7
gil Gildan Activewear Inc. 21% (3) 29% (3) 24.94 18
wfi WaterFurnace Renewable Energy, Inc. 20% (3) 27% (3) 24.35 25
x TMX Group, Inc. 20% (3) 30% (3) 30.02 13
gdi.un General Donlee Income Fund 20% (3) 78% (2) 5.75 5
fc.un Firm Capital Mortgage Investment Trust 20% (3) 2% (2) 9.26 8
rba lRitchie Bros. Auctioneers 20% (3) 29% (3) 23.31 26
lgi Logibec Groupe Informatique Ltd. 18% (3) 26% (3) 15.00 20
mda Macdonald Dettwiler & Associates Ltd 17% (3) 18% (3) 16.85 7
eh easyhome Ltd. 16% (3) 42% (2) 12.20 11
dsg Descartes Systems Group Inc. 13% (2) 203% (2) 2.82 6
gcg Guardian Capital Group Ltd. 13% (3) 38% (3) 7.50 12
thi Tim Hortons Inc. 13% (3) 9% (2) 28.55 19
cae CAE, Inc. 13% (3) 54% (2) 6.80 10
igm IGM Financial Inc. 10% (3) 13% (3) 35.52 10
ftt Finning International Inc. 10% (3) 29% (3) 15.20 9
rch Richelieu Hardware Ltd. 10% (3) 9% (3) 17.86 11
fgl The Forzani Group Ltd. 10% (3) 90% (2) 9.50 8
nwf.un North West Company Fund 10% (3) 19% (3) 14.65 10
tih Toromont Industries Ltd. 9% (3) 20% (3) 24.08 12
sc Shoppers Drug Mart Corporation 8% (3) 16% (3) 45.15 18
kos Cossette Communication Group Inc. 8% (3) 17% (2) 4.51 7
lnf Leon's Furniture Ltd. 8% (3) 10% (3) 9.70 11
lnr Linamar Corporation 8% (3) 6% (3) 8.84 5
acc Amica Mature Lifestyles Inc. 7% (2) 33% (3) 4.49 19
alc Algoma Central Corporation 7% (3) 32% (3) 88.00 6
clc.un CML Healthcare Income Fund 7% (2) 5% (3) 12.63 11
cp Canadian Pacific Railway Limited 6% (3) 33% (3) 47.71 9
t TELUS Corporation 6% (3) 35% (3) 39.62 9
idg Indigo Books & Music Inc. 5% (3) 67% (3) 12.50 5
hlf High Liner Foods Incorporated 4% (2) 41% (2) 7.90 13
I'm a BBA student at conestoga college, and came across your python script for stock picking, seemed pretty neat and was wondering if I would be able to get the code. I have a decent size portfolio myself but am trying to move more into quantitative finance. I'm learning python and want to create some financial scripts, and I think this would be a great start.
Regards,
How are you actually downloading the html files from google?
I did some google searches but apparently I am not searching for the right thing...
Thanks!
Erin