khrapovs / vix Goto Github PK
View Code? Open in Web Editor NEWCompute VIX and related volatility indices
Compute VIX and related volatility indices
The error happened in this line:
options4['dK'] = options4.groupby(level = ['Date','Days'])['Strike'].apply(compute_adjoining_strikes_diff)
Exception has occurred: ValueError
cannot handle a non-unique multi-index!
options4 shape is (246,3)
options4.index is MultiIndex, like
MultiIndex([('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
('2009-01-01', 9),
...
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37),
('2009-01-01', 37)],
names=['Date', 'Days'], length=246)
So any idea on this issue? Thanks!
Hi
I am getting KeyError while running the replicate vix code. I have created both yield.csv and options.csv from the source file. But when I run the application, I get KeyError for 'P' ( I guess Puts).
Thanks
Mudit
Traceback (most recent call last):
File "../reproduce_vix.py", line 424, in
vixvalue = whitepaper()
File "../reproduce_vix.py", line 387, in whitepaper
options2 = put_call_parity(options2)
File "../reproduce_vix.py", line 175, in put_call_parity
options['CPdiff'] = (options['C'] - options['P']).abs()
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 1969, in getitem
return self._getitem_column(key)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 1976, in _getitem_column
return self._get_item_cache(key)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 1091, in _get_item_cache
values = self._data.get(item)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 3211, in get
loc = self.items.get_loc(item)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/index.py", line 1759, in get_loc
return self._engine.get_loc(key)
File "pandas/index.pyx", line 137, in pandas.index.IndexEngine.get_loc (pandas/index.c:3979)
File "pandas/index.pyx", line 157, in pandas.index.IndexEngine.get_loc (pandas/index.c:3843)
File "hashtable.pyx", line 668, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11463)
File "hashtable.pyx", line 676, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11416)
KeyError: 'P'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.