Analyst Ratings API
getRatings
The getRatings API offers analyst buy, sell and hold recommendations for over 4,500 publicly trading companies. Consensus estimates as well as the number of analysts rating the stock is included.
View All APIsContact Us to Get Access
Inputs
symbolsrequired
A symbol or code that identifies a financial instrument. Multiple symbols separated by a comma may be used. For futures, notation such as
Type
list (A comma or semi-colon delimited string.)
Example
AAPL,GOOG
fieldsoptional
The fields requested.
Type
list (A comma or semi-colon delimited string.)
Example
strongBuy,hold,strongSell
Outputs
symbol
always returned
always returned
A symbol or code that identifies a financial instrument.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
name
always returned
always returned
The type of symbol used.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
averageRecommendation
always returned
always returned
The average of all ratings (Strong Buy = 1.0, Moderate Buy = 2.0, Hold = 3.0, Moderate Sell = 4.0, Strong Sell = 5.0).
array
A data structure that contains a group of elements.
A data structure that contains a group of elements.
strongBuy
as requested
as requested
The number of Strong Buy ratings.
array
A data structure that contains a group of elements.
A data structure that contains a group of elements.
moderateBuy
as requested
as requested
The number of Moderate Buy ratings.
array
A data structure that contains a group of elements.
A data structure that contains a group of elements.
hold
as requested
as requested
The number of Hold ratings.
array
A data structure that contains a group of elements.
A data structure that contains a group of elements.
moderateSell
as requested
as requested
The number of Moderate Sell ratings.
array
A data structure that contains a group of elements.
A data structure that contains a group of elements.
strongSell
as requested
as requested
The number of Strong Sell ratings.
array
A data structure that contains a group of elements.
A data structure that contains a group of elements.
Status Code Responses
200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.
JSON
GET
GET https://ondemand.websol.barchart.com/getRatings.json?apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=strongBuy%2Chold%2CstrongSell
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getRatings.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=strongBuy%2Chold%2CstrongSell
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "AAPL",
"name": "Apple Inc",
"averageRecommendation": {
"current": "1.91",
"one_month_ago": "1.85",
"two_months_ago": "1.81",
"three_months_ago": "1.78"
},
"strongBuy": {
"current": "18",
"one_month_ago": "18",
"two_months_ago": "18",
"three_months_ago": "19"
},
"hold": {
"current": "9",
"one_month_ago": "10",
"two_months_ago": "9",
"three_months_ago": "9"
},
"strongSell": {
"current": "2",
"one_month_ago": "1",
"two_months_ago": "1",
"three_months_ago": "1"
}
},
{
"symbol": "GOOG",
"name": "Alphabet Cl C",
"averageRecommendation": {
"current": "1.34",
"one_month_ago": "1.39",
"two_months_ago": "1.4",
"three_months_ago": "1.33"
},
"strongBuy": {
"current": "40",
"one_month_ago": "38",
"two_months_ago": "36",
"three_months_ago": "36"
},
"hold": {
"current": "7",
"one_month_ago": "8",
"two_months_ago": "8",
"three_months_ago": "6"
},
"strongSell": {
"current": "0",
"one_month_ago": "0",
"two_months_ago": "0",
"three_months_ago": "0"
}
}
]
}
XML
GET
GET https://ondemand.websol.barchart.com/getRatings.xml?apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=strongBuy%2Chold%2CstrongSell
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getRatings.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=strongBuy%2Chold%2CstrongSell
Response
<?xml version="1.0" encoding="utf-8"?>
<getRatings>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>AAPL</symbol>
<name>Apple Inc</name>
<averageRecommendation>
<current>1.91</current>
<one_month_ago>1.85</one_month_ago>
<two_months_ago>1.81</two_months_ago>
<three_months_ago>1.78</three_months_ago>
</averageRecommendation>
<strongBuy>
<current>18</current>
<one_month_ago>18</one_month_ago>
<two_months_ago>18</two_months_ago>
<three_months_ago>19</three_months_ago>
</strongBuy>
<hold>
<current>9</current>
<one_month_ago>10</one_month_ago>
<two_months_ago>9</two_months_ago>
<three_months_ago>9</three_months_ago>
</hold>
<strongSell>
<current>2</current>
<one_month_ago>1</one_month_ago>
<two_months_ago>1</two_months_ago>
<three_months_ago>1</three_months_ago>
</strongSell>
</item>
<item>
<symbol>GOOG</symbol>
<name>Alphabet Cl C</name>
<averageRecommendation>
<current>1.34</current>
<one_month_ago>1.39</one_month_ago>
<two_months_ago>1.4</two_months_ago>
<three_months_ago>1.33</three_months_ago>
</averageRecommendation>
<strongBuy>
<current>40</current>
<one_month_ago>38</one_month_ago>
<two_months_ago>36</two_months_ago>
<three_months_ago>36</three_months_ago>
</strongBuy>
<hold>
<current>7</current>
<one_month_ago>8</one_month_ago>
<two_months_ago>8</two_months_ago>
<three_months_ago>6</three_months_ago>
</hold>
<strongSell>
<current>0</current>
<one_month_ago>0</one_month_ago>
<two_months_ago>0</two_months_ago>
<three_months_ago>0</three_months_ago>
</strongSell>
</item>
</getRatings>
CSV
GET
GET https://ondemand.websol.barchart.com/getRatings.csv?apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=strongBuy%2Chold%2CstrongSell
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getRatings.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=strongBuy%2Chold%2CstrongSell
Response
symbol,name,averageRecommendation_current,averageRecommendation_one_month_ago,averageRecommendation_two_months_ago,averageRecommendation_three_months_ago,strongBuy_current,strongBuy_one_month_ago,strongBuy_two_months_ago,strongBuy_three_months_ago,hold_current,hold_one_month_ago,hold_two_months_ago,hold_three_months_ago,strongSell_current,strongSell_one_month_ago,strongSell_two_months_ago,strongSell_three_months_ago
"AAPL","Apple Inc","1.91","1.85","1.81","1.78","18","18","18","19","9","10","9","9","2","1","1","1"
"GOOG","Alphabet Cl C","1.34","1.39","1.4","1.33","40","38","36","36","7","8","8","6","0","0","0","0"
PHP
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'symbols' => 'AAPL,GOOG',
'fields' => 'strongBuy,hold,strongSell',
];
$result = $ondemand->getRatings($params);
var_dump($result);
Classic ASP
Dim ondemand
Dim result
Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")
Set result = ondemand.getRatings("YOUR_API_KEY", "AAPL,GOOG", "strongBuy,hold,strongSell")
Perl
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getRatings('YOUR_API_KEY', 'AAPL,GOOG', 'strongBuy,hold,strongSell');
print $result;
Python
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getRatings('YOUR_API_KEY', 'AAPL,GOOG', 'strongBuy,hold,strongSell')
print(result)
Ruby
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getRatings,
message: {
apikey: 'YOUR_API_KEY',
symbols: 'AAPL,GOOG',
fields: 'strongBuy,hold,strongSell',
}
)
response.body