npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

swedish-electricity-prices-region

v1.0.5

Published

All version numbering and releases are available on npmjs.com. Link to npmjs.com: https://www.npmjs.com/package/swedish-electricity-prices-region?activeTab=readme

Downloads

7

Readme

All version numbering and releases are available on npmjs.com. Link to npmjs.com: https://www.npmjs.com/package/swedish-electricity-prices-region?activeTab=readme

Swedish Electricity Price Calculator

The Swedish Electricity Price Calculator is a Node.js module that allows you to fetch and calculate electricity prices in Sweden. It provides historical data, price calculations, and the ability to compare prices across different regions.

Features

  • Fetch electricity price data from an API.
  • Calculate various metrics using electricity prices.
  • Access historical price data from November 1, 2022, onwards.
  • Compare prices between different regions.

Table of Contents

  1. Installation
  2. Methods
  3. Usage
  4. Status
  5. Who Can Contribute
  6. Future Plans
  7. License

Installation

You can install the Swedish Electricity Price Calculator using npm:

npm install swedish-electricity-prices-region

Methods

In ElectricityPriceTodayView.js, there are 4 methods that can be used to fetch and calculate electricity prices. These methods are:

Fetching-electricity-price-data-today

  • fetchHourData()
  • fetchTodayDataCalculation()
  • printHourDataToday()
  • printTodayDataCalculation()

In ElectricityPriceHistoricalView.js, there are 4 methods that can be used to fetch and caluclate electricity prices, and 1 method that can be used to compare prices between regions. These methods are:

Fetching-electricity-price-data-historical

  • fetchHistoricalHourPrice(year, month, day)
  • fetchHistoricalData(year, month, day)
  • printHourDataHistorical(year, month, day)
  • printHistoricalDataCalculation(year, month, day)
  • compareHistoricalData(year1, month1, day1, year2, month2, day2, regionCode1, regionCode2)

Usage

Fetching-electricity-price-data-today

Code Example:

import { ElectricityPriceTodayView } from 'swedish-electricity-prices-region/src/index.js'
const display = new ElectricityPriceTodayView()

const fetchHour = await display.fetchHourData()

console.log(fetchHour)
// Output:
// Example of Today's Hourly Prices:
  {
    region: 'SE1',
    prices: [
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object]
    ]
  }  
  // Object:
   {
      time_start: '2023-10-17T00:00:00+02:00',
      time_end: '2023-10-17T01:00:00+02:00',
      SEK_per_kWh: 0.04052,
      EUR_per_kWh: 0.00351
    }

Code Example:


// Alternatively, you can opt for a more user-friendly approach to obtain today's hourly prices for all regions.
import { ElectricityPriceTodayView } from 'swedish-electricity-prices-region/src/index.js'
const display = new ElectricityPriceTodayView()

const printHourDataToday = await display.printHourDataToday()

console.log(printHourDataToday)
// Output:
// Example of Today's Hourly Prices:

Price for Region: 0 (Norra Sverige)
Start Time: 2023-09-26 00:00:00
End Time: 2023-09-26 01:00:00
SEK_per_kWh: -0.04461
EUR_per_kWh: -0.0038


Start Time: 2023-09-26 01:00:00
End Time: 2023-09-26 02:00:00
SEK_per_kWh: -0.04732
EUR_per_kWh: -0.00403

Fetching-electricity-price-data-historical

Code Example:

import { ElectricityPriceHistoricalView } from 'swedish-electricity-prices-region/src/index.js'

const display = new ElectricityPriceHistoricalView()

const selectedDate = '2023-07-16'

const fetchDataHourHistorical = await display.fetchHistoricalHourPrice(selectedDate)

console.log(fetchDataHourHistorical)

Code Example:


// Alternatively, you can select a more convenient method to retrieve historical hourly prices for all regions on the date you've chosen.
import { ElectricityPriceHistoricalView } from 'swedish-electricity-prices-region/src/index.js'

const display = new ElectricityPriceHistoricalView()

const selectedDate = '2023-07-16'

const printDataHourHistorical = await display.printHourDataHistorical(selectedDate)

console.log(printDataHourHistorical)

Comparing-prices

Code Example:

import { ElectricityPriceHistoricalView } from 'swedish-electricity-prices-region/src/index.js'

const displayHistorical = new ElectricityPriceHistoricalView()

const compareData1 = {
  region: 'SE3',
  date: '2023-09-15'
}

const compareData2 = {
  region: 'SE1',
  date: '2023-09-16'
}

displayHistorical.compareHistoricalData(compareData1, compareData2)

Status

This project is currently in a stable state. However, there may be occasional bug fixes or minor updates.

For the latest information on the project's status, please refer to the Changelog.

Who Can Contribute

Contributions to this project are welcome! If you want to contribute, here's how you can help:

  • Report issues or bugs: Please use the Issue Tracker to report any problems or suggest improvements.
  • Contribute code: If you're interested in contributing code, feel free to fork the repository and submit a pull request with your changes.

I appreciate the support and contributions of the open-source community.

Future Plans

Future plans for this project include:

  • Enhancing the documentation to make it more accessible and informative.
  • Improving error handling and providing more informative error messages.
  • Adding more features and functionality to the project.

I'am open to feedback and suggestions. If you have any feature requests or ideas for improvements, please let me know through the Issue Tracker.

License

This project is licensed under the ISC License - see the license file for details.