Looking for a fresh perspective on this issue. I'm currently retrieving historical data from the cryptocompare API, but I'm having trouble accessing the received values.
https://i.sstatic.net/oH6hz.png
When I hardcode it as res.data.OMG.USD
, I can retrieve the desired result.
This is the exact format in which the data is returned. I've attempted to parse it into a string and store the results in an array, but I still can't access the prices. When I used Object.keys, it only returned the name and not the USD or EUR values. What could be the issue here?
UPDATE: Here's the request; I'm attempting to retrieve the USD values.
$http.get(
'data/pricehistorical?fsym=BTC&tsyms=USD,EUR'
).then(
function(res) {
//sample response
/*
{"OMG":{"USD":8.19,"EUR":6.65}}
{"BTC":{"USD":10226.86,"EUR":8153.29}}
*/
},
function(res) {
console.log(res);
}
);