Created
May 21, 2020 10:39
-
-
Save dkp1903/a658db8292069e99cfbef2fdc2c9c85f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { LiveMarketDataService } from '../../live-market-data.service'; | |
@Component({ | |
selector: 'app-candlestick', | |
templateUrl: './candlestick.component.html', | |
styleUrls: ['./candlestick.component.css'] | |
}) | |
export class CandlestickComponent implements OnInit { | |
constructor(private livemarketdataservice: LiveMarketDataService) { | |
} | |
ngOnInit(): any | |
{ | |
let stockDetails = []; | |
let all_times = []; | |
this.livemarketdataservice.stockLiveData().subscribe(res => { | |
let timeStamp = res["Time Series (60min)"]; | |
all_times.push(timeStamp); | |
let element: any; | |
let finArr = []; | |
for(element in timeStamp) | |
{ | |
console.log(typeof(element)); | |
let temp = []; | |
finArr = []; | |
console.log('here' + element[0]); | |
finArr.push(element); | |
finArr.push(parseFloat(res["Time Series (60min)"][element]["1. open"])); | |
finArr.push(parseFloat(res["Time Series (60min)"][element]["2. high"])); | |
finArr.push(parseFloat(res["Time Series (60min)"][element]["3. low"])); | |
finArr.push(parseFloat(res["Time Series (60min)"][element]["4. close"])); | |
//finArr.push(parseInt(res["Time Series (60min)"][element]["5. volume"])); | |
console.log('FINARR' + finArr); | |
stockDetails.push(finArr); | |
//return stockDetails; | |
}; | |
console.log('stockDetails: ' + stockDetails[0]); | |
});//this. ends here | |
return stockDetails; | |
} | |
title = ''; | |
type = 'CandlestickChart'; | |
data = //this.stockDetails; | |
this.ngOnInit(); | |
columns = ['Timestamp', 'Open', 'High', 'Low', 'Close']; | |
options = { }; | |
width = 1000; | |
height = 800; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment