Code Monkey home page Code Monkey logo

nordpool-node's Introduction

Nordpool Elspot API npm client

Build Status

Unofficial Nordpool Elspot API npm client

Features

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 time
  • hourly: get hourly prices
  • daily: get daily prices
  • weekly: get weekly prices
  • monthly: get monthly prices
  • yearly: 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 and TROMSØ
  • currency: choose either DKK, EUR, NOK or SEK
  • date: can be a Date or moment.js object or a string in ISO 8601 format or W/YYYY (week number and year) or YYYY-MM (year and month). If no timezone is set, CET is assumed.
  • from: Don't return values before this time. Accepts same formats as date.
  • to: Don't return values after this time. Accepts same formats as date.

Install

npm install nordpool

Examples

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 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.

TODO

Add support for other API functions (volume, capacity, flow).

nordpool-node's People

Contributors

samuelmr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.