**Client A**, a physical oil trading shop, had just paid top dollar for an integrated ETRM platform. Daily MTM and PnL were fine. Delta positions were fine. Market and trade data were going in and $$$ were coming out.

However, when they pressed the VaR button, nothing happened. Arguments with the system vendor ensued and eventually the vendor left the building “under a cloud”. I was brought in to investigate what was going wrong and to implement a solution.

They were a basic crude oil trading shop, marking around 25 curves, each going out about 2 years. Oil uses monthly gridpoints, so that’s 600 data points on a daily basis. I saw the problem immediately: the historical data was patchy at best. Certain curves were only marked when there was exposure to them, so a few gridpoints marked over a couple of weeks around the delivery of a specific cargo. In fact the only complete curve in the whole set was WTI because that was a futures strip automatically brought in from the exchange.

I explained all this to the client but they were incredulous, “We don’t need historical data. We are only interested in parametric VaR, not Historical or Monte Carlo.”

I explained to them that although Parametric VaR was a relatively simple mathematical formula compared to Monte Carlo, the calculation still needed correlations. Their system was configured to use historical data from the last two years to calculate the correlation matrix used in the parametric VaR. The correlation matrix failed from lack of data and therefore the VaR calculation failed.

As no historical data was available, the solution was to reconstruct the missing data using diffs and spreads, best guesses, and a small amount of flimflam. The traders were told that every curve had to be marked properly going forward, which would over time improve the accuracy of the correlations. Also, when the real data finally replaced the fictional, they could then think about Monte Carlo and Historical VaR with a bit more confidence.

**Client B**, an energy trading firm, were very meticulous about, and very proud of, their historical data. However, they also had trouble with their VaR. They traded the full barrel globally, which meant about 150 curves. Most went out for two years forward, but some were only 1 year, some were 5 years. On average, around 4,000-5,000 data points every day. They had also spent top dollar on a complete front to back ETRM solution, had consultants in to implement it and had been up and running for around six months. Unfortunately, because the daily books and records of PnL and position reporting was the priority, no one had spent much time investigating the reason why VaR was not working. This one took me a while to figure out because there were two things going wrong.

- The first was that the correlation matrix was failing. I won’t go into mathematical detail here, but there is something called Cholesky Decomposition, which makes the VaR calculations faster. Unfortunately, it can be quite sensitive when applied to large matrices of very highly correlated markets. All the gridpoints of the 150 oil curves are all highly correlated to each other; above 95% with a large proportion above 98%. Mathematically, this makes the matrix very unstable and liable to collapse. Believe it or not, in order to get the Cholesky Decomposition to work and therefore the VaR calculation to produce a number, we needed to insert a “random flutter” into the data. This was not intuitive and goes against the whole point of using historical data, but it just had to be done. The random flutter, very small though it was, was enough to stabilise the matrix and a VaR number was produced!
- The second problem was much larger. The VaR number was wrong! The difference was small, but Parametric VaR is an exact formula, so it should be correct to the cent, every time. Any difference undermines trust in the ETRM platform, so I needed to get it right. Unfortunately, the vendor were very unhelpful – I was to find out why later – and refused to give me access to their calculations. So, I was dealing with a black box on one side, and a spreadsheet on the other. After many weeks of solid sleuthing, I had back solved the black box calculation and proved that the vendor had incorrectly hard coded the Parametric VaR formula. They had placed a log normal calculation outside of a bracket instead of inside! I wrote up a paper, included my proof and sent it off to the vendor. They implemented an emergency patch and all ended well. In a private conversation later, I found out why the vendor could not help me. Their risk developer had made a simple typing error in the code, compiled it and then left the company. No one at the vendor had the source code, so no one noticed the typo. It was a black box to the vendor as well as all their clients.

Both these examples were using the simple parametric VaR calculation. There is enough to go wrong with the basics before you even think about the 10,000 trials of a Monte Carlo simulation, and the impact of that on your grid. Every day is a new adventure in Commodity Risk!