Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update broken yahoo query #925

Merged
merged 3 commits into from
Oct 8, 2024
Merged

Conversation

paullabonne
Copy link
Contributor

@paullabonne paullabonne commented Oct 2, 2024

Hello,

I wanted to replicate the GARCH and ARCH doc files but the yahoo query is broken. I have updated it.

It is my first time contributing so thanks a lot for your contributing instructions; very helpful :)

Beside the yahoo query there are other bugs preventing the notebooks from running (problems when merging dataset with the unique_id variable); but I thought it is best practice to keep the pull request very specific. I'm happy to help with the other bug if you want.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2024

CLA assistant check
All committers have signed the CLA.

@jmoralez
Copy link
Member

jmoralez commented Oct 2, 2024

Thank you for your contribution! Would the maintenance be easier if we used something like yfinance?

@paullabonne
Copy link
Contributor Author

Yes using yfinance would most probably prevent the query from failing next time yahoo change their API, at the cost of an extra dependency.

@jmoralez
Copy link
Member

jmoralez commented Oct 3, 2024

Are you interested in contributing that in this PR? It'd require adding that dependency here

dev_requirements = black datasetsforecast fire nbdev==2.3.25 nbformat nbdev_plotly pandas[plot] pmdarima polars[numpy] pre-commit prophet pyarrow pybind11 pytest scikit-learn setuptools<70 supersmoother
(please note that they're sorted alphabetically) and using it in those notebooks.

@paullabonne
Copy link
Contributor Author

paullabonne commented Oct 3, 2024

sure! I think plotly, seaborn and Jinja2 are also missing (I had to install those while running the garch notebook)

@paullabonne
Copy link
Contributor Author

paullabonne commented Oct 3, 2024

I wanted to raise an additional issue for discussion. The cross-validation exercise might not be the most adequate for these models. GARCH and ARCH models are generally used to predict volatility, not so much the raw returns. Since the conditional mean is typically constant, it seems odd to take a draw as the point prediction with fitted[k] = error*np.sqrt(sigma2[k]). Another issue with this approach is that simply changing the seed number would probably change the cross-validation result.

It seems more common in the literature to compare the conditional variance with a measure of volatility, like the squared return, see this paper and this one for instance.

Let me know if you think changing the evaluation strategy makes sense, or if I am misunderstanding something in the code. Happy to discuss further!

@jmoralez
Copy link
Member

jmoralez commented Oct 3, 2024

Hey. I agree on changing the evaluation strategy, please go ahead.

@paullabonne
Copy link
Contributor Author

ok cool I'll do that in a new PR because it is bit more work

Copy link
Member

@jmoralez jmoralez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jmoralez jmoralez merged commit 5ea9204 into Nixtla:main Oct 8, 2024
30 checks passed
@paullabonne paullabonne deleted the fix/yahoo-query branch November 8, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants