Python analysis of WIG
Two friends told me about their recent stock-trading experience. Having traded myself in high-school, I've had some sentiment and decided to see if I could make more rational decision that (the poor ones, admittedly) I've made then. (Technical diversion in gray) The first problem is that you don't "own" the financial statements data: by own I don't mean some intellectual property right – by own I mean having a file on my HDD with the data (be it a text file, db, hdf5, whatever) that one has the freedom to analyse. Scraping/HTML-parsing modules for Python came to help. Using mechanize, I was able to emulate a browser; BeautifulSoup was good for www.gpw.pl but failed for www.bankier.pl which then yielded to lxml. A simple question would be: is WIG under- or overvalued? To answer, take the P/E and P/BV values for all 400+ companies, bin them and draw a histogram. Fig 1. (A) Price-to-book value (per share) comparison, (B) Price-to-earnings (per s...