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

Feature: get_news() expose count #2173

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

dhruvan2006
Copy link
Contributor

Resolves #2075

Changes

  • Updated get_news() in Ticker to get up to 200 news articles (previously 8-10)
  • The method now fetches news directly from the ticker's news page (https://finance.yahoo.com/quote/MSFT/latest-news/) instead of using the previous search based approach which was limiting

Usage

import yfinance as yf
news = yf.Ticker("MSFT").news
print(len(news))

Warning

  • Breaking change: The returned data structure/schema has changed. Further feedback is required on how to proceed.

@dhruvan2006 dhruvan2006 force-pushed the feature/full-news branch 2 times, most recently from 88b2e25 to 3edd417 Compare December 9, 2024 08:36
@R5dan
Copy link
Contributor

R5dan commented Dec 9, 2024

Could there be an error if the count is greater than 200? Even if it isn't raised but simply logged?

@R5dan
Copy link
Contributor

R5dan commented Dec 10, 2024

Also the api returns a 404 response

@dhruvan2006
Copy link
Contributor Author

Can you please show me what you did so I can try reproducing?

@R5dan
Copy link
Contributor

R5dan commented Dec 11, 2024

Can you please show me what you did so I can try reproducing?

Yes, sorry. After some more testing (to get the exact response) I realized I was sending GET requests and you were sending POST. However I am now getting 200.

@dhruvan2006
Copy link
Contributor Author

@ValueRaider

@ValueRaider
Copy link
Collaborator

Can the default count be much lower e.g. 10 to reduce Yahoo server load? I know it's still one web request, but server-side probably different.

@dhruvan2006
Copy link
Contributor Author

Can the default count be much lower e.g. 10 to reduce Yahoo server load? I know it's still one web request, but server-side probably different.

Default for get_news() is now 10 articles.

@ValueRaider ValueRaider merged commit 59d0974 into ranaroussi:dev Dec 14, 2024
2 checks passed
@ValueRaider ValueRaider mentioned this pull request Dec 17, 2024
@ValueRaider ValueRaider changed the title Feature: Fetch upto 200 news articles Feature: get_news() expose count Dec 19, 2024
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.

3 participants