Access to marginal pool price (MPP) data. The raw report can be accessed at <http://ets.aeso.ca/ets_web/ip/Market/Reports/HistoricalSystemMarginalPriceReportServlet>.
A price at a given point in time.
Since PPoint objects will iterate over their properties t, and price, they can be unpacked:
>>> from datetime import datetime
>>> point = PPoint(datetime(2010, 2, 12, 10, 36), '4.56')
>>> t, price = point
decimal.Decimal property
datetime.datetime property
Downloads market marginal pool price data from ETS and writes it to file object dst. Unlike urlopen_marginal_pool_price there is no limit on the amount of data that can be requested. Internally an iterator is used to query data in 31 day blocks before it is written to dst. Output is included for start_date but excludes data for end_date.
Parameters: |
|
---|
New in version 0.6.
New in version 0.7: timeout parameter.
Usage example:
>>> # Standard library imports
>>> from datetime import date
>>> from datetime import timedelta
>>> try:
... # For Python 3
... from io import BytesIO
... except ImportError:
... # For Python 2.x
... from StringIO import StringIO as BytesIO
>>>
>>> # 3rd Party Libraries
>>> from aeso import mpp
>>>
>>> start_date = date(2010, 1, 1)
>>> end_date = date(2010, 1, 31) + timedelta(1)
>>> # Remember, no data will be returned on end_date itself!
>>>
>>> f = BytesIO()
>>> mpp.dump_mpp(f, start_date, end_date)
>>> text = f.getvalue()
>>> f.close()
Yields a PPoint object for each price point in marginal pool price data report file-object f. As always, times are UTC.
New in version 0.6.
Usage example:
>>> # Standard library imports
>>> from datetime import date
>>> from datetime import timedelta
>>> try:
... # For Python 3
... from io import BytesIO
... except ImportError:
... # For Python 2.x
... from StringIO import StringIO as BytesIO
>>>
>>> # 3rd Party Libraries
>>> from aeso.mpp import dump_mpp, parse_mpp_file
>>> from aeso import AB_TZ, UTC_TZ
>>>
>>> start_date = date(2010, 1, 1)
>>> end_date = date(2010, 1, 31) + timedelta(1)
>>> # Remember, no data will be returned on end_date itself!
>>>
>>> f = BytesIO()
>>> dump_mpp(f, start_date, end_date)
>>> ofs = f.seek(0)
>>>
>>> points = list(parse_mpp_file(f))
>>>
>>> for pp in points:
... # PPoint objects are iterable and can be unpacked!
... utc_dt, price = pp
... # print '%s, $%f' % (AB_TZ.normalize(utc_dt.astimezone(AB_TZ)), price)
... # *time* is in UTC, so it must be converted to Alberta
... # timezone before display.
Returns a file-like object attached to the ETS marginal pool price report. The report is limited by AESO to returning 31 days of information (2010-02-09). The report will include data for start_date but not for end_date. The earliest date for which marginal price information is available is 1999-10-01 (2010-02-10). start_date must be before end_date.
Parameters: |
|
---|---|
Return type: | file-like object as returned by urlopen. |
New in version 0.6.
New in version 0.7: timeout parameter.
Usage example:
>>> # Standard library imports
>>> from datetime import date
>>> from datetime import timedelta
>>>
>>> # 3rd Party Libraries
>>> from pyaeso.ets import urlopen_marginal_pool_price
>>>
>>> start_date = date(2010, 1, 1)
>>> end_date = date(2010, 1, 31) + timedelta(1)
>>> # If you want to include all days in january, must add 24 hours.
>>> # Remember that there will be no information returned for
>>> # *end_date* itself, only for dates prior to it!
>>>
>>> f = urlopen_marginal_pool_price(start_date, end_date)
>>> text = f.read()
>>> f.close()