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

P2: Can't call vix_utils from Jupyter notebook due to asyncio #19

Closed AQuant206 closed 1 year ago

AQuant206 commented 1 year ago

I tried using a Jupyter notebook import values from vix_utils to print a term structure though it won't work due to asyncio. Even adding %autowait asyncio did not help.

This is a nice to have IMO. I was able to work around it by running python from command line, exporting values to a .CSV, then importing those into the Jupyter notebook afterwards.

dougransom commented 1 year ago

Grr. I thought that should work.

dougransom commented 1 year ago

I think with the %autowait aysncio% option AND using the asynchronous interfaces to get the data might work because we create a new event loop in the synchronous interfaces and it might blow up jupyter.

If you have time please try the asynchronous interfaces. The function names start with async and have the same function signatures as the synchronous ones.

dir(vix_utils) ['builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', 'append_continuous_maturity_30day', 'async_get_vix_index_histories', 'async_load_vix_term_structure', 'continuous_maturity', 'continuous_maturity_30day', 'download_vix_futures', 'futures_utils', 'get_vix_index_histories', 'load_vix_term_structure', 'location', 'pivot_cash_term_structure_on_symbol', 'pivot_futures_on_monthly_tenor', 'select_monthly_futures', 'vix_cash_term_structure', 'vix_constant_maturity_weights', 'vix_futures_dates', 'vix_futures_expiry_date_from_trade_date', 'vix_futures_expiry_date_monthly', 'vix_futures_trade_dates_and_expiry_dates']

if that works it is probably a matter of documentation and better runtime error reporting to guide the developer .

AQuant206 commented 1 year ago

I will try that out ~early next week. Thanks!

dougransom commented 1 year ago

Hi any success with this?

dougransom commented 1 year ago

Example added in this commit https://github.com/dougransom/vix_utils/commit/7983a57fc1e02ea0fa1ca1af3908e57f1da68195.

dougransom commented 1 year ago

new release in pypi today too.

AQuant206 commented 1 year ago

Awesome, Thank-you!

On Mon, Jul 3, 2023 at 7:11 PM Doug Ransom @.***> wrote:

Closed #19 https://github.com/dougransom/vix_utils/issues/19 as completed.

— Reply to this email directly, view it on GitHub https://github.com/dougransom/vix_utils/issues/19#event-9711148304, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3454GUHUG7XZKMCLMLOERDXOLVKPANCNFSM6AAAAAAWJZ3CJA . You are receiving this because you authored the thread.Message ID: @.***>