如何将所需的时间分辨率添加到 TradingView 图表库图表中,如下例所示(1D、5D、1M、3M,...)并触发事件以更新自定义 API 中的数据? https://www.tradingview.com/chart/03M7zkuw/?symbol=NASDAQ%3AAAPL
除了resolveSymbol函数中的supported_resolutions之外,我找不到任何文档。 即使将此设置设置为 ['1', '5', '15', '30', '60', '1D', '1W', '1M'],我仍然只得到 5y 和 1y 选项,就像设置没有执行任何操作一样。
我做错了什么?
我在resolveSymbol javascript函数中的代码:
var symbolInfo = {
ticker: charts.chartContainer.data("ticker"),
name: charts.chartContainer.data("ticker"),
description: charts.chartContainer.data("ticker"),
type: "",
session: '24x7',
timezone: 'Etc/UTC',
exchange: "",
minmov: 1,
pricescale: 100,
has_intraday: false,
has_no_volume: true,
has_weekly_and_monthly: false,
supports_group_request: true,
supported_resolutions: charts.configurationData.supported_resolutions,
volume_precision: 2,
data_status: 'streaming',
};
setTimeout(function() {
onSymbolResolvedCallback(symbolInfo);
});
谢谢!
所以对于未来的问题,答案是在configurationData中添加time_frames:
time_frames: [
{ text: "1y", resolution: "1D", description: "1 Year" },
{ text: "3m", resolution: "1D", description: "3 Months"},
{ text: "1m", resolution: "1D", description: "1 Month" },
{ text: "1w", resolution: "60", description: "1 Week" },
{ text: "1d", resolution: "5", description: "1 Day" },
{ text: "1000y", resolution: "1D", description: "All", title: "All" }
]
请设置“has_intraday”:true