DEV Community

Pulsebit News Sentiment API
Pulsebit News Sentiment API

Posted on

Your Pipeline Is 9.3h Behind: Catching Blockchain Sentiment Leads with Pulsebit

Your Pipeline Is 9.3h Behind: Catching Blockchain Sentiment Leads with Pulsebit

We just discovered a notable anomaly in sentiment data: a 24-hour momentum spike of +0.343 related to blockchain discussions. This spike indicates a significant shift in sentiment that you should be aware of, especially in a rapidly evolving sector like blockchain. The leading coverage is coming from English-language press, which is ahead by 9.3 hours compared to Portuguese sources, suggesting that your sentiment pipeline might be missing out on crucial insights.

The problem here is clear: if your model doesn't account for multilingual origins or the dominance of certain entities, you risk falling behind the curve. Your pipeline missed this by 9.3 hours, which is not insignificant in a landscape where every moment matters. The leading entity in this case is the English press, and while you’re busy analyzing Portuguese sentiment, the narrative has already shifted in other languages.

English coverage led by 9.3 hours. Portuguese at T+9.3h. Con
English coverage led by 9.3 hours. Portuguese at T+9.3h. Confidence scores: English 0.75, Spanish 0.75, French 0.75 Source: Pulsebit /sentiment_by_lang.

To catch this momentum spike, we need to utilize our API effectively. Below is the Python code that will allow you to query the relevant sentiment data while filtering by the English language:

import requests

# Define the parameters for the API call
params = {
    "topic": "blockchain",
    "lang": "en"  # Filter for English language
}

![Left: Python GET /news_semantic call for 'blockchain'. Right](https://pub-c3309ec893c24fb9ae292f229e1688a6.r2.dev/figures/g3_code_output_split_1787066460567.png)
*Left: Python GET /news_semantic call for 'blockchain'. Right: returned JSON response structure (clusters: 3). Source: Pulsebit /news_semantic.*


# API call to get sentiment data
response = requests.get("https://api.pulsebit.com/sentiment", params=params)
data = response.json()

# Extract the desired values
momentum = data['momentum_24h']  # +0.343
score = data['sentiment_score']    # +0.764
confidence = data['confidence']     # 0.75

print(f"24h Momentum: {momentum}, Sentiment Score: {score}, Confidence: {confidence}")
Enter fullscreen mode Exit fullscreen mode

Next, we need to run the clustered narrative through our sentiment scoring to evaluate how the themes are framed. Here’s how to do that:

# Meta-sentiment input
meta_sentiment_input = "Clustered by shared themes: street, wants, put, stock, market."

# API call to score the narrative
meta_response = requests.post("https://api.pulsebit.com/sentiment", json={"text": meta_sentiment_input})
meta_sentiment = meta_response.json()

print(f"Meta Sentiment Score: {meta_sentiment['score']}, Confidence: {meta_sentiment['confidence']}")
Enter fullscreen mode Exit fullscreen mode

With this code, you can effectively catch and evaluate the emerging themes around blockchain, especially in relation to mainstream sentiment.

Now, let’s explore three specific builds you can create with this newfound insight:

  1. Geographic Filter for Timeliness: Build a signal that alerts you whenever there's a 24-hour momentum spike above +0.3 in the English language. This will ensure you’re on top of emerging trends before they hit other markets.

Geographic detection output for blockchain. India leads with
Geographic detection output for blockchain. India leads with 1 articles and sentiment +0.85. Source: Pulsebit /news_recent geographic fields.

  1. Meta-Sentiment Analysis Loop: Implement a mechanism that automatically scores the narrative around clustered themes. If the score surpasses a threshold (say +0.5), trigger an alert for further analysis. This would allow you to focus on narratives that draw significant attention.

  2. Forming Themes Dashboard: Create a dashboard that visualizes forming themes like "blockchain(+0.00)" vs. "mainstream: street, wants, put". This will help you discern how blockchain discussions are evolving in contrast to more traditional topics, giving you a clearer picture of sentiment dynamics.

This approach ensures you’re not just reacting to data, but proactively understanding the shifts in sentiment and the narratives that shape them.

To get started, visit our documentation at pulsebit.lojenterprise.com/docs. You’ll find that you can copy-paste and run this in under 10 minutes, setting you up for a more responsive sentiment analysis pipeline that stays ahead of the game.

Top comments (0)