I have very custom task and I need to make sure what are limits of each technology. I haven't found nothing similair in this forum yet. I am using Oraclize to get response from this url:
and I get such response:
{"Response":"Success","Type":100,"Aggregated":true,"Data":[{"time":1536559200,"close":197.88,"high":197.99,"low":196.45,"open":197.71,"volumefrom":948.44,"volumeto":186888.76},{"time":1536561000,"close":199.19,"high":199.35,"low":196.68,"open":197.88,"volumefrom":448.02,"volumeto":88870.37}], "TimeTo":1536562560,"TimeFrom":1536559200,"FirstValueInArray":true,"ConversionType":{"type":"force_direct","conversionSymbol":""}}
What I need to get is "open" price of first array element from Data which is 197.71 in this example and "close" price of second array element which is 199.19;
However, when I use my code, all I get is [] empty array or empty string. Here is the code:
function updatePriceSingle(uint256 timeStamp) payable {
if (oraclize_getPrice("URL") > this.balance) {
emit LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
} else {
emit LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query(timeStamp, "URL", "json(https://min-api.cryptocompare.com/data/histominute?fsym=ETH&tsym=USD&limit=1&aggregate=30e=CCCAGG).Data",200000);
}
}
and here is callback:
function __callback(bytes32 myid, string result) {
if (msg.sender != oraclize_cbAddress()) revert();
emit LogPriceUpdated(result);
}
I know workaround to make 2 calls json(...).Data[0] and json(...).Data[1], but I want to save gas and get results from 1 call in such case above. Is it possible ? Maybe there are solutions using "Test query" in http://app.oraclize.it/home/test_query . Thank you in advance.