stateprice

package
v0.41.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package stateprice is a dated, cited table of US average residential electricity prices by state. The guided setup offers a state's average as a one-tap default for the home rate (charging.home_price_source = state_average); the user can always type their own.

The table is the U.S. Energy Information Administration's Electric Power Monthly, Table 5.6.B (average price of electricity to ultimate customers by end-use sector, by state), residential column, year to date. It is refreshed by a pull request: copy the new residential column, bump Period, Released and Checked, and the tests check the shape. Nothing is fetched at run time.

Index

Constants

This section is empty.

Variables

View Source
var Table = Source{
	Name:     "U.S. EIA, Electric Power Monthly, Table 5.6.B: average price to ultimate customers, residential, year to date",
	URL:      "https://www.eia.gov/electricity/monthly/epm_table_grapher.php?t=epmt_5_6_b",
	Period:   "January to August 2026",
	Released: "2026-10-23",
	Checked:  "2026-11-13",
}

Table is the source of the numbers below.

Functions

func Len

func Len() int

Len is the number of states in the table (50 states and DC).

Types

type Price

type Price struct {
	State       string  `json:"state"` // two-letter code
	Name        string  `json:"name"`
	PricePerKWh float64 `json:"price_per_kwh"`
	Currency    string  `json:"currency"`
	Source      Source  `json:"source"`
}

Price is a state's average residential price in US dollars per kWh.

func Lookup

func Lookup(state string) (Price, bool)

Lookup finds a state by its two-letter code or its full name, any case. It reports false for anything else (other countries, territories, a blank). PricePerKWh is US dollars per kWh, as published to the hundredth of a cent.

type Source

type Source struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	Period   string `json:"period"`
	Released string `json:"released"` // the date EIA published the table
	Checked  string `json:"checked"`  // the date the numbers were copied here
}

Source describes where the table comes from and how fresh it is.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL