PolygonAPIWrapper#

class langchain_community.utilities.polygon.PolygonAPIWrapper[source]#

Bases: BaseModel

Wrapper for Polygon API.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param polygon_api_key: str | None = None#
get_aggregates(ticker: str, **kwargs: Any) dict | None[source]#

Get aggregate bars for a stock over a given date range in custom time window sizes.

/v2/aggs/ticker/{ticker}/range/{multiplier}/{timespan}/{from_date}/{to_date}

Parameters:
  • ticker (str) –

  • kwargs (Any) –

Return type:

dict | None

get_financials(ticker: str) dict | None[source]#

Get fundamental financial data, which is found in balance sheets, income statements, and cash flow statements for a given ticker.

/vX/reference/financials

Parameters:

ticker (str) –

Return type:

dict | None

get_last_quote(ticker: str) dict | None[source]#

Get the most recent National Best Bid and Offer (Quote) for a ticker.

/v2/last/nbbo/{ticker}

Parameters:

ticker (str) –

Return type:

dict | None

get_ticker_news(ticker: str) dict | None[source]#

Get the most recent news articles relating to a stock ticker symbol, including a summary of the article and a link to the original source.

/v2/reference/news

Parameters:

ticker (str) –

Return type:

dict | None

run(mode: str, ticker: str, **kwargs: Any) str[source]#
Parameters:
  • mode (str) –

  • ticker (str) –

  • kwargs (Any) –

Return type:

str

Examples using PolygonAPIWrapper