03.05.2018, 06:38
You will get a table with 30 items as the result (24 hour value + min/max/etc).
You can change the location by modifying cols table index (1 = Oslo, 2 = Kr.sand, 3 = Bergen, 4 = Tr.heim, 5 = Molde, 6 = Tromsø).
You can change the location by modifying cols table index (1 = Oslo, 2 = Kr.sand, 3 = Bergen, 4 = Tr.heim, 5 = Molde, 6 = Tromsø).
Code:
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)