Skip to content

Conversation

@justinpolygon
Copy link
Collaborator

@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
@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

3 participants