Skip to main content

A library to interface with the Octopus Agile API

Project description

OctopusAgile

Init with the region code (Don't include the _) as per: https://en.wikipedia.org/wiki/Distribution_network_operator

Referral code

Feel free to use my referral code and get £50 credit to your account (as well as mine): https://share.octopus.energy/lilac-bison-793

Methods

Time format

All time formats are "%Y-%m-%dT%H:%M:%SZ" e.g. 2020-04-16T06:00:00Z

get_raw_rates(date_from, date_to)

Returns the raw data as given to us by the API

get_rates(date_from, date_to)

Returns a dict of:

  • date_rate (dict): Dict of date/time as key and rate as vaue
  • rate_list (list): All Rates as a list
  • low_rate_list (list): All Rates below 15p

get_rates_delta(day_delta)

Returns the same dict as get_rate for the past "day_delta" days

get_sumary(days, daily_sum=False)

Print a summary of the rates for the past "days" days

get_min_time_run(hours, in_d)

Get a date_rate dict of the cheapest time period of "hours" hours.

in_d is a date_rate dict.

get_times_below(in_d, limit)

Get a date_rate dict of any times below "limit"

in_d is a date_rate dict.

get_min_times(num, in_d, requirements)

Get a date rate dict of "num" number of time periods in in_d.

in_d is a date_rate dict.

Requirements a list of dicts with details of particular times that must be includes in the returned date_rate dict.

Example, must have 2 slots between 1900 and 0600: {'slots': 2, 'time_from': '2020-04-15T19:00:00Z', 'time_to': '2020-04-16T06:00:00Z'}

get_area_code()

Return the area code that is being used

get_new_rates()

Return all available future rates

get_previous_rate()

Return the previous period rate

get_current_rate()

Return the current period rate

get_next_rate()

Return the next period rate

get_max_times(num, in_d)

Get a date_rate dict of "num" number of max periods

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

OctopusAgile-0.0.6.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file OctopusAgile-0.0.6.tar.gz.

File metadata

  • Download URL: OctopusAgile-0.0.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0

File hashes

Hashes for OctopusAgile-0.0.6.tar.gz
Algorithm Hash digest
SHA256 0d8385a5507f3f40bf27d04fae6dd0027171044ec851859be89a63c245a9d67d
MD5 ec72e244428d15e56f2f37d57e184c0d
BLAKE2b-256 2ec1941a93462d1df7c3fe49dea11803ad3e63f5399ed32ad1fad121260c6139

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page