获取代币情绪指标#
获取一个或多个代币的情绪指标数据,包括提及次数、情绪占比以及可选的趋势历史数据。
请求路径#
GET
https://web3.okx.com/api/v6/dex/market/social/sentiment/symbol请求参数#
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| tokenSymbols | string | 是 | 逗号分隔的代币符号列表,如 BTC,ETH。不区分大小写。必填;留空返回 400 错误。最多支持 20 个。 |
| timeFrame | string | 否 | 统计周期:1=1h(近 1 小时)、2=4h(近 4 小时)、3=24h(近 24 小时)。默认 1。 |
| trendPoints | string | 否 | 趋势数据点数。若 > 0,响应中将附加 trend 数组,包含 trendPoints 个等间隔时间桶的历史数据。填 0 或省略则不返回 trend。 |
返回参数#
| 字段 | 类型 | 描述 |
|---|---|---|
| period | string | 请求 timeFrame 参数对应的实际统计周期字符串,如 "1h"、"4h"、"24h" |
| ts | string | 服务端时间戳(毫秒) |
| details | array | 每个请求的代币对应一条记录 |
| > tokenSymbol | string | 代币符号 |
| > mentionCount | string | 统计周期内该代币的总提及次数,含 X/Twitter 与新闻来源 |
| > xMentionCount | string | X/Twitter 平台的提及次数 |
| > newsMentionCount | string | 新闻来源的提及次数 |
| > sentiment | object | 该代币的情绪分布数据 |
| >> bullishCnt | string | 看多情绪的提及次数 |
| >> bearishCnt | string | 看空情绪的提及次数 |
| >> neutralCnt | string | 中性情绪的提及次数 |
| >> bullishRatio | string | 看多占比,范围 0.0–1.0 |
| >> bearishRatio | string | 看空占比,范围 0.0–1.0 |
| >> label | string | 综合情绪标签:bullish(看多)/ bearish(看空)/ neutral(中性)/ mixed(混合) |
| > trend | array | 仅当请求参数 trendPoints > 0 时返回 |
| >> ts | string | 时间桶的时间戳(毫秒) |
| >> mentionCount | string | 该时间桶内的总提及次数 |
| >> bullishRatio | string | 该时间桶内的看多占比 |
| >> bearishRatio | string | 该时间桶内的看空占比 |
请求示例#
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"
}
]
}
]
}
}