Showing posts from 2012

Do the quarterly results add up to the yearly ones – sanity check for WIG20

Even when it comes to infographics, length can be an important consideration. So here it is: the comparison between reported, audited quarterly report and the yearly reports for the same period. Most of the times the agreement is good (median factor reported is 1.0); however, substantial under- and over-reporting does happen.

As to why, I have no clue. To my mind, it doesn't sit right but the again I know nothing about finances. A friend of mine who's better versed in the matter was a little bamboozled by that as well.

How close are the quaterly reported results to the yearly ones (for KGHM)

Companies publish their results every quarter. These results are often a good indication how a company will perform in the year (if Q'1 data for 2012 are better than the Q'1 from 2011, that's generally a good sign). The Q'4 report is also published much earlier that the yearly report for a company, at least in Poland the gap can be a few months. So the question is do the combined Q'1-Q'4 results represent in essence the same information, as results published in the yearly report for which one has to wait, could one use the information in the summed Q'1-Q'4 reports to derive at least a good estimate of the yearly results?

So here is a data for KGHM

Table 1. Income (after tax) for KGHM with quarterly report data summed up for each year (YR and QT are the consolidated yearly and quarterly results; both are given in thousands of PLN)

YearYR Q'1-Q'4 

Pushing with python analysis of WIG

There is a number of simple questions about the financial statements of the companies listed on the WIG that I'd like to understand. One of these questions is: do the quarterly results (for Q1-4 of a given year) add up to the yearly results (of that year)?

Getting the answer is difficult because 1. I don't own the data, 2. processing it is not super-straightforward. Today, I'm happy to report that hurdle 1. is down: scrapping Polish pages related to markets was made very simple by using a simple snippet
import re
from mechanize import Browser
br = Browser()
html_doc = br.response().read()
html_doc = re.sub('content="text/html; charset=iso-8859-2"', "", html_doc) 
soup = BeautifulSoup(html_doc) Doing the simple 'sed'-like replacement solved all the issues BeautifulSoup had parsing the response I was getting from

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 but failed for 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 share) comparis…

Electorostatics artifacs in water simulations

The major computational cost in MD simulation is the calculation of non-bonded interactions between particles, especially the electrostatic ("minus-plus") interactions.

There are several ways in which these interactions can be computed. The simplest one is a distance cut-off: only particles within x of each other will interact. More sophisticated methods, compute a grid onto which the particle charges are discretized for the whole system; the short-range interactions are computed within a cut-off, while the long-range interactions are computed to every grid point. 

The choice is important: simple models can give advantage in terms of computation speed, while more accurate models can save one from various artifacts.
A prominent example of which, is the artificial ordering of water molecules in a simulation, which occurs when using the simple cut-off scheme for electrostatics (not shown).

Figure 1, shows that if one inspects two properties of water in simulations generated u…