Sentiment
357 words · 2 min read
Overview
This documentation describes how to use the Sentiment
endpoint to access sentiment analysis data for various cryptocurrencies over a specified number of days.
Endpoint
GET /api/v2/sentiment/sentiment/<COIN>/<DAYS>
Retrieve the sentiment analysis for a specified cryptocurrency over a defined number of days.
Base URL
https://api.guavy.com
Full Endpoint Example
https://api.guavy.com/api/v2/sentiment/sentiment/BTC/30
Replace <COIN>
with the desired cryptocurrency symbol, such as BTC for Bitcoin, and <DAYS>
with the number of days for which you want sentiment data.
Authentication
This API requires authentication using a Bearer token. Include your API key in the request header as shown below.
Request Headers
Header | Description |
---|---|
Authorization | Bearer token for API authentication. |
Example Header
-H "Authorization: Bearer YOUR-API-KEY"
Response Format
The response returns data in JSON format, containing sentiment analysis details for the specified cryptocurrency over the given time period.
Example Response
{
"Success": [
{"timestamp": 1730098800000.0, "topic": "BTC", "positive": 430, "negative": 87},
{"timestamp": 1730012400000.0, "topic": "BTC", "positive": 175, "negative": 42},
{"timestamp": 1729926000000.0, "topic": "BTC", "positive": 156, "negative": 64},
{"timestamp": 1729839600000.0, "topic": "BTC", "positive": 548, "negative": 170},
...
]
}
Field Descriptions
Field | Type | Description |
---|---|---|
timestamp | float | The timestamp for the sentiment data point (in milliseconds since the epoch). |
topic | string | The cryptocurrency topic (e.g., "BTC"). |
positive | integer | The number of positive sentiments recorded. |
negative | integer | The number of negative sentiments recorded. |
Code Examples
cURL
curl -X GET "https://api.guavy.com/api/v2/sentiment/sentiment/BTC/30" \
-H "Authorization: Bearer YOUR-API-KEY"
Python (requests library)
import requests
url = "https://api.guavy.com/api/v2/sentiment/sentiment/BTC/30"
headers = {
"Authorization": "Bearer YOUR-API-KEY"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
print(data)
else:
print("Failed to retrieve data:", response.status_code)
JavaScript (fetch API)
fetch("https://api.guavy.com/api/v2/sentiment/sentiment/BTC/30", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR-API-KEY",
},
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));