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}`);
}
});
});
api_keystringrequired
Your authentication key needed to make requests.
searchstring
Limit to stocks where ticker or name contain search string.
order_bystring
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).
datestringformat: YYYY-MM-DD
Date of stock ratings. If no input given the most recent stock ratings will be returned.
rangesobjectintformat: {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.
limitintdefault: 50max: 200
A limit on the number of objects to be returned. Limit can range between 1 and 200, and the default is 50.
offsetintdefault: 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.
formatstringdefault: json
Defines return format of response. Options are json or csv. Default is json.
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}`);
}
});
});
Java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://sensaai.com/data/v1/stock_ratings/?api_key=API_KEY";
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod("GET");
int status = connection.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(
status == 200 ? connection.getInputStream() : connection.getErrorStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
connection.disconnect();
System.out.println(content.toString());
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var client = new HttpClient();
var url = "https://sensaai.com/data/v1/stock_ratings/?api_key=API_KEY";
var response = await client.GetAsync(url);
if (response.IsSuccessStatusCode) {
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} else {
Console.WriteLine($"Request failed with status code {response.StatusCode}");
}
}
}