dougransom / vix_utils

vix_utils provides command line tools and a a Python API for preparing data for analysing the VIX Futures and Cash Term structures. Term Structure data can be exported to excel (.xslx), csv, and pickle formats.
MIT License
41 stars 9 forks source link

VX30 Weightings Are Significantly Off VXX Current Holdings #30

Closed UpsidePotential closed 1 month ago

UpsidePotential commented 3 months ago

Since VXX follows the VX30 index, I would expect he holdings to be close to the calculated VX30 weightings.
image

image

githubbla commented 2 months ago

did you able to download vix-utils features, it's looks like M2 broken for now.

gnzsnz commented 1 month ago

weights are definitively off

import vix_utils as vu

vix_dates = vu.vix_futures_dates.vix_futures_trade_dates_and_expiry_dates()
weights = vu.vix_futures_dates.vix_constant_maturity_weights(vix_dates)

image

dougransom commented 1 month ago

I am just starting to look at this now. Anyone already looking at it?

dougransom commented 1 month ago

Roll Period Calendar Days is Zero anywhere thse weights are off. I have some unit tests I am working on to identify these cases, trying to solve the problem now.

gnzsnz commented 1 month ago

there are many cases for 2024

image

the issue should be around this line of code (before it actually)

https://github.com/dougransom/vix_utils/blob/1b231b2c7fc44ae84584496940ac068139a2e55b/src/vix_utils/vix_futures_dates.py#L184

but i have not been able to pin point it

I don't think that roll period calendar days is the main issue. There are plenty of good weights with it being zero

image

dougransom commented 1 month ago

Working on this in branch https://github.com/dougransom/vix_utils/tree/weights.

So far some refactorings, so we can debug the logic that generates the weights on a small subset of dates.

dougransom commented 1 month ago

The orginal code was far off the documentation. I think I am close to resolving …

dougransom commented 1 month ago

Closer still, it might a week or two though before I complete it. There is an edge case on Wednesday of Vix Future Expiration. That is the front month (at least I think it is), but on those days, for the purpose of S&P 500 VIX Short-Term Futures Index, the front month is the following expiration.

dougransom commented 1 month ago

I think it is working now, try vixutil -w w.xlsx.

Note the weights are for three expirations, since there are a couple days where the front month may not be included in VXX etc. (instead it is the following two months). It happens the day before and day of expiration.

dougransom commented 1 month ago

The latest on PyPi has this fix now 0.1.7.

gnzsnz commented 1 month ago

thanks a lot!

so now front month goes to zero the friday before expiration. it makes sense to me.