市场要闻
查询市场要闻
对应的请求类:NewsHighlightListRequest(method=news_highlight_list)
说明
查询市场要闻列表。
- 无必填参数,不传
lastId时从最新一条开始返回。 - 翻页只走
lastId游标:取上一页items最后一条的id,作为下一次调用的lastId。 - 响应中的
pageCount恒为 1,翻页请使用lastId,不要按页码翻页。
参数
NewsHighlightListRequest.newRequest(Language lang, String lastId)
| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| lang | Language | No | 语言枚举:zh_CN / zh_TW / en_US |
| lastId | String | No | 游标翻页参数,取上一页 items 最后一条的 id;传 null 从最新一条开始返回 |
返回
com.tigerbrokers.stock.openapi.client.https.response.news.NewsHighlightListResponse
返回数据可通过 NewsHighlightListResponse.getNewsPageItem() 方法访问,返回 NewsPageItem 对象,结构与 查询个股新闻 相同。
示例
import com.tigerbrokers.stock.openapi.client.config.ClientConfig;
import com.tigerbrokers.stock.openapi.client.https.client.TigerHttpClient;
import com.tigerbrokers.stock.openapi.client.https.domain.news.item.NewsItem;
import com.tigerbrokers.stock.openapi.client.https.request.news.NewsHighlightListRequest;
import com.tigerbrokers.stock.openapi.client.https.response.news.NewsHighlightListResponse;
import com.tigerbrokers.stock.openapi.client.struct.enums.Language;
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(ClientConfig.DEFAULT_CONFIG);
// 首页:不传 lastId,从最新一条开始
NewsHighlightListRequest request = NewsHighlightListRequest.newRequest(Language.zh_CN, null);
NewsHighlightListResponse response = client.execute(request);
if (response.isSuccess()) {
for (NewsItem item : response.getNewsPageItem().getItems()) {
System.out.println(item.getId() + " " + item.getTitle());
}
} else {
System.out.println("response error:" + response.getMessage());
}返回示例
{
"items": [
{
"id": "",
"title": "",
"summary": "",
"pubTimestamp": 1793957176,
"url": "https://xxxx"
}
],
"pageCount": 1,
"pageSize": 20,
"totalPage": 8,
"totalSize": 143
}请求频率
基础限流为 60 次/分钟。
Updated about 6 hours ago
Did this page help you?
