Unable to run example in Jupyter notebook
pchaganti opened this issue · 2 comments
pchaganti commented
Installed locally after cloning repo using python setup.py install. Trying to run the sample code in a notebook. Using python 3.8.
from volatility import volest
from volatility import data
# data
symbol = 'JPM'
bench = '^GSPC'
data_file_path = '../JPM.csv'
bench_file_path = '../BENCH.csv'
estimator = 'GarmanKlass'
# estimator windows
window = 30
windows = [30, 60, 90, 120]
quantiles = [0.25, 0.75]
bins = 100
normed = True
# use the yahoo helper to correctly format data from finance.yahoo.com
jpm_price_data = data.yahoo_helper(symbol, data_file_path)
spx_price_data = data.yahoo_helper(bench, bench_file_path)
# initialize class
vol = volest.VolatilityEstimator(
price_data=jpm_price_data,
estimator=estimator,
bench_data=spx_price_data
)
Error thrown
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-15-890e41b22558> in <module>
----> 1 from volatility import volest
2 from volatility import data
3
4 # data
5 symbol = 'JPM'
<frozen zipimport> in load_module(self, fullname)
~/Dev/hermes/lib/python3.8/site-packages/volatility_trading-0.0.1-py3.8.egg/volatility/volest.py in <module>
10 from matplotlib.backends.backend_pdf import PdfPages
11
---> 12 from volatility import models
13
14 ESTIMATORS = [
ImportError: cannot import name 'models' from 'volatility' (/Users/prabhakar/Dev/hermes/lib/python3.8/site-packages/volatility_trading-0.0.1-py3.8.egg/volatility/__init__.py)
pchaganti commented
Able to get it to run with a script for now. Closing this issue.
rpatel15-hue commented
How did you fix this? I am running into same issue with models