8000 FEAT: price endpoint for opennempy · opennem/opennempy@cbf62ab · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit

Permalink
FEAT: price endpoint for opennempy
Browse files Browse the repository at this point in the history
  • Loading branch information
nc9 committed Nov 2, 2021
1 parent 965ede0 commit cbf62ab
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions opennem/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,22 @@ def emission_factors(self, network_id: str) -> OpennemDataSet:
resp_object = OpennemDataSet(**resp)

return resp_object

def price(self, network_id: str) -> OpennemDataSet:
"""
Get price for a network.
:param network_id: The network code
:type network_id: str
:raises Exception: Base response
:return: The data set in OpenNEM Data Set format.
:rtype: OpennemDataSet
"""
resp = self._get(f"/stats/price/{network_id.strip().upper()}")

if not isinstance(resp, Dict):
raise Exception("Bad response type")

resp_object = OpennemDataSet(**resp)

return resp_object

0 comments on commit cbf62ab

Please sign in to comment.
0