Skip to main content

Endpoint

GET  /sentiment
POST /sentiment

Description

Returns daily sentiment analysis scores for cryptocurrency markets over the last 30 days. Tracks positive, negative, and neutral sentiment from news and social media.

Pricing

$0.01 USD per request (paid in USDC via x402)

Parameters

ticker
string
default:"general"
Cryptocurrency ticker symbol (e.g., BTC, ETH, SOL) or “general” for overall market sentiment

Request Examples

GET Request

curl -X GET "https://api.syraa.fun/sentiment?ticker=BTC"

POST Request

curl -X POST https://api.syraa.fun/sentiment \
  -H "Content-Type: application/json" \
  -d '{"ticker": "SOL"}'

General Market Sentiment

curl -X GET "https://api.syraa.fun/sentiment"

Response

sentimentAnalysis
array
Array of daily sentiment data points

Success Response - Specific Ticker

{
  "sentimentAnalysis": [
    {
      "date": "2026-03-03",
      "ticker": {
        "Positive": 145,
        "Negative": 23,
        "Neutral": 67,
        "sentiment_score": 52.3
      }
    },
    {
      "date": "2026-03-02",
      "ticker": {
        "Positive": 132,
        "Negative": 31,
        "Neutral": 58,
        "sentiment_score": 45.7
      }
    }
  ]
}

Success Response - General

{
  "sentimentAnalysis": [
    {
      "date": "2026-03-03",
      "general": {
        "Positive": 1250,
        "Negative": 340,
        "Neutral": 890,
        "sentiment_score": 36.5
      },
      "allTicker": {
        "Positive": 2340,
        "Negative": 567,
        "Neutral": 1456,
        "sentiment_score": 40.8
      }
    }
  ]
}

Error Responses

404 Not Found

{
  "error": "Sentiment analysis not found"
}

500 Internal Error

{
  "error": "Failed to fetch sentiment analysis"
}

Caching

Sentiment data is cached for 90 seconds to optimize performance.

Sentiment Score

The sentiment score ranges from -100 to +100:
  • +75 to +100: Extremely bullish
  • +25 to +75: Bullish
  • -25 to +25: Neutral
  • -75 to -25: Bearish
  • -100 to -75: Extremely bearish

Payment Settlement

Uses fallback settlement to handle facilitator failures:
const settle = await settlePaymentWithFallback(payload, accepted);

// Continues even if facilitator fails (non-critical)
if (!settle?.success && !isFacilitatorFailure) {
  throw new Error(settle?.errorReason);
}

Code Example

// Get Bitcoin sentiment
const response = await fetch('https://api.syraa.fun/sentiment?ticker=BTC');
const data = await response.json();

data.sentimentAnalysis.forEach(day => {
  const { date, ticker } = day;
  console.log(`${date}: Score ${ticker.sentiment_score}`);
  console.log(`  Positive: ${ticker.Positive}, Negative: ${ticker.Negative}`);
});

Data Analysis

// Calculate average sentiment over period
const avgSentiment = data.sentimentAnalysis.reduce(
  (sum, day) => sum + day.ticker.sentiment_score, 0
) / data.sentimentAnalysis.length;

console.log(`Average sentiment: ${avgSentiment.toFixed(1)}`);

Best Practices

  1. Track Trends: Monitor sentiment changes over time
  2. Compare Scores: Use sentiment alongside price action
  3. General vs Specific: Compare ticker sentiment to general market
  4. Volume Matters: High mention counts increase reliability

Build docs developers (and LLMs) love