Here you will find daily news and tutorials about R, contributed by over 573 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

(This article was first published on Quant-Day, and kindly contributed to R-bloggers)

Introduction to the project I am working on at the moment. It is more a playground for option strategies than “project” at this stage.

The idea is to develop accurate scenario analysis on portfolio, which is based on a single underlying. In the past I have written some code on simply plotting the payoffs at maturity, then followed a small piece of code, which was improved in a way that specific date could have been chosen for which the payoff is plotted.

For my current project I think the output will be self explanatory. The code is just the running bit to give a feeling of what it does and how it does what it does:

The range of the stock values are 2 standard deviations that were plugged into GBM, which was obviously adjusted for risk neutrality as we are in pricing framework. The red line indicates 1.5 standard deviation line. “step” is increment of possible stock prices via volatility. Furthermore, it returns a function which does an interpolation over the surface, so analysis at each time point can simply be done.

For now, the interest rates used are flat as well as implied volatility surface. However, the needed space was made so both can be easily implemented. Also, it is restructured in such way, that new pricing functions can be added effortlessly.

Implementing multiple assets can also be easily done, however I did not figure out, how to aggregate total pnl. One way to do it would be taking 1 stock as a reference, and using beta coefficients to sum the pnl. However, this would flaw the output via false assumption of constant beta with 0 variation.

Other derivatives in my mind are american options, powers, barriers or index linked notes that are possible to price via known pricing functions. In general, anything that could be priced without needing to calibrate model with more than one source of risk.

Comments and suggestions are more than welcome.

Related

To leave a comment for the author, please follow the link and comment on his blog: Quant-Day.