I am trying to implement trading view charting library into my angular project and use data from Crypto Compare trough web socket.
I went over the documentation and find it a bit confusing.
Do I need to create my own custom Datafeed object? And if yes than how?
In general if someone has an example of how to do that It would be great.
Tnx in advance!!
Edit
I am adding my widget config object, I want to understand what should I change in order to get data from 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,
};
What params should I change in order to access crypto compare for data?
Tnx
Use JS Api tradingview, in subscribeBars you can implement websocket with onRealtimeCallback
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
});
}
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With