Sentiment
The following endpoints retrieves the daily Sentiment of entities.
Quotient Ts
Returns the Sentiment timeseries of an entity. Is is calculated as the Quotient of Positive and all mentions of that company.
Sentiment = (Positive + 1) / (Positive + Negative + 2).
Examples
- Curl
- Python
Note: If you are using Windows, adjust the syntax:
- Replace line breaks (
\) with caret (^).- Use double quotes (
") instead of single quotes (').
curl -X 'GET' \
'https://data.api.yukkalab.com/9-3-5/2023-12-13-0/api/company/apple/quotient_ts?date_from=2024-07-01&date_to=2024-07-05&period=1' \
-H 'accept: application/json' \
-H "Authorization: Bearer $YUKKA_TOKEN"
Return type
JSON
Example Response
{"quotient_ts":[{"quotient":0.6909361069836553,"date":"2024-07-01"},{"quotient":0.7656543939801129,"date":"2024-07-02"},{"quotient":0.7824267782426778,"date":"2024-07-03"},{"quotient":0.7459407831900668,"date":"2024-07-04"}],"used_cache":true,"cache_key":"auto_cache_quotient_ts_20ab5f5bd5449493fbded00c779c03ceac6cd7544465dfc2fe4bdf8f627c882c"}
import requests
import os
import pandas as pd
# getting the data
headers = {'Authorization': f'Bearer {os.environ["YUKKA_TOKEN"]}'}
url = f'https://data.api.yukkalab.com/9-3-5/2023-12-13-0/api/company/apple/quotient_ts?date_from=2024-07-01&date_to=2024-07-05&period=1'
data = requests.get(url, headers=headers).json()
# transform into dataframe:
df = pd.DataFrame(data['quotient_ts'])
print(df)
Return type
pd.DataFrame(columns=[date, quotient])
Example Response
quotient date
0 0.690936 2024-07-01
1 0.765654 2024-07-02
2 0.782427 2024-07-03
3 0.745941 2024-07-04
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| date_from | date | Date to start from when using time ranges | [optional] |
| date_to | date | Date to end from (exclusively) when using time ranges | [optional] |
| period | date | Rolling average period for the sentiment | [optional][default to 4] |
| default_time_back | str | Default period of time that is used when no end date is supplied | [optional][default to 1w;] |
Authorization
JSON Web Token. Issued by Yukka.
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful Response | - |
| 422 | Validation Error | - |
Quotient Ts Itemized
Returns the Sentiment timeseries of multiple entities
Example
- Curl
- Python
Note: If you are using Windows, adjust the syntax:
- Replace line breaks (
\) with caret (^).- Use double quotes (
") instead of single quotes (').
curl -X 'POST' \
'https://data.api.yukkalab.com/9-3-5/2023-12-13-0/v2/api/portfolio/quotient_ts_itemized?date_from=2024-07-01&date_to=2024-07-05&period=1' \
-H 'accept: application/json' \
-H "Authorization: Bearer $YUKKA_TOKEN" \
-d '["company:apple", "company:sap"]'
Return type
JSON
Example Response
{"quotient_ts_itemized":[{"entity_info":{"type":"company","alpha_id":"apple","compound_key":"company:apple"},"quotient_ts":[{"quotient":0.6909361069836553,"date":"2024-07-01"},{"quotient":0.7656543939801129,"date":"2024-07-02"},{"quotient":0.7824267782426778,"date":"2024-07-03"},{"quotient":0.7459407831900668,"date":"2024-07-04"}]},{"entity_info":{"type":"company","alpha_id":"sap","compound_key":"company:sap"},"quotient_ts":[{"quotient":0.9111111111111111,"date":"2024-07-01"},{"quotient":0.9479166666666666,"date":"2024-07-02"},{"quotient":0.9361702127659575,"date":"2024-07-03"},{"quotient":0.8552631578947368,"date":"2024-07-04"}]}],"used_cache":false,"cache_key":"auto_cache_quotient_ts_itemized_v2_f4e4ee2d3026850fbe4b49828d42ffabd54dad036bcc0ff0058522f52c01236f","last_updated":"2024-07-25T09:14:56.533777+00:00"}
import requests
import os
import pandas as pd
# getting the data
headers = {'Authorization': f'Bearer {os.environ["YUKKA_TOKEN"]}'}
url = f'https://data.api.yukkalab.com/9-3-5/2023-12-13-0/v2/api/portfolio/quotient_ts_itemized?date_from=2024-07-01&date_to=2024-07-05&period=1'
json_data = ['company:apple', "company:sap"]
data = requests.post(url, headers=headers, json=json_data).json()
# transform into dict of dataframes:
results = {}
for events in data['quotient_ts_itemized']:
df = pd.DataFrame(events['quotient_ts'])
results[events['entity_info']['compound_key']] = df
print(results)
Return type
Dict[str, pd.DataFrame(columns=[date, quotient])]
Example Response
{'company:apple':
quotient date
0 0.690936 2024-07-01
1 0.765654 2024-07-02
2 0.782427 2024-07-03
3 0.745941 2024-07-04,
'company:sap':
quotient date
0 0.911111 2024-07-01
1 0.947917 2024-07-02
2 0.936170 2024-07-03
3 0.855263 2024-07-04}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| date_from | date | Date to start from when using time ranges | [optional] |
| date_to | date | Date to end from (exclusively) when using time ranges | [optional] |
| period | date | Rolling average period for the sentiment | [optional][default to 4] |
| default_time_back | str | Default period of time that is used when no end date is supplied | [optional][default to 1w] |
Authorization
JSON Web Token. Issued by Yukka.
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful Response | - |
| 422 | Validation Error | - |