Skip to content

Fix cache to respect end_date in get_financial_metrics (#254) #271

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

Conversation

LohitakshaRohila
Copy link

(My first contribution)
What's new?
This PR corrects a bug in the get_financial_metrics function where cached financial metrics were being returned irrespective of whether they spanned the requested end_date. The cache is now only returned if the recently cached data spans the end_date. Otherwise, new data are retrieved from the API and cache is updated.

Why does this matter?
Earlier, users would receive old financial information when using the cache, resulting in incomplete or inaccurate sets of metrics. This patch guarantees the data returned is always as required by the query's date, enhancing accuracy and dependability.

How was it tested?
Verified cached data is skipped if end_date is more recent than the most recent cached report.

Confirmed new data is retrieved and cached appropriately.

Manual testing against multiple tickers with different end_date values.

Related issue
Fixes #254

@virattt virattt closed this May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache design flaw in get_financial_metrics prevents fetching newer data
2 participants