2.0.0 • Published 5 years ago
lekkimworld-nordpool v2.0.0
Nordpool Elspot API npm client
Unofficial Nordpool Elspot API npm client
Features
- Prices
- Volumes (not implemented yet)
- Capacities (not implemented yet)
- Flow (not implemented yet)
Usage
const nordpool = require('nordpool')
const prices = new nordpool.Prices()
let opts = {}
prices.hourly(opts, function (error, results) {
console.log(results)
})Methods
at: get price at an exact timehourly: get hourly pricesdaily: get daily pricesweekly: get weekly pricesmonthly: get monthly pricesyearly: get yearly prices
Options
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, TROMSØ, EE, LV, LT, AT, BE, DE-LU, FR and NL.currency: choose eitherDKK,EUR,NOKorSEK. Note that not all areas will return all currencies.date: can be aDateormoment.jsobject or a string in ISO 8601 format orW/YYYY(week number and year) orYYYY-MM(year and month). If no timezone is set,CETis 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.
Install
npm install nordpoolExamples
Example 1: Latest hourly prices from all areas
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)
}
})Example 2: Latest hourly prices in Finland
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)
}
})Example 3: Weekly prices in Bergen in 2015
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
Data availability
Historical data seems to be available for two previous years.
Known issues
- Versions prior to 2.0 were full of flaws. Don't use them.
- The Nordpool API returns data in Norwegian time zones. The
hourlyAPI 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.
TODO
Add support for other API functions (volume, capacity, flow).
2.0.0
5 years ago