新闻全文搜索#

支持关键词全文搜索的新闻接口,可结合多维度过滤条件使用。

请求路径#

GET
https://web3.okx.com/api/v6/dex/market/social/news/search

请求参数#

参数名类型是否必填描述
keywordstring全文搜索关键词,支持代币名称、项目名等自由文本。大小写不敏感。必填。
sortBystring排序方式:1=latest(发布时间倒序)、2=hot(热度降序)。默认 1。
sentimentstringSocialSentimentEnum 枚举码,按情绪倾向筛选:1=bullish(看多)、2=bearish(看空)、3=neutral(中性)。省略则返回所有情绪。
importancestringSocialImportanceEnum 枚举码,按文章重要程度筛选:1=high(高重要性)、2=medium(中等)、3=low(低重要性)。省略则返回所有重要级别。
platformstring新闻来源域名,如 coindesk.com。可通过 GET /social/news/platforms 获取全量列表。省略则不限制来源。
tokenSymbolsstring逗号分隔的代币符号列表,如 BTC,ETH。不区分大小写。省略则不限制代币。最多支持 20 个。
beginstring查询起始时间戳(毫秒)。默认为当前时间 - 72 小时;最大可回溯 180 天。
endstring查询结束时间戳(毫秒)。默认为当前时间(now)。
detailLevelstring响应详情级别:1=summary(仅返回标题 + 摘要);2=full(同时返回完整正文 content 字段)。默认 1。
limitstring每页返回条数,范围 [1, 50],默认 10。
cursorstring翻页游标。首次请求不传;后续请求传入上一次响应中的 cursor 以获取下一页。cursor 为 null 时表示已无更多数据。
languagestring响应语言,BCP-47 格式,如 en_US、zh_CN。默认 en_US。

返回参数#

字段类型描述
cursorstring下一页游标;为 null 时表示已无更多数据
articlesarray新闻文章列表
> idstring文章唯一 ID,可作为 GET /social/news/detail 接口的 articleId 参数查询完整正文
> titlestring文章标题
> summarystring文章摘要
> contentstring文章完整正文,仅在 detailLevel=2 时返回
> sourceUrlstring文章原文链接
> sourcestring新闻来源的第一个平台域名,如 coindesk.com
> timestampstring文章发布时间,Unix 毫秒时间戳
> tokenSymbolsarray文章中提及的代币符号列表
> importancestring文章重要程度:high(高)、medium(中)、low(低)
> tokenSymbolSentimentsarray本文中各代币的情绪分析列表
>> sentimentstring情绪标签:bullish(看多)/ bearish(看空)/ neutral(中性)
>> tokenSymbolstring代币符号

请求示例#

shell
curl --location --request GET 'https://web3.okx.com/api/v6/dex/market/social/news/search?keyword=ethereum&sortBy=1&limit=10&detailLevel=1&language=zh_CN' \
--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": {
        "cursor": "eyJsYXN0SWQiOiIxNzM4MDAwMDAwMDAzIn0",
        "articles": [
            {
                "id": "NEWS_20241018_020",
                "title": "以太坊基金会宣布新一轮开发者资助计划",
                "summary": "以太坊基金会启动新一轮开发者资助,重点面向基础设施与工具建设方向。",
                "content": "",
                "sourceUrl": "https://decrypt.co/ethereum-foundation-grants",
                "source": "decrypt.co",
                "timestamp": "1697631000000",
                "tokenSymbols": ["ETH"],
                "importance": "medium",
                "tokenSymbolSentiments": [
                    {
                        "tokenSymbol": "ETH",
                        "sentiment": "bullish"
                    }
                ]
            },
            {
                "id": "NEWS_20241018_021",
                "title": "以太坊质押存款超过 3000 万 ETH",
                "summary": "信标链上的 ETH 质押总量突破 3000 万,占总供应量的 25% 以上。",
                "content": "",
                "sourceUrl": "https://coindesk.com/tech/2024/10/18/ethereum-staking",
                "source": "coindesk.com",
                "timestamp": "1697620000000",
                "tokenSymbols": ["ETH"],
                "importance": "high",
                "tokenSymbolSentiments": [
                    {
                        "tokenSymbol": "ETH",
                        "sentiment": "bullish"
                    }
                ]
            }
        ]
    }
}