05.05.2018, 18:35
Code:
now = os.date('*t')
pickhour = (now.hour + 1)
require('json')
require('ssl.https')
res = ssl.https.request('https://www.nordpoolgroup.com/api/marketdata/page/23?currency=NOK')
values = {}
if res then
res = json.pdecode(res)
if type(res) == 'table' then
for _, row in ipairs(res.data.Rows) do
cols = row.Columns
value = cols[ 1 ].Value:gsub(',', '.')
values[ #values + 1 ] = tonumber(value)
end
end
end
log(values[pickhour])
But with the current link in there, it looks like it's getting prices for the next day`?
Best regards, Jørn.