Get Token Sentiment Metrics#

Retrieve sentiment metrics for one or more tokens, including mention counts, sentiment ratios, and optional trend data.

Request Path#

GET
https://web3.okx.com/api/v6/dex/market/social/sentiment/symbol

Request Parameters#

ParameterTypeRequiredDescription
tokenSymbolsstringYesComma-separated list of token symbols, e.g. BTC,ETH. Case-insensitive. Maximum 20 symbols. Returns 400 error if blank.
timeFramestringNoStatistical period: 1=1h (last 1 hour), 2=4h (last 4 hours), 3=24h (last 24 hours). Default 1.
trendPointsstringNoNumber of trend data points. If > 0, the response will include a trend array with trendPoints equally-spaced historical time buckets. Set to 0 or omit to skip trend data.

Response Parameters#

FieldTypeDescription
periodstringActual statistical period corresponding to the timeFrame parameter, e.g. "1h", "4h", "24h"
tsstringServer-side timestamp (milliseconds)
detailsarrayOne record per requested token
> tokenSymbolstringToken symbol
> mentionCountstringTotal mention count for this token within the statistical period, including X/Twitter and news sources
> xMentionCountstringMention count on X/Twitter platform
> newsMentionCountstringMention count from news sources
> sentimentobjectSentiment breakdown for this token
>> bullishCntstringNumber of bullish-sentiment mentions
>> bearishCntstringNumber of bearish-sentiment mentions
>> neutralCntstringNumber of neutral-sentiment mentions
>> bullishRatiostringBullish ratio, range 0.0–1.0
>> bearishRatiostringBearish ratio, range 0.0–1.0
>> labelstringOverall sentiment label: bullish / bearish / neutral / mixed
> trendarrayOnly returned when trendPoints > 0
>> tsstringTime bucket timestamp (milliseconds)
>> mentionCountstringTotal mention count within this time bucket
>> bullishRatiostringBullish ratio within this time bucket
>> bearishRatiostringBearish ratio within this time bucket

Request Example#

shell
curl --location --request GET 'https://web3.okx.com/api/v6/dex/market/social/sentiment/symbol?tokenSymbols=BTC&timeFrame=1&trendPoints=24' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'

Response Example#

json
{
    "code": "0",
    "msg": "",
    "data": {
        "period": "1h",
        "ts": "1697630501000",
        "details": [
            {
                "tokenSymbol": "BTC",
                "mentionCount": "12540",
                "xMentionCount": "10200",
                "newsMentionCount": "2340",
                "sentiment": {
                    "bullishCnt": "7890",
                    "bearishCnt": "1230",
                    "neutralCnt": "3420",
                    "bullishRatio": "0.629",
                    "bearishRatio": "0.098",
                    "label": "bullish"
                },
                "trend": [
                    {
                        "ts": "1697626901000",
                        "mentionCount": "520",
                        "bullishRatio": "0.645",
                        "bearishRatio": "0.092"
                    },
                    {
                        "ts": "1697627051000",
                        "mentionCount": "498",
                        "bullishRatio": "0.631",
                        "bearishRatio": "0.101"
                    }
                ]
            }
        ]
    }
}