Index of /pystockmood

This is pystockmood — a somewhat-experimental and not-at-all-serious program that tries to guess the mood of the stock market from day to day by looking for a set of patterns in the text scraped from prominent financial news reporting websites. It demos and combines Python's re and urllib libraries, as well as some fairly nasty comprehensions.

To use, run the main script,, whose code and comments are the full documentation for the program. Just for fun, it plays a song at the end; pystockmood.png captures the action. You'll need to place 3 audio files (e.g., MP3s) of your choosing in the audiofiles directory (stripped of its content here) and code their names in the script.

The testfiles folder has example input pages, and file examplerun.txt is a, well, example run (most of it is pattern-match traces). Get for all of this system's parts in a single zipfile.

[Home page] Books Code Blog Python Author Training Search ©M.Lutz