Analyst Consensus

Get how many analysts recommend each company as a strong buy, buy, hold, sell or strong sell today, and the consensus of those recommendations.

Next to the counts come the number of analysts, the share of them recommending a (strong) buy, the mean recommendation on the conventional scale from 1 (strong buy) to 5 (strong sell), as used by I/B/E/S and Zacks, and the consensus Financial Modeling Prep draws from the counts (such as “Buy”). Analysts’ recommendations, and the changes in them, predict returns (Womack, 1996; Barber, Lehavy, McNichols and Trueman, 2001).

The consensus is today’s, whatever this Toolkit instance’s dates; get_analyst_recommendations gives the counts per month.

The formula is as follows:

\[\text{Analysts} = \text{Strong Buy} + \text{Buy} + \text{Hold} + \text{Sell} + \text{Strong Sell}\] \[\text{Buy Share} = \frac{\text{Strong Buy} + \text{Buy}}{\text{Analysts}}\] \[\text{Mean Recommendation} = \frac{1 \cdot \text{Strong Buy} + 2 \cdot \text{Buy} + 3 \cdot \text{Hold} + 4 \cdot \text{Sell} + 5 \cdot \text{Strong Sell}}{\text{Analysts}}\]

Also known as: analyst ratings, consensus rating, buy/hold/sell counts, street consensus.

Example · AAPL, NVDA, MSFT · 2026

Install the Finance Toolkit with pip install financetoolkit -U, then call get_analyst_consensus:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL", "NVDA", "MSFT"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2026-01-01",
    end_date="2026-11-30",
)

toolkit.get_analyst_consensus()

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

How many analysts rate Apple, Nvidia and Microsoft a buy, hold or sell, and what is the consensus for each?

Which returns:

Item AAPL NVDA MSFT
Strong Buy 1.0 2.0 0.0
Buy 70.0 53.0 68.0
Hold 32.0 24.0 15.0
Sell 9.0 3.0 0.0
Strong Sell 0.0 0.0 0.0
Analysts 112.0 82.0 83.0
Buy Share 0.6339 0.6707 0.8193
Mean Recommendation 2.4375 2.3415 2.1807
Consensus Buy Buy Buy

Parameters

get_analyst_consensus accepts the following parameters.

ParameterTypeDescriptionExample
overwriteboolDefines whether to overwrite the existing data. Defaults to False.True
roundingintDefines the number of decimal places to round the data to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Barber, B., Lehavy, R., McNichols, M., and Trueman, B. (2001). “Can Investors Profit from the Prophets? Security Analyst Recommendations and Stock Returns.” Journal of Finance, 56(2), 531-563.
  • Source FinancialModelingPrep, Stock Grades Summary (grades-consensus)
Share