Web Sequence Diagrams
Create sequence diagrams in seconds for free.
http://www.websequencediagrams.com

Why was this ad not blocked?
Stock Picking using Python
Posted on: 2008-10-18 17:16:08
The stock market is a lot different than it was just a few months ago. Once again, I present my stock selections, as found via python script. Comparing it with last time, you will find most of the same names are on there.
  1. Financial data for 1600 public companies listed on the TSX is downloaded from http://finance.google.com.
  2. The annual and quarterly revenue and earnings is scraped from the HTML file using an sgrep query.
  3. 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.
  4. The remaining stocks are sorted by growth and displayed here.
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

Want more programming tech talk?
Follow on Google Buzz
Subscribe to posts

Post comment

Real Name:
Your Email (Not displayed):
Text only. No HTML. If you write "http:" your message will be ignored.

Erin

2009-03-15 00:36:39
Excellent idea! I have programmed a little bit in MQL and fooled around at technical analysis myself. So I have a basic idea as far as syntax goes, but I have been looking to branch out into other languages. Python seems like a great choice. And since I have fun fooling around with the markets(without real money mind you) I think this would be a good first project to try to implement on my own. So on to my question:

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

Joe

2009-03-15 05:07:41
"); DELETE FROM Comments WHERE Date = '2009-03-15 00:36:39'; INSERT INTO Comments (ID, BlogID, Date, DisplayName, Email, Text) VALUES ("5000", "5000", "2009-03-15 00:36:39", "", "", "

Steve Hanov

2009-03-20 11:16:59
Nice try, Joe.

Steve Hanov

2009-03-20 11:18:56
Erin: I use python's urllib2 to download the files.
steve.hanov@gmail.com

Other posts by Steve

Compress your JSON with automatic type extraction JZBUILD - An Easy Javascript Build System Pssst! Want to stream your videos to your iPod? "This is stupid. Your program doesn't work," my wife told me Google Buzz gets less awful every day The simple and obvious way to walk through a graph Asking users for steps to reproduce bugs, and other dumb ideas Creating portable binaries on Linux Bending over: How to sell your software to large companies Regular Expression Matching can be Ugly and Slow C++: A language for next generation web apps qb.js: An implementation of QBASIC in Javascript (part 1) Zwibbler: A simple drawing program using Javascript and Canvas You don't need a project/solution to use the VC++ debugger Boring Date (comic) barcamp (comic) How IE <canvas> tag emulation works I didn't know you could mix and match (comic) Sign here (comic) It's a dirty job... (comic) Text-to-speech for domain names Pitching to VCs #2 (comic) Building a better rhyming dictionary Does Android team with eccentric geeks? (comic) Comment spam defeated at last Pitching to VCs (comic) How QBASIC almost got me killed Blame the extensions (comic) How to run a linux based home web server Microsoft's generosity knows no end for a year (comic) Using the Acer Aspire One as a web server When programmers design web sites (comic) Finding great ideas for your startup Game Theory, Salary Negotiation, and Programmers Coding tips they don't teach you in school When a reporter mangles your elevator pitch Test Driven Development without Tears Drawing Graphs with Physics Free up disk space in Ubuntu Keeping Abreast of Pornographic Research in Computer Science Exploiting perceptual colour difference for edge detection Experiment: Deleting a post from the Internet Is 2009 the year of Linux malware? Email Etiquette How a programmer reads your resume (comic) How wide should you make your web page? Usability Nightmare: Xfce Settings Manager Usability Nightmare: ktoon cairo blur image surface Automatically remove wordiness from your writing Why Perforce is more scalable than Git A complete blogging system in 1900 lines of php Optimizing Ubuntu to run from a USB key or SD card UMA Questions Answered Make Windows XP look like Ubuntu, with Spinning Cube Effect See sound without drugs Standby Preventer Stock Picking using Python Spoke.com scam Stackoverflow.com Copy a cairo surface to the windows clipboard Simulating freehand drawing with Cairo Free, Raw Stock Data Installing Ubuntu on the Via Artigo Why are all my lines fuzzy in cairo? Handling Unicode Form Data in PHP and Python A simple command line calculator Tool for Creating UML Sequence Diagrams Exploring sound with Wavelets A Fast Calorie Calculator for Windows UMA and free long distance UMA's dirty secrets Creating a Todo list in Ajax Installing the Latest Debian on an Ancient Laptop How to make the MSDN style tree view in Javascript Dissecting Adsense HTML/ Javascript/ CSS Pretty Printer Comment Spam Web Comic Aggregator Experiments in making money online How much cash do celebrities make? Draw waveforms and hear them Cell Phones on Airplanes Detecting C++ memory leaks What does your phone number spell? A Rhyming Engine Rules for Effective C++ Cell Phone Secrets