Skip to content

Added support for related companies endpoint#685

Merged
justinpolygon merged 3 commits into
masterfrom
jw-add-related-companies
Jun 21, 2024
Merged

Added support for related companies endpoint#685
justinpolygon merged 3 commits into
masterfrom
jw-add-related-companies

Conversation

@justinpolygon

@justinpolygon justinpolygon commented Jun 18, 2024

Copy link
Copy Markdown
Collaborator

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 https://github.com/polygon-io/client-python/issues/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
@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