TradingView 通过 websocket 集成
TradingView integration trough websocket
我正在尝试将交易视图图表库实施到我的 angular 项目中,并通过网络套接字使用来自 Crypto Compare 的数据。
我查看了文档,发现它有点令人困惑。
我需要创建自己的自定义 Datafeed 对象吗?如果是,怎么办?
一般来说,如果有人有一个如何做到这一点的例子,那就太好了。
提前发送!!
编辑
我正在添加我的小部件配置对象,我想了解我应该更改什么以便从 CryptoCompare 获取数据:
const widgetOptions: ChartingLibraryWidgetOptions = {
symbol: this._symbol,
datafeed: new (window as any).Datafeeds.UDFCompatibleDatafeed(this._datafeedUrl),
interval: this._interval,
container_id: this._containerId,
library_path: this._libraryPath,
locale: 'en',
disabled_features: ['use_localstorage_for_settings'],
enabled_features: ['study_templates'],
charts_storage_url: this._chartsStorageUrl,
charts_storage_api_version: this._chartsStorageApiVersion,
client_id: this._clientId,
user_id: this._userId,
fullscreen: this._fullscreen,
autosize: this._autosize,
};
我应该更改哪些参数才能访问数据的加密比较?
Tnx
使用 JS Api tradingview,在 subscribeBars 中你可以使用 onRealtimeCallback 实现 websocket
this.subscribeBars = function (symbolInfo, resolution, onRealtimeCallback, subscribeUID, onResetCacheNeededCallback) {
$scope.$on('handleBroadcastDfn', function () {
if (symbolInfo.id === dfnData.message.symbol) {
onRealtimeCallback(
{
time: lastData.time,
close: dfnData.message.ask,
open: lastData.open,
low: lastData.low,
high: lastData.high, volume: 0
});
}
});
}
我正在尝试将交易视图图表库实施到我的 angular 项目中,并通过网络套接字使用来自 Crypto Compare 的数据。
我查看了文档,发现它有点令人困惑。
我需要创建自己的自定义 Datafeed 对象吗?如果是,怎么办?
一般来说,如果有人有一个如何做到这一点的例子,那就太好了。
提前发送!!
编辑
我正在添加我的小部件配置对象,我想了解我应该更改什么以便从 CryptoCompare 获取数据:
const widgetOptions: ChartingLibraryWidgetOptions = {
symbol: this._symbol,
datafeed: new (window as any).Datafeeds.UDFCompatibleDatafeed(this._datafeedUrl),
interval: this._interval,
container_id: this._containerId,
library_path: this._libraryPath,
locale: 'en',
disabled_features: ['use_localstorage_for_settings'],
enabled_features: ['study_templates'],
charts_storage_url: this._chartsStorageUrl,
charts_storage_api_version: this._chartsStorageApiVersion,
client_id: this._clientId,
user_id: this._userId,
fullscreen: this._fullscreen,
autosize: this._autosize,
};
我应该更改哪些参数才能访问数据的加密比较?
Tnx
使用 JS Api tradingview,在 subscribeBars 中你可以使用 onRealtimeCallback 实现 websocket
this.subscribeBars = function (symbolInfo, resolution, onRealtimeCallback, subscribeUID, onResetCacheNeededCallback) {
$scope.$on('handleBroadcastDfn', function () {
if (symbolInfo.id === dfnData.message.symbol) {
onRealtimeCallback(
{
time: lastData.time,
close: dfnData.message.ask,
open: lastData.open,
low: lastData.low,
high: lastData.high, volume: 0
});
}
});
}