charting-library-examples
charting-library-examples copied to clipboard
Need an example for Angular 5 JS API implementation.
- Framework/library: Angular 5
@dittops https://github.com/tradingview/charting-library-examples/tree/master/angular5 ? What do you need ? An Angular5 example without TypeScript ?
@alex need a sample of JS api for live streaming of data with sockets in typescript way. I couldn’t find a sample for that.
On Fri, 24 Aug 2018 at 8:45 PM, Alex Orekhov [email protected] wrote:
@dittops https://github.com/dittops
https://github.com/tradingview/charting-library-examples/tree/master/angular5 ? What do you need ? An Angular5 example without TypeScript ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tradingview/charting-library-examples/issues/48#issuecomment-415790532, or mute the thread https://github.com/notifications/unsubscribe-auth/AMVoRQqyNxRMbaGnW5d4ua_VAkbtucGQks5uUBiWgaJpZM4WIwE7 .
--
If you interested in example, it's super easy (but no information in wiki found):
import { Injectable } from '@angular/core';
import * as TradingView from 'assets/lib/tradingview/charting_library/datafeed-api.d';
import { TradingViewService } from './trading-view.service'; // your http data service
@Injectable()
export class TradingViewDataProvider implements TradingView.IDatafeedChartApi {
constructor(private tradingViewService: TradingViewService) { }
// implement TradingView.IDatafeedChartApi interface here
// for example:
public getBars(
symbolInfo: TradingView.LibrarySymbolInfo,
resolution: TradingView.ResolutionString,
rangeStartDate: number,
rangeEndDate: number,
onResult: TradingView.HistoryCallback,
onError: TradingView.ErrorCallback,
isFirstCall: boolean
) {
this.tradingViewService.getBars(
symbolInfo,
resolution,
rangeStartDate,
rangeEndDate,
isFirstCall).subscribe(
data => onResult(data, { 'noData': false }),
error => onError(error));
}
}
check this for api in node https://github.com/bergusman/tradingview-udf-binance-node
@pumano how do you connect this to JSAPI as it's expecting an object with these functions. If we are using the classes, how do you pass just the object back without the DI?
@moderniinfotech-123 the code is shared is using UDF format If I'm correct. I'm looking for the JSAPI for realtime injection using sockets.