Skip to content

Commit

Permalink
Merge pull request #41 from ivelin/ivelin-feature-analyst-estimates
Browse files Browse the repository at this point in the history
Add function for the analyst_estimates API
  • Loading branch information
daxm authored Jan 16, 2024
2 parents 166439a + 34161c6 commit 8d15c26
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions fmpsdk/company_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,3 +931,25 @@ def stock_peers(apikey: str, symbol: str) -> typing.Optional[typing.List[typing.
path = f"stock_peers"
query_vars = {"apikey": apikey, "symbol": symbol}
return __return_json_v4(path=path, query_vars=query_vars)


def analyst_estimates(
apikey: str, symbol: str, period: str = "annual", limit: int = DEFAULT_LIMIT
) -> typing.Optional[typing.List[typing.Dict]]:
"""
Query FMP /analyst-estimates/ API.
:param apikey: Your API key.
:param symbol: Company ticker.
:param period: 'annual' or 'quarter'
:param limit: Number of rows to return.
:return: A list of dictionaries.
"""
path = f"/analyst-estimates/{symbol}"
query_vars = {
"apikey": apikey,
"symbol": symbol,
"period": __validate_period(value=period),
"limit": limit,
}
return __return_json_v3(path=path, query_vars=query_vars)

0 comments on commit 8d15c26

Please sign in to comment.