MIDAS: Register a username and password

MIDASR Documentation

Register a username and password

Description

This class holds all the necessary information to maintain a connection to the API. It automatically retrieves a log-in token when necessary.

Details

MIDAS R6 class that connects to the MIDAS Rate API

Public fields

midas_url

base URL for SGIP API

Methods

Public methods


Method new()

Create a new MIDAS connection

Usage
MIDAS$new(
  username,
  password,
  email = NA_character_,
  fullname = NA_character_,
  organization = NA_character_
)
Arguments
username

atomic character Username for login

password

atomic character Password for login

email

atomic character Email address for registration. Required if registering a new account

fullname

atomic character Full name of user registering for MIDAS. Required if registering a new account

organization

atomic character organization name for registration. Not required. Only used when registering a new account.

Returns

a new MIDAS connection object.


Method print()

Print some important characteristics of the MIDAS object

Usage
MIDAS$print()

Method register()

This function registers a username and password. The CEC requires that you be registered and respond to an authentication email before obtaining an access token. You should only have to do this once.

Usage
MIDAS$register(...)
Arguments
...

Additional parameters passed to curl


Method get_token()

Get a token. This will usually be automatic when using other functions. MIDAS tokens are valid for 10 minutes according to the CEC documentation.

Usage
MIDAS$get_token(new_token = FALSE, ...)
Arguments
new_token

logical Force requesting a new token, FALSE by default

...

additional parameters passed to curl


Method value()

Get real-time or current and forecast rate information. Passing an empty RIN will return the XSD for formatting uploads.

Usage
MIDAS$value(rin, query_type = "realtime", new_token = FALSE, ...)
Arguments
rin

character Single RIN including dashes to request

query_type

character One of "realtime" or "alldata"

new_token

logical Force requesting a new token, FALSE by default

...

additional parameters passed to curl


Method rins()

Get list of available rates from MIDAS.

Usage
MIDAS$rins(signal_type = 1, new_token = FALSE, ...)
Arguments
signal_type

integer One of 0 = ALL signal types, 1 = Tariff signals, 2 = Greenhouse Gas signals, 3 = Flex Alert signals

new_token

logical Force requesting a new token, FALSE by default

...

additional parameters passed to curl


Method value_history()

Get historical rate information.

Usage
MIDAS$value_history(rin, start_date, end_date, new_token = FALSE, ...)
Arguments
rin

character Single RIN including dashes to request

start_date

character or Date or IDate Atomic date for start of period of interest

end_date

character or Date or IDate Atomic date for end of period of interest

new_token

logical Force requesting a new token, FALSE by default

...

additional parameters passed to curl


Method history_rins()

Get list of rates with history available from MIDAS.

Usage
MIDAS$history_rins(distribution_code, energy_code, new_token = FALSE, ...)
Arguments
distribution_code

atomic character Two letter code from the distribution table for the distribution company

energy_code

atomic character Two letter code from the energy table for the energy company

new_token

logical Force requesting a new token, FALSE by default

...

additional parameters passed to curl


Method lookups()

Get lookup table information. Possible lookup tables are currently Country, Daytype, Distribution, Enduse, Energy, Location, RateType, Sector, State, and Unit.

Usage
MIDAS$lookups(table_name, new_token = FALSE, ...)
Arguments
table_name

atomic character lookup table name.

new_token

logical Force requesting a new token, FALSE by default

...

additional parameters passed to curl


Method holiday()

Get holiday table information.

Usage
MIDAS$holiday(new_token = FALSE, ordered = TRUE, ...)
Arguments
new_token

logical Force requesting a new token, FALSE by default

ordered

logical Sort returned data? TRUE by default

...

additional parameters passed to curl


Method upload_rate()

Requires special CEC approval. Upload access is generally only granted to load serving entities, with rare exceptions.

Usage
MIDAS$upload_rate(filename, upload_format = "xml", verbose = FALSE, ...)
Arguments
filename

path to file with XML to upload

upload_format

character One of "json" or "xml"

verbose

logical set to TRUE for copious printed output

...

additional parameters passed to curl Upload new holidays


Method upload_holiday()

Requires special CEC approval. Upload access is generally only granted to load serving entities, with rare exceptions.

Usage
MIDAS$upload_holiday(filename, upload_format = "json", verbose = FALSE, ...)
Arguments
filename

path to file with XML to upload

upload_format

character One of "json" or "xml"

verbose

logical set to TRUE for copious printed output

...

additional parameters passed to crul options


Method clone()

The objects of this class are cloneable with this method.

Usage
MIDAS$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


stefwayland/cecmidas documentation built on Aug. 27, 2023, 2:36 p.m.