Scenario analysis for option strategies Pt. 2

June 10, 2013
By

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

No vivid improvements since the last post. However, I got it to the stage, when I can share the code and let you try it yourself:
https://github.com/afraid2trade/SCENARIO_ANALYSIS.git

Once you downloaded it, the only thing you need to open is "sa_work.R" and the only line to load the scripts is the first line - direct source to "0_sa_init.R" file, which is at the same folder. Make sure you have all the packages installed as "0_sa_init.R" calls "require" function only.



Looks like a straddle, doesn't it? Finally analyse it for each day. Interpolate it, uniroot it for break-even. find.extrema function finds minimum, 0 and maximum values of PnL on x-axis. Also note, that (at least on my mac, using interpreter from sublime text 2) simple graphics device freezes if you call it after 3d plots. To avoid this, enter rgl.close(), while your 3d chart is still open.



As I mentioned earlier, I would gladly hear your thoughts and opinions.

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

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.