新闻API示例
设置小部件标题
new TradingView.widget({
/* 为简单起见隐藏其他小部件选项 */
news_provider: function getNews(symbol, callback) {
callback({
title: 'This is the title!',
newsItems: [/* ... */]
})
}
});获取非 RSS 新闻
const jsonNewsApiUrl = 'https://www.example.com';
new TradingView.widget({
/* 为简单起见隐藏其他小部件选项 */,
news_provider: function getNews(symbol, callback) {
fetch(jsonNewsApiUrl)
.then(res => res.json())
.then(json => {
callback({
newsItems: json,
});
});
}
});按需更新新闻
最后更新于