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 support for related companies endpoint #685

Merged
merged 3 commits into from
Jun 21, 2024

Conversation

justinpolygon
Copy link
Contributor

@justinpolygon justinpolygon commented Jun 18, 2024

Update client with related companies support. This PR updates the spec, adds a get_ticker_details function, a RelatedCompany model class, and a working example. This also fixes #682 for the spec changes.

from polygon import RESTClient

# docs
# https://polygon.io/docs/stocks/get_v1_related-companies__ticker

client = RESTClient()  # POLYGON_API_KEY environment variable is used

related_companies = client.get_related_companies("AAPL")
print(related_companies)
$ python examples/rest/stocks-related_companies.py
[
    RelatedCompany(ticker="MSFT"),
    RelatedCompany(ticker="GOOGL"),
    RelatedCompany(ticker="AMZN"),
    RelatedCompany(ticker="GOOG"),
    RelatedCompany(ticker="TSLA"),
    RelatedCompany(ticker="NVDA"),
    RelatedCompany(ticker="META"),
    RelatedCompany(ticker="NFLX"),
    RelatedCompany(ticker="DIS"),
    RelatedCompany(ticker="BRK.B"),
]

@justinpolygon justinpolygon merged commit b47b852 into master Jun 21, 2024
9 checks passed
@justinpolygon justinpolygon deleted the jw-add-related-companies branch June 21, 2024 14:21
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