Scenario analysis for option strategies Pt. 2

[This article was first published on Quant-Day, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 their blog: Quant-Day.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)