Saturday, February 15, 2014

Visualizing option strategies with R

It has been a while since I wrote something about options.

Recently I found myself in a need for simple tool for visualizing option strategies.

Option strategy is a combination of a number of option positions - both long and short - and sometimes underlying assets (such as equities) - i.e. it has multiple "legs".

To calculate the payoff (*) of the option strategy one needs to know:

  • types of assets used to construct a particular strategy - possibilities include CALL and PUT options, as well as underlying assets
  • type of positions opened - options can be bought or sold (written); underlying assets can be bought or sold short
  • option strike prices - any option has a price at which it "activates"; for example CALL option with a strike price of 100, generates profit only when the price of underlying asset is above 100
  • option premiums - buying an option has a price, writing it generates some income
  • amount of assets utilized - for example you can buy more than 1 option
Transaction costs are not cover by my simplistic model.

(*) payoff is the value of the strategy at expiration; it should not be confused with the theoretical value derived from option pricing models such as Black-Scholes

Probably the simplest options-related investment strategy is a purchase of some stock and hedging it with PUT option - as a result, while one have unlimited profit potential, his loss is limited with the help of PUT option:

> assets.mat
     trans type   strike price amount
[1,] "buy" "base" "40"   "0"   "1"   
[2,] "buy" "put"  "35"   "2"   "1" 

A pure option strategy is Bull Call Spread, when one simultaneously buys and sells CALL options with different strike prices:

> assets.mat
     trans  type   strike price amount
[1,] "buy"  "call" "40"   "3"   "1"   
[2,] "sell" "call" "45"   "1"   "1" 

Option strategy can consist both long and short positions, and different amounts of options at opposing sides - like in the Call Backspread:

> assets.mat
     trans  type   strike price amount
[1,] "sell" "call" "40"   "4"   "1"   
[2,] "buy"  "call" "45"   "2"   "2" 

Option strategy can be composed with more than two legs - like in the Condor:

> assets.mat
     trans  type   strike price amount
[1,] "buy"  "call" "35"   "11"  "1"   
[2,] "buy"  "call" "55"   "1"   "1"   
[3,] "sell" "call" "40"   "7"   "1"   
[4,] "sell" "call" "50"   "2"   "1"  

Obviously there are many more different option strategies. You can learn about them at the following places:

And you can experiment with them and any other ideas connected with option strategies with the R code I have prepared. Enjoy!

[ R Source ]

No comments: