I am working with this API, which returns a JSON object like:
[{"date":1538352000,"high":543.888,"low":520.89920292,"open":532.41173358,"close":532.71432488,"volume":792203.12027095,"quoteVolume":1486.26362316,"weightedAverage":533.01655771},{"date":1538438400,"high":553,"low":523.82274418,"open":535.06483,"close":533.15796645,"volume":1450475.8150522,"quoteVolume":2682.34573456,"weightedAverage":540.74901544},{"date":1538524800,"high":533.60658309,"low":506.22210308,"open":531.24219955,"close":517.00043658,"volume":945028.64730972,"quoteVolume":1827.1757435,"weightedAverage":517.20730787},{"date":1538611200,"high":533.00000001,"low":509.587,"open":516.82852718,"close":513.21852291,"volume":544265.53254745,"quoteVolume":1041.87603086,"weightedAverage":522.38991629},{"date":1538697600,"high":530,"low":512.7298752,"open":514.75817848,"close":521.2431,"volume":645308.06820112,"quoteVolume":1243.52076205,"weightedAverage":518.93630399},{"date":1538784000,"high":523.39414,"low":503.53380007,"open":523.39414,"close":511.77607278,"volume":473719.42567386,"quoteVolume":923.75069854,"weightedAverage":512.82172389},{"date":1538870400,"high":526.20546417,"low":505.26000001,"open":510.54452549,"close":522.92723267,"volume":402055.92168411,"quoteVolume":779.44882881,"weightedAverage":515.82080416},{"date":1538956800,"high":536.58563365,"low":518.82687001,"open":522.04549871,"close":530.855282,"volume":696173.37857725,"quoteVolume":1313.23574261,"weightedAverage":530.12064474},{"date":1539043200,"high":531.4304796,"low":516.90000001,"open":530.5,"close":521.07257237,"volume":296723.0286641,"quoteVolume":568.04170907,"weightedAverage":522.36134059},{"date":1539129600,"high":521.3392031,"low":510.00000001,"open":520.23843786,"close":516.04400658,"volume":372294.49209797,"quoteVolume":721.23650102,"weightedAverage":516.18919948},{"date":1539216000,"high":515.63796825,"low":452.00000015,"open":515.63796825,"close":463.81882794,"volume":712051.78093963,"quoteVolume":1499.40313563,"weightedAverage":474.89015063}]
and in Python I am trying to get the "high" of the second most recent. In this case, if you look at the data when you click that link, the result is "521.3392031"
I'm trying to make it so that it always grabs the high for the second most recent.
I was going to use something like this: (which helped me grab some other data from another poloniex API)
poloniexPrices = urlopen('https://poloniex.com/public?command=returnChartData¤cyPair=USDT_BCH&start=1538352000&period=86400').read()
poloniexjson = json.loads(poloniexPrices)
poloniexlastP = poloniexjson['BLANK']['BLANK']
print (poloniexlastP)
but I just don't know what to do in this case.
Any ideas?
poloniexjson[-2]['high']