Skip to content

News 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):

Method Example
Bearer token (recommended) Authorization: Bearer YOUR_API_KEY
X-API-Key header X-API-Key: YOUR_API_KEY
Query parameter ?apiKey=YOUR_API_KEY
Legacy query parameter ?token=YOUR_API_KEY
Parameter Type Required Description
symbol string Yes Stock ticker symbol (e.g., AAPL, MSFT)
Parameter Type Required Description
apiKey string No Your API key (if not using header auth)
startDate string No Start date (YYYY-MM-DD)
endDate string No End date (YYYY-MM-DD)
limit integer No Maximum 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"
}
}
Field Type Description
success boolean Whether the request was successful
data object Sentiment data container
meta object Response metadata
Field Type Description
symbol string Stock ticker symbol
name string Company name
data array Array of sentiment score entries

Each item in the data array contains:

Field Type Description
date string Date of the sentiment score (YYYY-MM-DD)
score number Sentiment score from -1 (bearish) to 1 (bullish)
Score Range Interpretation
0.5 to 1.0 Strong bullish sentiment
0.2 to 0.5 Moderate bullish sentiment
-0.2 to 0.2 Neutral sentiment
-0.5 to -0.2 Moderate bearish sentiment
-1.0 to -0.5 Strong 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})")
Code Error Description
400 Bad Request Invalid symbol
401 Unauthorized Invalid or missing API key
403 Forbidden Authenticated, but not authorized to access this resource
404 Not Found Ticker not found
429 Too Many Requests Rate limit exceeded — wait and retry
500 Internal Server Error Server-side error