获取代币情绪指标#

获取一个或多个代币的情绪指标数据,包括提及次数、情绪占比以及可选的趋势历史数据。

请求路径#

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

请求参数#

参数名类型是否必填描述
tokenSymbolsstring逗号分隔的代币符号列表,如 BTC,ETH。不区分大小写。必填;留空返回 400 错误。最多支持 20 个。
timeFramestring统计周期:1=1h(近 1 小时)、2=4h(近 4 小时)、3=24h(近 24 小时)。默认 1。
trendPointsstring趋势数据点数。若 > 0,响应中将附加 trend 数组,包含 trendPoints 个等间隔时间桶的历史数据。填 0 或省略则不返回 trend。

返回参数#

字段类型描述
periodstring请求 timeFrame 参数对应的实际统计周期字符串,如 "1h"、"4h"、"24h"
tsstring服务端时间戳(毫秒)
detailsarray每个请求的代币对应一条记录
> tokenSymbolstring代币符号
> mentionCountstring统计周期内该代币的总提及次数,含 X/Twitter 与新闻来源
> xMentionCountstringX/Twitter 平台的提及次数
> newsMentionCountstring新闻来源的提及次数
> sentimentobject该代币的情绪分布数据
>> bullishCntstring看多情绪的提及次数
>> bearishCntstring看空情绪的提及次数
>> neutralCntstring中性情绪的提及次数
>> bullishRatiostring看多占比,范围 0.0–1.0
>> bearishRatiostring看空占比,范围 0.0–1.0
>> labelstring综合情绪标签:bullish(看多)/ bearish(看空)/ neutral(中性)/ mixed(混合)
> trendarray仅当请求参数 trendPoints > 0 时返回
>> tsstring时间桶的时间戳(毫秒)
>> mentionCountstring该时间桶内的总提及次数
>> bullishRatiostring该时间桶内的看多占比
>> bearishRatiostring该时间桶内的看空占比

请求示例#

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'

返回示例#

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"
                    }
                ]
            }
        ]
    }
}