Skip to content

Stock Sentiment API

Retrieve AI-powered sentiment analysis scores derived from financial news. Get sentiment scores for any ticker.

GET /v2/sentiment/{symbol}

Supports multiple authentication methods (in order of preference):

MethodExample
Bearer token (recommended)Authorization: Bearer YOUR_API_KEY
X-API-Key headerX-API-Key: YOUR_API_KEY
Query parameter?apiKey=YOUR_API_KEY
Legacy query parameter?token=YOUR_API_KEY
ParameterTypeRequiredDescription
symbolstringYesStock ticker symbol (e.g., AAPL, MSFT)
ParameterTypeRequiredDescription
apiKeystringNoYour API key (if not using header auth)
startDatestringNoStart date (YYYY-MM-DD)
endDatestringNoEnd date (YYYY-MM-DD)
limitintegerNoMaximum number of results to return
from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
df = fb.sentiments.ticker("AAPL",
date_from="2025-01-01",
date_to="2025-06-30",
as_dataframe=True)
print(df)
{
"success": true,
"data": {
"symbol": "AAPL",
"name": "Apple Inc.",
"data": [
{ "date": "2026-01-19", "score": 0.265 },
{ "date": "2026-01-16", "score": 0.346 },
{ "date": "2026-01-15", "score": 0.279 },
{ "date": "2026-01-14", "score": 0.17 },
{ "date": "2026-01-13", "score": 0.128 }
]
},
"meta": {
"timestamp": "2026-01-19T15:06:13.240Z"
}
}
FieldTypeDescription
successbooleanWhether the request was successful
dataobjectSentiment data container
metaobjectResponse metadata
FieldTypeDescription
symbolstringStock ticker symbol
namestringCompany name
dataarrayArray of sentiment score entries

Each item in the data array contains:

FieldTypeDescription
datestringDate of the sentiment score (YYYY-MM-DD)
scorenumberSentiment score from -1 (bearish) to 1 (bullish)
Score RangeInterpretation
0.5 to 1.0Strong bullish sentiment
0.2 to 0.5Moderate bullish sentiment
-0.2 to 0.2Neutral sentiment
-0.5 to -0.2Moderate bearish sentiment
-1.0 to -0.5Strong bearish sentiment
import requests
headers = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.get(
"https://api.finbrain.tech/v2/sentiment/AAPL",
headers=headers
)
result = response.json()
entries = result["data"]["data"]
# Get latest sentiment (first entry in array)
latest = entries[0]
score = latest["score"]
if score > 0.5:
print(f"AAPL sentiment is strongly bullish: {score:.3f}")
elif score > 0:
print(f"AAPL sentiment is mildly bullish: {score:.3f}")
elif score > -0.5:
print(f"AAPL sentiment is mildly bearish: {score:.3f}")
else:
print(f"AAPL sentiment is strongly bearish: {score:.3f}")
import requests
headers = {"Authorization": "Bearer YOUR_API_KEY"}
def detect_sentiment_spike(symbol):
"""Detect unusual sentiment activity"""
response = requests.get(
f"https://api.finbrain.tech/v2/sentiment/{symbol}",
headers=headers
)
result = response.json()
entries = result["data"]["data"]
if len(entries) < 10:
return None
# Calculate baseline from historical data
historical_scores = [e["score"] for e in entries[1:10]]
avg_score = sum(historical_scores) / len(historical_scores)
# Compare to latest
latest_score = entries[0]["score"]
score_change = latest_score - avg_score
alerts = []
if abs(score_change) > 0.2:
direction = "improved" if score_change > 0 else "declined"
alerts.append(f"Sentiment {direction} significantly ({score_change:+.3f})")
return alerts
alerts = detect_sentiment_spike("TSLA")
if alerts:
print("Sentiment Alerts:")
for alert in alerts:
print(f" - {alert}")
import requests
headers = {"Authorization": "Bearer YOUR_API_KEY"}
def analyze_sentiment_trend(symbol, days=14):
"""Analyze sentiment trend over time"""
response = requests.get(
f"https://api.finbrain.tech/v2/sentiment/{symbol}",
headers=headers,
params={"limit": days}
)
result = response.json()
entries = result["data"]["data"]
if len(entries) < days:
return None
recent = entries[:days//2]
older = entries[days//2:days]
recent_avg = sum(e["score"] for e in recent) / len(recent)
older_avg = sum(e["score"] for e in older) / len(older)
change = recent_avg - older_avg
if change > 0.1:
trend = "improving"
elif change < -0.1:
trend = "deteriorating"
else:
trend = "stable"
return {
"symbol": symbol,
"recent_sentiment": recent_avg,
"older_sentiment": older_avg,
"change": change,
"trend": trend
}
result = analyze_sentiment_trend("NVDA")
print(f"Sentiment trend: {result['trend']} ({result['change']:+.3f})")
CodeErrorDescription
400Bad RequestInvalid symbol
401UnauthorizedInvalid or missing API key
403ForbiddenAuthenticated, but not authorized to access this resource
404Not FoundTicker not found
429Too Many RequestsRate limit exceeded — wait and retry
500Internal Server ErrorServer-side error