Unofficial Nordpool Elspot API npm client
- Prices
- Volumes (not implemented yet)
- Capacities (not implemented yet)
- Flow (not implemented yet)
const nordpool = require('nordpool')
const prices = new nordpool.Prices()
let opts = {}
prices.hourly(opts, function (error, results) {
console.log(results)
})
at
: get price at an exact timehourly
: get hourly pricesdaily
: get daily pricesweekly
: get weekly pricesmonthly
: get monthly pricesyearly
: get yearly prices
area
: the energy market area. See http://www.nordpoolspot.com/maps/ Currently active areas are BERGEN, DK1, DK2, EE, ELE, FRE, KR.SAND, KT, LT, LV, MOLDE, OSLO, SE, SE1, SE2, SE3, SE4, SYS, TR.HEIM and TROMSØcurrency
: choose eitherDKK
,EUR
,NOK
orSEK
date
: can be aDate
ormoment.js
object or a string in ISO 8601 format orW/YYYY
(week number and year) orYYYY-MM
(year and month). If no timezone is set,CET
is assumed.from
: Don't return values before this time. Accepts same formats asdate
.to
: Don't return values after this time. Accepts same formats asdate
.
npm install nordpool
var nordpool = require('nordpool')
var prices = new nordpool.Prices()
prices.hourly({}, function (error, results) {
if (error) console.error(error)
for (var i=0; i<results.length; i++) {
var date = results[i].date // moment object (see http://momentjs.com/)
var price = results[i].value // float, EUR/MWh
var hourlyPriceMessage = results[i].area +
" at " + date.format("DD.MM. H:mm") + ": " + price/10 + " eurocent/kWh"
console.log(hourlyPriceMessage)
}
})
var nordpool = require('nordpool')
var prices = new nordpool.Prices()
var opts = {
area: 'FI', // See http://www.nordpoolspot.com/maps/
currency: 'EUR', // can also be 'DKK', 'NOK', 'SEK'
}
prices.hourly(opts, function (error, results) {
if (error) console.error(error)
for (var i=0; i<results.length; i++) {
var date = results[i].date
var price = results[i].value
var time = date.tz('Europe/Helsinki').format("D.M. H:mm")
console.log(price + ' ' + opts.currency + '/MWh at ' + time)
}
})
var nordpool = require('nordpool')
var prices = new nordpool.Prices()
var opts = {
currency: 'NOK',
area: 'Bergen',
from: '2016-01-01'
}
prices.weekly(opts, function (error, results) {
if (error) console.error(error)
for (var i=0; i<results.length; i++) {
var date = results[i].date
var price = results[i].value
var weeklyPriceMessage = "The price on week " + date.format("W/GGGG") +
" was " + price + " NOK/MWh"
console.log(weeklyPriceMessage)
}
})
See examples folder for more examples.
Check possible values for area
(regions) from nordpoolspot.com
Historical data seems to be available for two previous years.
- Versions prior to 2.0 were full of flaws. Don't use them.
- The Nordpool API returns data in Norwegian time zones. The
hourly
API returns data from midnight to midnight in the Europe/Oslo timezone. - The API limits are a bit strange. The maximum number of weeks is 24 and the maximum number of months is 53.
Add support for other API functions (volume, capacity, flow).