新闻接口
Signal Feed 提供新闻资讯接口,支持市场概览、题材库、快讯要闻等功能。
基础信息
- Base URL:
http://localhost:4000/api/v1 - 认证方式: Bearer Token
- 数据格式: JSON
- 接口前缀:
/news
主要接口
市场概览
市场概览
GET /api/v1/news/overview获取市场概览数据。
市场主线
市场主线
GET /api/v1/news/mainline获取市场主线主题与热点。
题材库
题材库列表
GET /api/v1/news/topic/library/list获取题材库分类列表。
题材库详情
GET /api/v1/news/topic/library/detail/{themeId}按题材ID获取题材详情。
题材成分股
GET /api/v1/news/topic/library/stocks/{themeId}获取题材关联的股票列表。
要闻摘要
要闻摘要
GET /api/v1/news/headlines?page=0&pageSize=10&keyword=新闻联播要闻获取新闻联播要闻、新闻精选等摘要,支持分页与关键词。
查询参数:
page: 页码(默认0)pageSize: 每页数量(默认10)keyword: 关键词(默认”新闻联播要闻”)
快讯要闻
快讯要闻
GET /api/v1/news/feed?cursor=获取快讯与要闻流,支持游标分页。
查询参数:
cursor: 游标,用于分页(可选)
使用示例
const API_TOKEN = 'your_api_token';
const BASE_URL = 'http://localhost:4000/api/v1';
// 获取市场概览
async function getMarketOverview() {
const response = await fetch(`${BASE_URL}/news/overview`, {
headers: {
'Authorization': `Bearer ${API_TOKEN}`
}
});
return response.json();
}
// 获取市场主线
async function getMarketMainline() {
const response = await fetch(`${BASE_URL}/news/mainline`, {
headers: {
'Authorization': `Bearer ${API_TOKEN}`
}
});
return response.json();
}
// 获取题材库列表
async function getTopicLibraryList() {
const response = await fetch(`${BASE_URL}/news/topic/library/list`, {
headers: {
'Authorization': `Bearer ${API_TOKEN}`
}
});
return response.json();
}
// 获取题材库详情
async function getTopicLibraryDetail(themeId) {
const response = await fetch(`${BASE_URL}/news/topic/library/detail/${themeId}`, {
headers: {
'Authorization': `Bearer ${API_TOKEN}`
}
});
return response.json();
}
// 获取快讯要闻
async function getNewsFeed(cursor = '') {
const params = cursor ? new URLSearchParams({ cursor }) : '';
const url = `${BASE_URL}/news/feed${params ? '?' + params : ''}`;
const response = await fetch(url, {
headers: {
'Authorization': `Bearer ${API_TOKEN}`
}
});
return response.json();
}
// 获取要闻摘要
async function getHeadlines(keyword = '新闻联播要闻', page = 0, pageSize = 10) {
const params = new URLSearchParams({
keyword,
page: page.toString(),
pageSize: pageSize.toString()
});
const response = await fetch(`${BASE_URL}/news/headlines?${params}`, {
headers: {
'Authorization': `Bearer ${API_TOKEN}`
}
});
return response.json();
}响应格式
所有接口统一返回以下格式:
{
"success": true,
"data": {
// 具体数据内容
}
}更多资源
- 📖 完整 API 文档 - 返回主 API 文档
Last updated on