API to access energy data
Project description
Install — Getting Started — Example Notebooks — Method Availability — LMP Data — Supported LMP Markets
gridstatus
provides a uniform Python API to electricity supply, demand, and pricing data for the major Independent System Operators (ISOs) in the United States.
Currently gridstatus
supports CAISO, SPP, ISONE, MISO, Ercot, NYISO, and PJM.
We'd love to answer any usage or data access questions! Please let us know by posting a GitHub issue.
Installation
gridstatus
supports python 3.7+. Install with pip
python -m pip install gridstatus
Upgrade using the following command
python -m pip install --upgrade gridstatus
Check current version like this
>>> import gridstatus
>>> print(gridstatus.__version__)
0.6.0
Getting Started
First, we can see all of the ISOs that are supported
>>> import gridstatus
>>> gridstatus.list_isos()
Name Id Class
0 Midcontinent ISO miso MISO
1 California ISO caiso CAISO
2 PJM pjm PJM
3 Electric Reliability Council of Texas ercot Ercot
4 Southwest Power Pool spp SPP
5 New York ISO nyiso NYISO
6 ISO New England isone ISONE
Next, we can select an ISO we want to use
>>> caiso = gridstatus.CAISO()
All ISOs have the same API. Here is how we can get the fuel mix
>>> caiso.get_latest_fuel_mix()
ISO: California ISO
Total Production: 43104 MW
Time: 2022-08-03 18:25:00-07:00
+-------------+-------+-----------+
| Fuel | MW | Percent |
|-------------+-------+-----------|
| Natural Gas | 19868 | 46.1 |
| Solar | 5388 | 12.5 |
| Imports | 4997 | 11.6 |
| Wind | 3887 | 9 |
| Large Hydro | 3312 | 7.7 |
| Nuclear | 2255 | 5.2 |
| Batteries | 1709 | 4 |
| Geothermal | 886 | 2.1 |
| Biomass | 344 | 0.8 |
| Small hydro | 234 | 0.5 |
| Biogas | 208 | 0.5 |
| Coal | 16 | 0 |
| Other | 0 | 0 |
+-------------+-------+-----------+
or the energy demand throughout the current day as a Pandas DataFrame
>>> caiso.get_load_today()
Time Load
0 2022-08-03 00:00:00-07:00 30076.0
1 2022-08-03 00:05:00-07:00 29966.0
2 2022-08-03 00:10:00-07:00 29893.0
3 2022-08-03 00:15:00-07:00 29730.0
4 2022-08-03 00:20:00-07:00 29600.0
.. ... ...
219 2022-08-03 18:15:00-07:00 41733.0
220 2022-08-03 18:20:00-07:00 41690.0
221 2022-08-03 18:25:00-07:00 41718.0
222 2022-08-03 18:30:00-07:00 41657.0
223 2022-08-03 18:35:00-07:00 41605.0
[224 rows x 2 columns]
we can get today's supply in the same way
>>> caiso.get_supply_today()
Time Supply
0 2022-08-03 00:00:00-07:00 31454
1 2022-08-03 00:05:00-07:00 31366
2 2022-08-03 00:10:00-07:00 30985
3 2022-08-03 00:15:00-07:00 30821
4 2022-08-03 00:20:00-07:00 30667
.. ... ...
220 2022-08-03 18:20:00-07:00 43096
221 2022-08-03 18:25:00-07:00 43104
222 2022-08-03 18:30:00-07:00 43013
223 2022-08-03 18:35:00-07:00 42885
224 2022-08-03 18:40:00-07:00 42875
[225 rows x 2 columns]
Another dataset we can query is the load forecast
>>> nyiso = gridstatus.NYISO()
>>> nyiso.get_forecast_today()
Forecast Time Time Load Forecast
0 2022-08-19 00:00:00-04:00 2022-08-19 00:00:00-04:00 17078
1 2022-08-19 00:00:00-04:00 2022-08-19 01:00:00-04:00 16260
2 2022-08-19 00:00:00-04:00 2022-08-19 02:00:00-04:00 15631
3 2022-08-19 00:00:00-04:00 2022-08-19 03:00:00-04:00 15252
4 2022-08-19 00:00:00-04:00 2022-08-19 04:00:00-04:00 15195
.. ... ... ...
139 2022-08-19 00:00:00-04:00 2022-08-24 19:00:00-04:00 24340
140 2022-08-19 00:00:00-04:00 2022-08-24 20:00:00-04:00 23624
141 2022-08-19 00:00:00-04:00 2022-08-24 21:00:00-04:00 22585
142 2022-08-19 00:00:00-04:00 2022-08-24 22:00:00-04:00 21137
143 2022-08-19 00:00:00-04:00 2022-08-24 23:00:00-04:00 19717
[144 rows x 3 columns]
When supported, you can use the historical method calls to get data for a specific day in the past. For example,
>>> caiso.get_historical_load("Jan 1, 2020")
Time Load
0 2020-01-01 00:00:00-08:00 21533
1 2020-01-01 00:05:00-08:00 21429
2 2020-01-01 00:10:00-08:00 21320
3 2020-01-01 00:15:00-08:00 21272
4 2020-01-01 00:20:00-08:00 21193
.. ... ...
284 2020-01-01 23:40:00-08:00 20383
285 2020-01-01 23:45:00-08:00 20297
286 2020-01-01 23:50:00-08:00 20242
287 2020-01-01 23:55:00-08:00 20128
288 2020-01-01 00:00:00-08:00 20025
[289 rows x 2 columns]
Frequently, we want to get data across multiple days. We can do that by providing a start
and end
parameter to any iso.get_historical_*
method
>>> caiso.get_historical_load(start="Jan 1, 2020", end="Feb 1, 2020")
Time Load
0 2020-01-01 00:00:00-08:00 21533
1 2020-01-01 00:05:00-08:00 21429
2 2020-01-01 00:10:00-08:00 21320
3 2020-01-01 00:15:00-08:00 21272
4 2020-01-01 00:20:00-08:00 21193
... ... ...
8923 2020-01-31 23:35:00-08:00 21905
8924 2020-01-31 23:40:00-08:00 21773
8925 2020-01-31 23:45:00-08:00 21674
8926 2020-01-31 23:50:00-08:00 21540
8927 2020-01-31 23:55:00-08:00 21425
[8928 rows x 2 columns]
The best part is these APIs work in the same way across all the supported ISOs!
Examples
Here is a list of our current example notebooks. If you have any requests, please post an issue and we'd be happy to publish more!
Method Availability
Here is the current status of availability of each method for each ISO
New York ISO | California ISO | Electric Reliability Council of Texas | ISO New England | Midcontinent ISO | Southwest Power Pool | PJM | |
---|---|---|---|---|---|---|---|
get_latest_status |
✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
get_latest_fuel_mix |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
get_latest_load |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
get_latest_supply |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
get_fuel_mix_today |
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
get_load_today |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
get_forecast_today |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
get_supply_today |
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
get_storage_today |
❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
get_historical_fuel_mix |
✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ |
get_historical_load |
✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ |
get_historical_forecast |
✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
get_historical_supply |
✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ |
get_historical_storage |
❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
LMP Pricing Data
We are currently adding Locational Marginal Price (LMP). Even though each BA offers different markets, but you can query them with a standardized API
>>> import gridstatus
>>> nyiso = gridstatus.NYISO()
>>> nyiso.get_lmp_today("REAL_TIME_5_MIN", locations="ALL")
Time Market Location Location Type LMP Energy Congestion Loss
0 2022-08-16 00:05:00-04:00 REAL_TIME_5_MIN CAPITL Zone 70.88 66.65 1.10 5.33
1 2022-08-16 00:05:00-04:00 REAL_TIME_5_MIN CENTRL Zone 68.91 66.64 0.00 2.27
2 2022-08-16 00:05:00-04:00 REAL_TIME_5_MIN DUNWOD Zone 75.44 66.65 -1.26 7.53
3 2022-08-16 00:05:00-04:00 REAL_TIME_5_MIN GENESE Zone 68.64 66.64 0.00 2.00
4 2022-08-16 00:05:00-04:00 REAL_TIME_5_MIN H Q Zone 64.58 66.65 0.00 -2.07
... ... ... ... ... ... ... ... ...
3370 2022-08-16 20:15:00-04:00 REAL_TIME_5_MIN NORTH Zone 85.57 87.85 0.00 -2.28
3371 2022-08-16 20:15:00-04:00 REAL_TIME_5_MIN NPX Zone 78.73 87.85 15.36 6.24
3372 2022-08-16 20:15:00-04:00 REAL_TIME_5_MIN O H Zone 85.48 87.85 0.00 -2.37
3373 2022-08-16 20:15:00-04:00 REAL_TIME_5_MIN PJM Zone 94.45 87.85 -1.86 4.74
3374 2022-08-16 20:15:00-04:00 REAL_TIME_5_MIN WEST Zone 87.85 87.85 0.00 0.00
[3375 rows x 8 columns]
And here is querying CAISO
>>> import gridstatus
>>> caiso = gridstatus.CAISO()
>>> caiso.get_lmp_today('DAY_AHEAD_HOURLY', locations=["TH_NP15_GEN-APND", "TH_SP15_GEN-APND", "TH_ZP26_GEN-APND"])
LMP_TYPE Time Market Location Location Type LMP Energy Congestion Loss
0 2022-08-16 00:00:00-07:00 DAY_AHEAD_HOURLY TH_NP15_GEN-APND None 89.48766 95.51493 -0.1531 -5.87417
1 2022-08-16 00:00:00-07:00 DAY_AHEAD_HOURLY TH_SP15_GEN-APND None 94.02489 95.51493 0.0000 -1.49003
2 2022-08-16 00:00:00-07:00 DAY_AHEAD_HOURLY TH_ZP26_GEN-APND None 90.57680 95.51493 0.0000 -4.93812
3 2022-08-16 01:00:00-07:00 DAY_AHEAD_HOURLY TH_NP15_GEN-APND None 86.38892 92.12283 -0.0223 -5.71162
4 2022-08-16 01:00:00-07:00 DAY_AHEAD_HOURLY TH_SP15_GEN-APND None 90.94366 92.12283 0.0000 -1.17917
.. ... ... ... ... ... ... ... ...
67 2022-08-16 22:00:00-07:00 DAY_AHEAD_HOURLY TH_SP15_GEN-APND None 131.45525 135.43710 0.0000 -3.98185
68 2022-08-16 22:00:00-07:00 DAY_AHEAD_HOURLY TH_ZP26_GEN-APND None 127.04000 135.43710 0.0000 -8.39710
69 2022-08-16 23:00:00-07:00 DAY_AHEAD_HOURLY TH_NP15_GEN-APND None 107.36120 113.91108 0.0000 -6.54989
70 2022-08-16 23:00:00-07:00 DAY_AHEAD_HOURLY TH_SP15_GEN-APND None 111.22278 113.91108 0.0000 -2.68830
71 2022-08-16 23:00:00-07:00 DAY_AHEAD_HOURLY TH_ZP26_GEN-APND None 108.01049 113.91108 0.0000 -5.90059
[72 rows x 8 columns]
You can see what markets are available by accessing the markets
property of an iso. For, example
>>> caiso.markets
[<Markets.REAL_TIME_15_MIN: 'REAL_TIME_15_MIN'>, <Markets.REAL_TIME_HOURLY: 'REAL_TIME_HOURLY'>, <Markets.DAY_AHEAD_HOURLY: 'DAY_AHEAD_HOURLY'>]
The possible lmp query methods are ISO.get_latest_lmp
, ISO.get_lmp_today
, and ISO.get_historical_lmp
.
Supported LMP Markets
Markets | |
---|---|
Midcontinent ISO | REAL_TIME_5_MIN , DAY_AHEAD_HOURLY |
California ISO | REAL_TIME_15_MIN , REAL_TIME_HOURLY , DAY_AHEAD_HOURLY |
PJM | REAL_TIME_5_MIN , REAL_TIME_HOURLY , DAY_AHEAD_HOURLY |
Electric Reliability Council of Texas | |
Southwest Power Pool | |
New York ISO | REAL_TIME_5_MIN , DAY_AHEAD_HOURLY |
ISO New England | REAL_TIME_5_MIN , REAL_TIME_HOURLY , DAY_AHEAD_HOURLY |
Related projects
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gridstatus-0.0.0.tar.gz
.
File metadata
- Download URL: gridstatus-0.0.0.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc3a948042b1a42e1dc31fa02b80d2e101b8cfcd15bb0fd2c77495386f5c9f38 |
|
MD5 | e1d18416a3689a5bc41a7eda971e313b |
|
BLAKE2b-256 | fb31b3080fb45b9ff0db65711ab324e3dc85d2de6b1572ed286d5ec9c38a3db5 |
File details
Details for the file gridstatus-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: gridstatus-0.0.0-py3-none-any.whl
- Upload date:
- Size: 42.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd1de2b30b8f0b761ad37219bc1fed89ffe2945fac7c75d4956ba0211ebcb5f6 |
|
MD5 | 69671516549f889258660b4336f21d49 |
|
BLAKE2b-256 | ab7c1bf9edfa26ee9988937ec8cde8c75bcbc1e4ac1fda8f13dc7712828230fd |