charting-library-examples icon indicating copy to clipboard operation
charting-library-examples copied to clipboard

Need an example for Angular 5 JS API implementation.

Open dittops opened this issue 6 years ago • 6 comments

  • Framework/library: Angular 5

dittops avatar Aug 23 '18 02:08 dittops

@dittops https://github.com/tradingview/charting-library-examples/tree/master/angular5 ? What do you need ? An Angular5 example without TypeScript ?

everget avatar Aug 24 '18 15:08 everget

@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 .

--

dittops avatar Aug 25 '18 13:08 dittops

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));
    }

}

pumano avatar Nov 07 '18 16:11 pumano

check this for api in node https://github.com/bergusman/tradingview-udf-binance-node

moderniinfotech-123 avatar Oct 11 '19 08:10 moderniinfotech-123

@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?

dittops avatar Dec 28 '19 21:12 dittops

@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.

dittops avatar Dec 28 '19 21:12 dittops