Showing posts from August, 2012

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…