Isone Api
===================

.. py:module:: isone_api


Module Contents
---------------

Classes Summary
~~~~~~~~~~~~~~~

.. autoapisummary::

   isone_api.ISONEAPI





Attributes Summary
~~~~~~~~~~~~~~~~~~~

.. autoapisummary::

   isone_api.DEFAULT_PAGE_SIZE
   isone_api.EXCLUDE_FROM_REALTIME_HOURLY_DEMAND
   isone_api.ZONE_LOCATIONID_MAP


Contents
~~~~~~~~~~~~~~~~~~~
.. py:data:: DEFAULT_PAGE_SIZE
   :value: 1000

   

.. py:data:: EXCLUDE_FROM_REALTIME_HOURLY_DEMAND
   :value: ['NEPOOL AREA', '.H.INTERNALHUB']

   

.. py:class:: ISONEAPI(sleep_seconds: float = 5, max_retries: int = 3)

   Class to authenticate with and make requests to the ISO New England API.

   To authenticate, you need a username and password.

   To register, create an account here: https://www.iso-ne.com/participate/applications-status-changes/access-software-systems#ws-api


   **Attributes**

   .. list-table::
      :widths: 15 85
      :header-rows: 0

      * - **default_timezone**
        - US/Eastern


   **Methods**

   .. autoapisummary::
      :nosignatures:

      isone_api.ISONEAPI.get_dayahead_hourly_demand
      isone_api.ISONEAPI.get_fuel_mix
      isone_api.ISONEAPI.get_hourly_load_forecast
      isone_api.ISONEAPI.get_load_hourly
      isone_api.ISONEAPI.get_location_by_id
      isone_api.ISONEAPI.get_locations
      isone_api.ISONEAPI.get_locations_all
      isone_api.ISONEAPI.get_realtime_hourly_demand
      isone_api.ISONEAPI.get_reliability_region_load_forecast
      isone_api.ISONEAPI.make_api_call
      isone_api.ISONEAPI.parse_problematic_datetime

   .. py:method:: get_dayahead_hourly_demand(date: str | pandas.Timestamp = 'latest', end: str | pandas.Timestamp | None = None, locations: list[str] = None, verbose: bool = False) -> pandas.DataFrame

      Get the day-ahead hourly demand data for specified locations and date range.

      :param date: The start date for the data request. Use "latest" for most recent data.
      :type date: str
      :param end_date: The end date for the data request. Only used if date is not "latest".
      :type end_date: str | None
      :param locations: List of specific location names to request data for.
                        If None, data for all locations will be retrieved.
      :type locations: list[str], optional

      :returns: A DataFrame containing the day-ahead hourly demand data for all requested locations.
      :rtype: pandas.DataFrame


   .. py:method:: get_fuel_mix(date: str | pandas.Timestamp = 'latest', end: str | pandas.Timestamp | None = None, verbose: bool = False) -> pandas.DataFrame

      Return fuel mix data for the specified date range

      :param date: The start date for the data request. Use "latest" for most recent data.
      :type date: str | pd.Timestamp
      :param end: The end date for the data request. Only used if date is not "latest".
      :type end: str | pd.Timestamp | None
      :param verbose: Whether to print verbose logging information.
      :type verbose: bool

      :returns: DataFrame containing fuel mix data with timestamps and generation by fuel type
      :rtype: pd.DataFrame


   .. py:method:: get_hourly_load_forecast(date: str | pandas.Timestamp = 'latest', end: str | pandas.Timestamp | None = None, vintage: Literal[latest, all] = 'all', verbose: bool = False) -> pandas.DataFrame

      Get the hourly load forecast data for specified locations and date range.

      NB: ISO NE publishes load forecasts roughly every 30 minutes for the next 48-72 future intervals.
      Getting all forecasts (all "vintages") can be a lot of data, potentially thousands of rows for a single day.
      Sometimes you may want this, and that's why ISO NE provides the option to get all vintages, but you may be most interested
      in the most recent forecast for a given historical interval, essentially the shortest vintages, most
      accurate forecast, which they also provide. All vintages is typically 5x to 20x more data than latest,
      so it's something to consider when making a request.

      Giving the option for just the "latest" forecast (aka shortest horizon, aka most recent publish time/vintage)
      for a given historical interval avoids this large data pull and collation since ISO NE API
      has done that work for you already.

      :param date: The start date for the data request. Use "latest" for most recent data.
      :type date: str
      :param end_date: The end date for the data request. Only used if date is not "latest".
      :type end_date: str | None
      :param vintage: The vintage for the data request. Options are "latest" or "all", defaults to "all".
      :type vintage: Literal["latest", "all"]

      :returns: A DataFrame containing the hourly load forecast data for the system.
      :rtype: pandas.DataFrame


   .. py:method:: get_load_hourly(date: str | pandas.Timestamp, end: str | pandas.Timestamp = None, verbose: bool = False) -> pandas.DataFrame

      Return hourly load data for a given date or date range

      :param date: The start date for the data request. Use "latest" for most recent data.
      :type date: str | pd.Timestamp
      :param end: The end date for the data request. Only used if date is not "latest".
      :type end: str | pd.Timestamp, optional
      :param locations: List of specific location names to request data for.
                        If None, data for all locations will be retrieved.
      :type locations: list[str], optional
      :param verbose: Whether to print verbose logging information.
      :type verbose: bool, optional

      :returns: DataFrame containing load data with timestamps and load
      :rtype: pd.DataFrame


   .. py:method:: get_location_by_id(location_id: int) -> pandas.DataFrame

      Get information for a specific location by its ID.

      :param location_id: The ID of the location to retrieve.
      :type location_id: int

      :returns: A DataFrame containing the location information.
      :rtype: pandas.DataFrame


   .. py:method:: get_locations() -> pandas.DataFrame

      Get a list of core hub and zone locations.

      :returns: A DataFrame containing location information.
      :rtype: pandas.DataFrame


   .. py:method:: get_locations_all() -> pandas.DataFrame

      Get detailed information for all locations.

      :returns: A DataFrame containing detailed information for all locations.
      :rtype: pandas.DataFrame


   .. py:method:: get_realtime_hourly_demand(date: str | pandas.Timestamp = 'latest', end: str | pandas.Timestamp | None = None, locations: list[str] = None, verbose: bool = False) -> pandas.DataFrame

      Get the real-time hourly demand data for specified locations and date range.

      :param date: The start date for the data request. Use "latest" for most recent data.
      :type date: str
      :param end_date: The end date for the data request. Only used if date is not "latest".
      :type end_date: str | None
      :param locations: List of specific location names to request data for.
                        If None, data for all locations will be retrieved.
      :type locations: list[str], optional

      :returns: A DataFrame containing the real-time hourly demand data for all requested locations.
      :rtype: pandas.DataFrame


   .. py:method:: get_reliability_region_load_forecast(date: str | pandas.Timestamp = 'latest', end: str | pandas.Timestamp | None = None, vintage: Literal[latest, all] = 'all', verbose: bool = False) -> pandas.DataFrame

      Get the regional load forecast data for specified date range and vintages.

      :param date: The start date for the data request. Use "latest" for most recent data.
      :type date: str
      :param end: The end date for the data request. Only used if date is not "latest".
      :type end: str | None
      :param vintages: The vintage for the data request. Options are "latest" or "all".
      :type vintages: Literal["latest", "all"]

      :returns: A DataFrame containing the regional load forecast data for all requested locations.
      :rtype: pandas.DataFrame


   .. py:method:: make_api_call(url: str, api_params: dict = None, parse_json: bool = True, verbose: bool = False)


   .. py:method:: parse_problematic_datetime(date_string: str | pandas.Timestamp) -> datetime.datetime



.. py:data:: ZONE_LOCATIONID_MAP

   

