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

Added ticker news insights support #710

Merged
merged 1 commit into from
Jul 18, 2024
Merged

Conversation

justinpolygon
Copy link
Contributor

Fixes #708.

This PR adds support for Ticker News Insights where it ranks mentioned tickers by sentiment (negative, neutral, or positive) and then provides the reasoning why.

Here's an example script:

from polygon import RESTClient
from polygon.rest.models import (
    TickerNews,
)

client = RESTClient()  # POLYGON_API_KEY environment variable is used

news = []
for n in client.list_ticker_news("MSFT", order="desc", limit=1000):
    news.append(n)

# print date + title
for index, item in enumerate(news):
    if isinstance(item, TickerNews):
        print(item)

        if index == 10:
            break

You'll get a response object that now lists insights like the following:

TickerNews(
    amp_url=None,
    article_url="https://www.benzinga.com/news/24/07/39795029/googles-potential-23b-wiz-acquisition-set-to-enhance-cloud-security",
    author="Shivani Kumaresan, Benzinga Staff Writer",
    description="Google is in advanced talks to acquire cloud security firm Wiz for up to $23 billion, which would significantly enhance Google's cloud security capabilities and help it compete with major rivals like Amazon and Microsoft.",
    id="47cad2ae843c02ec8a24171476531bd58b7e8831ede6503f8e2d16b0f5fda341",
    image_url="https://cdn.benzinga.com/files/images/story/2024/07/16/Google-Shutterstock.jpeg?width=1200&height=800&fit=crop",
    insights=[
        Insight(
            sentiment="positive",
            sentiment_reasoning="The article suggests that the potential acquisition of Wiz would enhance Google's cloud security offerings and help it better compete in the cloud security market.",
            ticker="GOOG",
        ),
        Insight(
            sentiment="positive",
            sentiment_reasoning="The article suggests that the potential acquisition of Wiz would enhance Google's cloud security offerings and help it better compete in the cloud security market.",
            ticker="GOOGL",
        ),
        Insight(
            sentiment="neutral",
            sentiment_reasoning="The article mentions Amazon Web Services as a major competitor in the cloud security market, but does not provide any specific information about Amazon's sentiment.",
            ticker="AMZN",
        ),
        Insight(
            sentiment="neutral",
            sentiment_reasoning="The article mentions Microsoft as a major competitor in the cloud security market, but does not provide any specific information about Microsoft's sentiment.",
            ticker="MSFT",
        ),
    ],
    keywords=["Google", "Wiz", "cloud security", "acquisition"],
    published_utc="2024-07-16T13:39:15Z",
    publisher=Publisher(
        favicon_url="https://s3.polygon.io/public/assets/news/favicons/benzinga.ico",
        homepage_url="https://www.benzinga.com/",
        logo_url="https://s3.polygon.io/public/assets/news/logos/benzinga.svg",
        name="Benzinga",
    ),
    tickers=["GOOG", "GOOGL", "AMZN", "MSFT"],
    title="Google's Potential $23B Wiz Acquisition Set To Enhance Cloud Security - Benzinga",
)

@justinpolygon justinpolygon merged commit 3aa9d82 into master Jul 18, 2024
9 checks passed
@justinpolygon justinpolygon deleted the jw-add-tickernews-insights branch July 18, 2024 13:41
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.

Client update needed to match REST spec changes
2 participants