Friday, September 28, 2007

Slackware 12.0



The newest Slackware version 12.0 could be downloaded from ftp://swtsrv.informatik.uni-mannheim.de/pub/linux/distributions/slackware/slackware-12.0-iso/
It comes with the latest kernel version 2.6.
http://www.slackware.com/announce/12.0.php for more information.
The 7 Most Influential GNU/Linux Distributions

Slackware has been my all time favorite distro. In my opinion, it's simple yet elegant. I can't say much about it though, as I have only tried a few of other distros (Fedora, SUSE, Gentoo).

Thursday, September 27, 2007

Options pricing based on Monte Carlo methods

Here is a python code to analyze options price based on Monte Carlo simulations.
From wikipedia: Monte Carlo methods are useful in many areas of computational mathematics, where a lucky choice can find the correct result. Interesting, huh !!
http://en.wikipedia.org/wiki/Monte_Carlo_methods_in_finance
All the formula in the code are taken from FE5102 notes, chapter 5 on Statistical Methods.

import random
import math

price = 33
exercise = 30
expiry = 6.0
vol = 9.0/100
rate = 5.0/100
simNum = 5000000

mean = math.log (price) + (rate - vol * vol / 2) * expiry / 12.0
stddev = math.sqrt(vol * vol * expiry / 12.0)

sum = 0
for i in range (simNum):
ft = math.exp(random.normalvariate(mean,stddev)) - exercise
if (ft <= 0): ft = 0 sum = sum + ft average = sum / simNum optionsPrice = average * math.exp(-rate*expiry/12.0) print "The options price based on " + str(simNum) + " observations is " + str(optionsPrice)