Stock Ratings

Retrieves a stock ratings object or a list of stock ratings objects.


Endpoints

Retrieve a Stock Ratings Object

Parameters

api_key string required
Your authentication key needed to make requests.


date string format: YYYY-MM-DD
Date of stock ratings. If no input given the most recent stock ratings will be returned.


format string default: json
Defines return format of response. Options are json or csv. Default is json.

Example Request

cURL
curl -X GET "https://sensaai.com/data/v1/stock_ratings/mmm?date=2020-06-01&api_key=API_KEY"
Python
import requests

url = "https://sensaai.com/data/v1/stock_ratings/mmm/"
params = {
 "api_key": "API_KEY"  # Replace 'API_KEY' with your actual API key
 "date": "2020-06-01"
}

response = requests.get(url, params=params)

if response.status_code == 200:
 data = response.json()
 print(data)
else:
 print(f"Request failed with status code {response.status_code}")
JavaScript
const https = require('https');

const url = "https://sensaai.com/data/v1/stock_ratings/mmm/";
const params = {
api_key: "API_KEY", // Replace 'API_KEY' with your actual API key
"date": "2020-06-01"
};

const requestUrl = new URL(url);
requestUrl.search = new URLSearchParams(params);

https.get(requestUrl, (response) => {
let data = '';

response.on('data', (chunk) => {
  data += chunk;
});

response.on('end', () => {
  if (response.statusCode === 200) {
    console.log(data);
  } else {
    console.error(`Request failed with status code ${response.statusCode}`);
  }
});
});

Response

Returns a stock ratings object if a valid ticker was provided. Returns an error otherwise.

{
  "date": "2020-06-01",
  "stock": {
    "id": "1878",
    "ticker": "MMM",
    "name": "3M CO",
    "marketCap": "50067021000",
    "sector": "Industrials",
    "industry": "Industrial Products"
  },
  "totalRating": "8.3586",
  "returnRating": "6.1069",
  "growthRating": "7.6396",
  "riskRating": "8.1362",
  "valuationRating": "8.4343",
  "technicalRating": "8.4295",
},

Retrieve a List of Stock Ratings Objects

Parameters

api_key string required
Your authentication key needed to make requests.


search string
Limit to stocks where ticker or name contain search string.


order_by string
Defines what rating is used to rank stocks in response. - in front denotes ranking in descending order (e.g. -total_rating returns stock with highest total_rating first).


date string format: YYYY-MM-DD
Date of stock ratings. If no input given the most recent stock ratings will be returned.


ranges object int format: {rating_type:[min, max]}

Defines range of stock ratings to be returned. E.g. setting to ranges={return_rating:[8,10],growth_rating:[7,10]} will only return stocks with return_ratings equal to or above 8 and growth_rating equal to or above 7. Min is 0 and max is 10. By default no ratings limits are applied.


limit int default: 50 max: 200
A limit on the number of objects to be returned. Limit can range between 1 and 200, and the default is 50.


offset int default: 0
Use in combination with limit. If e.g. offset set to 50 with limit set to 100 object 51 to 150 will be returned. If offset set without limit it will default to limit of 50 so setting e.g. offset to 50 will return object 51 to 100.


format string default: json
Defines return format of response. Options are json or csv. Default is json.

Example Request

cURL
curl -X GET "https://sensaai.com/data/v1/stock_ratings/?api_key=API_KEY"
Python
import requests

url = "https://sensaai.com/data/v1/stock_ratings/"
params = {
 "api_key": "API_KEY"  # Replace 'API_KEY' with your actual API key
}

response = requests.get(url, params=params)

if response.status_code == 200:
 data = response.json()
 print(data)
else:
 print(f"Request failed with status code {response.status_code}")
JavaScript
const https = require('https');

const url = 'https://sensaai.com/data/v1/stock_ratings/';
const params = {
api_key: 'API_KEY', // Replace 'API_KEY' with your actual API key
};

const requestUrl = new URL(url);
requestUrl.search = new URLSearchParams(params);

https.get(requestUrl, (response) => {
let data = '';

response.on('data', (chunk) => {
  data += chunk;
});

response.on('end', () => {
  if (response.statusCode === 200) {
    console.log(data);
  } else {
    console.error(`Request failed with status code ${response.statusCode}`);
  }
});
});

Response

[
 {
    "date": "2020-06-01",
    "stock": {
      "id": "913",
      "ticker": "DSKE",
      "name": "Daseke, Inc.",
      "marketCap": "210311340",
      "sector": "Industrials",
      "industry": "Transportation & Logistics"
    },
    "totalRating": "9.9905",
    "returnRating": "9.4489",
    "growthRating": "9.1083",
    "riskRating": "9.3827",
    "valuationRating": "8.9924",
    "technicalRating": "9.2550",
    "macroRating": "5.0024"
  },
    ...more stocks
]