6.2.09

Modelling the growth of asset prices in a binomial lattice

Why would we want to do this? Well one of the key decisions when pricing call options using a binomial lattice is whether it is optimal to exercise the option or let the option lapse. We need to know whether we are in the money or not. The value of the asset price in relation to the strike price is a good indicator. If the asset is cheaper in the spot market we let the option lapse, otherwise we exercise the option, buy the asset at the strike price and sell it on the spot market making ourselves a tidy little profit :).

image

Starting at time t=0 and given that the volatility of the asset is d and u, the asset prices for a given time-step follow the distribution:

asset.prices.latex

We then proceed to test the assertion above using NUnit 
(note the syntactic sugar which makes the testing of collections much more direct)


[Test]
public void StockPriceGrowth()
{
var t = 2;
var u = 1.1;
var d = 0.9;
var initialAssetPrice = 20;
var stockPrices = new ArrayList();
var expectedAssetPrices= new[] {24.2,19.8,16.2};

for (var i = 0; i <= t; i++)
{
var stockPrice = Math.Round(initialAssetPrice * (Math.Pow(u, t - i) * Math.Pow(d, i)), 2);
stockPrices.Add(stockPrice);
}
Assert.That(stockPrices,Is.EquivalentTo(expectedAssetPrices));
}
And hooray we get the greenbar!


image 
The stock price generation behaviour belongs to a utility class responsible for generating the asset prices
at given time-step, so we refactor the test to the following:
[Test]
public void StockPriceGrowth()
{
var t = 2;
var u = 1.1;
var d = 0.9;
var initialAssetPrice = 20;
var expectedAssetPrices= new[] {24.2,19.8,16.2};
var stockPrices = BinomialCalculator.StockPricesForTimeStep(t,u,d,initialAssetPrice);
Assert.That(stockPrices,Is.EquivalentTo(expectedAssetPrices));
}

No comments: