Code Monkey home page Code Monkey logo

dash-volatility-surface's Introduction

Dash Volatility Surface App

This is a demo of the Dash interactive Python framework developed by Plotly.

Dash abstracts away all of the technologies and protocols required to build an interactive web-based application and is a simple and effective way to bind a user interface around your Python code.

This demo fetches CBOE options chain data through Pandas Datareader/Yahoo, and calculates the implied volatility of each option using the py_vollib library that implements an extremely fast, 2-pass Black-Scholes-Merton algorithm for finding option IVs initially designed by Peter Jackel. All parameters of the IV calculation are adjustable, from whether or not options decay annually or based on the US trading calendar, to the dividend and risk free rates. The resulting volatility curve is rendered using a Mesh3D object and also plotted from the x-y axis as a heatmap, and the x-z axis as a scatter/box plot.

Note that initially fetching the options data and calculating the IV might take a few seconds due to the sheer number of calculations required to fetch.

To learn more check out our documentation.

The following are screenshots for the app in this repo:

Alt desc

dash-volatility-surface's People

Contributors

chriddyp avatar jackluo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dash-volatility-surface's Issues

plotly demonstration - not maintained??

Demonstration has no installation instructions. Creating and running this in Spyder throws all kinds of errors !!

I am running this demonstration in Spyder, in its own virtual environment using Python 3.8.5.
I see the requirements.txt file says to use Python 3.6.1 or higher.

The link for instructions jumps to a totally irrelevant Plotly marketing page, not installation instructions.

_ It is very frustrating for new Plotly developers trying to assess the business value of Plotly and Dash._ When demos are not maintained, it says a lot about the Plotly company. Do they actually care about people who are (not yet?) customers. Why can't Plotly maintain their finance demos?

Is there an updated version of this demonstration somewhere that works? Can someone please provide some pointers to get this working? I cannot spend a ton of time debugging these out of date Plotly core packages.

For purposes of this demonstration, it would be best to include some CSV data files that work, rather than trying to maintain it by chasing data providers' deprecated APIs. What other free option data sources are there besides the broken Yahoo API?

Thanks for an interesting example. I hope it gets updated soon.

Richard

File "C:\ProgramData\Anaconda3\envs\topss2\lib\site-packages\_plotly_future_\__init__.py", line 43, in _chart_studio_error
    raise ImportError(

ImportError: 
The plotly.plotly module is deprecated,
please install the chart-studio package and use the
chart_studio.plotly module instead. 


The data_fetcher module provided by Plotly is broken and throws an error saying a package is missing.  

from tickers import tickers
from data_fetcher import get_time_delta, get_raw_data, get_filtered_data
Traceback (most recent call last):

File "", line 2, in
from data_fetcher import get_time_delta, get_raw_data, get_filtered_data

File "C:\Users\richadmin\OneDrive!0-MyPyFi!0-Options-Pricing-Visualizers\Volatility_Surface_Plotly\data_fetcher.py", line 7, in
from py_vollib.black_scholes_merton.implied_volatility import *

ModuleNotFoundError: No module named 'py_vollib'


**After installing py_vollib, I get another error.**

The data_fetcher module is broken without a replacement being made available for the Yahoo data API.
Using the get_raw_data() function to test data function reveals the problem.

get_raw_data("AAPL")
Traceback (most recent call last):

  File "<ipython-input-21-b1c3c9faa76c>", line 1, in <module>
    get_raw_data("AAPL")

  File "<ipython-input-18-74c509ec8be0>", line 2, in get_raw_data
    tape = Options(ticker, 'yahoo')

  File "C:\ProgramData\Anaconda3\envs\topss2\lib\site-packages\pandas_datareader\data.py", line 692, in Options
    raise ImmediateDeprecationError(DEP_ERROR_MSG.format("Yahoo Options"))

ImmediateDeprecationError: 
Yahoo Options has been immediately deprecated due to large breaks in the API without the
introduction of a stable replacement. Pull Requests to re-enable these data
connectors are welcome.

########################################################

After figuring out that the demo needs the py_vollib package, and executing app.py, the following error is thrown .

Traceback (most recent call last):

  File "<ipython-input-15-c2cd5e9a5814>", line 161, in <module>
    dcc.Checklist(

  File "C:\ProgramData\Anaconda3\envs\topss2\lib\site-packages\dash\development\base_component.py", line 366, in wrapper
    return func(*args, **kwargs)

  File "C:\ProgramData\Anaconda3\envs\topss2\lib\site-packages\dash_core_components\Checklist.py", line 69, in __init__
    super(Checklist, self).__init__(**args)

  File "C:\ProgramData\Anaconda3\envs\topss2\lib\site-packages\dash\development\base_component.py", line 107, in __init__
    raise TypeError(

TypeError: The `dash_core_components.Checklist` component (version 1.3.1) with the ID "graph_toggles" received an unexpected keyword argument: `values`
Allowed arguments: className, id, inputClassName, inputStyle, labelClassName, labelStyle, loading_state, options, persisted_props, persistence, persistence_type, style, value


runfile('C:/ProgramData/Anaconda3/envs/topss2/lib/site-packages/dash/development/base_component.py', wdir='C:/ProgramData/Anaconda3/envs/topss2/lib/site-packages/dash/development')
Reloaded modules: tickers, trading_calendar, data_fetcher
Traceback (most recent call last):

  File "C:\ProgramData\Anaconda3\envs\topss2\lib\site-packages\dash\development\base_component.py", line 6, in <module>
    from .._utils import patch_collections_abc, _strings, stringify_id

ImportError: attempted relative import with no known parent package

Heatmap relayoutData "state data" lost after input toggle

Hi,

I seem to be experiencing issues with locking the camera / zoom settings into a certain area of the heatmap in your app. For instance, if I zoom into a certain sub-region of the heatmap you have in the lower left corner of the application and then I toggle the "Price threshold" slider, the zoom layout is reset. I also attempted to mimic your code for preserving layout in my own app and experience the same issue. Can you please check and confirm whether you are in fact observing this issue as well?

Thank you and look forward to hearing back!
-Rauf

Error

Hi, this demo doesn't work. Can you fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.