Value at Risk for Commodity Trading using Tableau and R

Posted by Bart Dix

In this article, we take a look into Value at Risk for Commodity Trading using Tableau and R.

Value at Risk for Commodity Trading using Tableau and R Image

Redfaire International partner Cadran Consultancy collaborated with Cadran Analytics to create value for commodity trading companies. Pairing Tableau's extensive capabilities with R (a programming language), the software can now run extensive complex algorithms and is now capable of Value at Risk (VaR) models. By integrating this with CTRM4JDE companies can also use a transactional system while applying complex analytical models to assess their exposure. VaR for Tableau can now be implemented alongside CTRM4JDE.

 

What is VaR?

Var is, simply put, an effective method for measuring the downside risk of portfolios of certain assets that a company holds. Throughout this blog post, we will explain the process and how VaR works, along with an example of what it looks like in Tableau. If you are already experienced with Var, you can skip below to the dashboard image. 

 

The Concept of VaR

The basic concept of VaR is based around defining the likelihood of a loss and how big it could be. For example, if you were to enter a contract to purchase soybeans that must be sold within a month and the market price decreases within that 30 days, you would make a loss. At any moment during those 30 days, you would be interested in the likelihood of this loss and how big it could end up being. If a big loss is likely, you could hedge against it. An example of hedging against it would be to purchase an asset where the price moves in the opposite direction of the soybeans you're potentially making a loss on. You can also try to lower your position (ex: selling your contract). The VaR is a method used to define this likelihood.

For example; a 99% 1-month VaR of $50.000 would mean that we can say with 99% confidence that you will lose no more than $50.000 in the coming month. In other words, only 1 in 100 months you will make a loss of $50.000 or more. In order to obtain this figure of 50.000, the VaR uses the historical return (meaning soybean price fluctuations) to define the volatility of soybeans. If large price drops (historically) occur often for soybeans, this will result in a higher VaR.

 

VaR for a portfolio of assets

The example above showed just one contract for just one asset, but in reality, trading companies hold multiple contracts for different assets at any one time. If we were to increase our portfolio to add a contract of coffee beans, we would now have two assets: soybeans and coffee bens. If we were to measure the VaR of this portfolio, we would need to consider how both of these prices are correlated. What is the likelihood that both prices drop together? For this, the VaR uses the covariance matrix. This matrix defines the relation between the different assets in the portfolio based on their historical movements.

 

Tableau Dashboard

With the basics of the VaR covered, consider the Tableau dashboard below. Created by combining Tableau with R, this dashboard shows a VaR analysis for a portfolio with three assets.

After having chosen a confidence level and a method (we will save the specifics of these methods for another blog), the dashboard shows the VaR of the portfolio. In addition, several figures are included for the individual assets:

  • Current exposure: the $ amount of the position
  • Component VaR %: the % of the portfolio VaR this asset is responsible for.
  • Individual VaR: the VaR of the individual asset, not considering the rest of the portfolio.

Value at Risk for Commodity Trading using Tableau and R image 1

 

Several interesting observations can be made:

  • The sum of the individual VaR’s is higher than the portfolio VaR.
    The reason is that by combining assets in a portfolio, this becomes diversified. Meaning that it is not likely for all three assets to significantly decrease at the same time.
  • The option contracts have a relatively high component VaR.
    For example, with a 99% confidence level, it exceeds 60% (regardless of the method chosen). So even though the exposure of the future contracts is higher, the option contracts contribute a lot more to the VaR. This is explained by theasset returns dashboard, which shows that the option contract returns are more volatile than the future contracts.
  • With a confidence level of 95%, the results vary greatly between the two methods.
    Therefore, it is important to carefully choose a method. In case the asset returns show a non-normal distribution, the Modified method would be more appropriate than the Parametric mean-Var.

Value at Risk for Commodity Trading using Tableau and R image 2

Var with CTRM4JDE

The VaR model makes use of either historical data or market data available. Any of these models can make use of data already available in CTRM4JDE. The pre-existing data model that has been made allows Cadran Analytics to quickly unlock the potential in Tableau. Applying a more complex analytical model like VaR can be implemented at scale and with limited effort. This capability makes Tableau a scalable and future proof solution: applying new and custom models becomes easy and analyses can be made more advanced without having to deal with implementing a complex transactional layer. As also described in the blog What-If-Analytics on Trade in Tableau, and as shown in this model as well, the model can be made variable as well allowing for easy analysis by your end-users.

Contact us

Please complete the form and our Global Enquiries team will be in touch to help you.

EMEA: +31 33 247 1598
US: +1 (513) 842-8506
info@redfaireinternational.com