## Software should not be patentable

Software patents never seemed to be a good idea. At last there is something to substantiate the claim that software should not be patentable. Here is a mathematical proof how US Patent 5,893,120 can be reduced to mathematical formulae, thus making it unpatentable under the US law.

In his other blog entry the author argues that, in fact, any software algorithm can be reduced to mathematical formulae, which are not patentable.

## Diagonalising an intensity matrix of a reversible Markov chain

Recently I needed to build a Monte Carlo simulator of a continuous-time Markov chain. This is a pretty straightforward exercise; the only catch was that I wanted it to perform well, so I had to use a fast algorithm for matrix exponentiation.

## CVA calculation example

Let’s calculate CVA (credit value adjustment) analytically. We will see that analytical CVA calculation is quite complex even for a fairly simple transaction (a vanilla swap). A few shortcuts will help us simplify the calculation. Continue reading

When we have to calculate exposure at default (EAD) on a particular trade, we seldom have to compute it analytically (e.g. as shown here). More often we just take the current MtM of the trade and add the so-called add-on. The add-on is the notional amount of the trade multiplied by the coefficient specific to the trade type, underlying and remaining maturity: where is the current MtM, is the add-on, is the notional amount and is the trade-specific coefficient.

This method works reasonably well for a single trade.

If we have several trades covered by a netting agreement, we have a problem. We cannot just calculate the exposure on a netted portfolio as a sum of exposures per trade: exposures are not additive. One way to tackle this problem is to use the 40-60 rule. This rule, however, is so seriously wrong that it becomes alarming how many people use it without thinking of its shortcomings. Continue reading

Posted in Finance | Tagged , , , | 1 Comment

## Historical or implied?

To calculate counterparty exposure, we need to know the volatility of our risk factors (interest rates, stock prices, etc.) in the future. Continue reading

## Don't trust a model

Recently I was asked: “Are you not afraid of over-reliance on numerical methods in finance?”

Indeed, if I had to rely on numerical results in finance, I would be afraid. Continue reading

## Exposures are not additive: case in point

If we have a portfolio of vanilla trades (say, swaps), we can calculate EAD on each trade individually (an example is discussed here). Naturally, it is tempting to say that the exposure on the portfolio is the sum of the exposures on individual trades. That’s very wrong because exposures are not additive. Continue reading

Posted in Finance | | 5 Comments

## Counterparty risk calculation guide

This paper by S.  Zhu and M. Pykhtin provides a blueprint for counterparty risk modelling framework.

## Exposure at default calculation

Many believe that the calculation of exposure at default (EAD) on derivative contracts is fairly straightforward, so it can easily be done analytically. In many cases it is true, but not always.

Let us consider an easy case when EAD can be calculated analytically. By looking at how we do that, we will discover under which circumstances the method would not work.