A CLI tool, and python library, to simplify downloading electric and gas utility tariff data from multiple providers in a consistent data format.
- Github repository: https://github.com/switchbox-data/tariff_fetch/
- Documentation: https://switchbox-data.github.io/tariff_fetch/
- PyPI page: https://pypi.org/project/tariff_fetch/
-
Python 3.11+
-
Credentials for the providers you intend to call:
-
Genability / Arcadia Data Platform:
ARCADIA_APP_ID,ARCADIA_APP_KEYCreate an account, navigate to Applications dashboard, create an application, then copy the Application ID and Key.
-
OpenEI:
OPENEI_API_KEYRequest a key at the OpenEI API signup. The key arrives by email.
-
RateAcuity Web Portal:
RATEACUITY_USERNAME,RATEACUITY_PASSWORDThere 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)
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=...
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-fetchOr, for gas tariffs:
uvx --env-file=.env --from git+https://github.com/switchbox-data/tariff_fetch tariff-fetch-gasuv sync
source .venv/bin/activateAlternative using plain pip:
python -m venv .venv
source .venv/bin/activate
pip install -e .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 cligasOptions:
--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.
# 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/exportsThe 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.