Skip to content

switchbox-data/tariff_fetch

Repository files navigation

Tariff Fetch

Release Build status Commit activity License

A CLI tool, and python library, to simplify downloading electric and gas utility tariff data from multiple providers in a consistent data format.

Requirements

  • Python 3.11+

  • Credentials for the providers you intend to call:

    • Genability / Arcadia Data Platform: ARCADIA_APP_ID, ARCADIA_APP_KEY

      Create an account, navigate to Applications dashboard, create an application, then copy the Application ID and Key.

    • OpenEI: OPENEI_API_KEY

      Request a key at the OpenEI API signup. The key arrives by email.

    • RateAcuity Web Portal: RATEACUITY_USERNAME, RATEACUITY_PASSWORD

      There is no self-serve signup. Contact RateAcuity to request Web Portal access. No API key is required for tariff_fetch.

  • Google Chrome or Chromium installed locally (for RateAcuity)

Configuration

Populate a .env file (or export the variables manually). Only set the values you need.

ARCADIA_APP_ID=...
ARCADIA_APP_KEY=...
OPENEI_API_KEY=...
RATEACUITY_USERNAME=...
RATEACUITY_PASSWORD=...

Running CLI with uvx

If you have uv installed, you can run the cli simply with

uvx --env-file=.env --from git+https://github.com/switchbox-data/tariff_fetch tariff-fetch

Or, for gas tariffs:

uvx --env-file=.env --from git+https://github.com/switchbox-data/tariff_fetch tariff-fetch-gas

Installation

uv sync
source .venv/bin/activate

Alternative using plain pip:

python -m venv .venv
source .venv/bin/activate
pip install -e .

Running the CLI

python -m tariff_fetch.cli [OPTIONS]
python -m tariff_fetch.cli_gas [OPTIONS]

With uv:

uv run tariff-fetch [OPTIONS]
uv run tariff-fetch-gas [OPTIONS]

With Just:

just cli
just cligas

Options:

  • --state / -s: two-letter state abbreviation (default: prompt)
  • --providers / -p: (only for electricity benchmarks) repeat per provider (genability, openei, rateacuity)
  • --output-folder / -o: directory for exports (default: ./outputs)

Omitted options will trigger interactive prompts.

Examples

# Fully interactive run
uv run tariff-fetch

# Scripted run for Genability and OpenEI
uv run tariff-fetch.cli \
  --state ca \
  --providers genability \
  --providers openei \
  --output-folder data/exports

The CLI suggests filenames like outputs/openei_Utility_sector_detail-0_2024-03-18.json before writing each file so you can accept or override them.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages