options-strategy-visualizer
- Small tool that plots the total payoff of a strategy combining financial call/put options and/or the underlying
Motivation
The reason I wrote this tool is that after some research for an online tool that visualizes option strategies, I didn't find anything useful.
Its calculations are based on CBOE's rulebook (p 18)
Here is a list of pages that I checked out before I decided to do this myself
- https://discoveroptions.com/mixed/content/education/articles/riskgraphs.html
- http://www.intrepid.com/robertl/strategies1.html
- http://www.mathworks.com/matlabcentral/fileexchange/17411-visualize-payoffs-of-an-option-strategy/content/butterfly.m
- http://www.optiontradingtips.com/options101/payoff-diagrams.html
Usage
- Browse at http://shadiakiki1986.github.io/options-strategy-visualizer/
- It used to be hosted at http://genesis.akikieng.com/options-strategy-visualizer
Logo
I chose the letter '''V''' to be the logo for this tool.
It represents
- the first letter of the word '''visualizer'''
- the payoff of a long straddle position
- one of my favorite movies
License
Licensed under WTFPL
Developer notes
Where are the files?
There are 2 branches in this repository. master
contains the javascript responsible for all the core calculations. gh-pages
is the html and javascript of the SPA interface. The index.html
in gh-pages
references the main javscript file in master
. If any of the core calculations are updated in the master
branch, following the updating common js code...
section below to update the published app at http://shadiakiki1986.github.io/options-strategy-visualizer/
. If any of the files in the gh-pages
branch are updated, no special steps are required to update the published app.
Testing
- Testing of php API: phpunit tests
- Testing of nodejs API: npm install --dev && npm test
gh-pages
Created github pages branch
git checkout --orphan gh-pages
git rm * -rf
echo "whatever" > index.html && git add index.html
git commit -a -m "first gh-pages commit"
git push
git branch # will now show the gh-pages branch and the master branch
git checkout master # to switch
git checkout gh-pages # to switch
initial php API
- The initial php API was discontinued in favor of nodejs api that I can use with AWS lambda (versus the need to have an EC2 instance running for the php api)
- check discontinued-php branch for files
updating common js code between nodejs and gh-pages browser client
The gh-pages javascript files use common code with the nodejs files
- for this I use browserify
- in branch master: npm run build (source)
- switch to gh-pages: git checkout gh-pages
- git status will show that the js/OptStratVis.js has been modified
- git commit -a -m "updating optstratvis.js library file"
- git push
- more notes here later
first checkout of remote branch locally
git checkout -b gh-pages origin/gh-pages
Google analytics
I just added my personal email's google analytics tracking ID of my github pages to this SPA