MIDAS | R Documentation |
This class holds all the necessary information to maintain a connection to the API. It automatically retrieves a log-in token when necessary.
MIDAS R6 class that connects to the MIDAS Rate API
midas_url
base URL for SGIP API
new()
Create a new MIDAS connection
MIDAS$new( username, password, email = NA_character_, fullname = NA_character_, organization = NA_character_ )
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.
a new MIDAS
connection object.
print()
Print some important characteristics of the MIDAS object
MIDAS$print()
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.
MIDAS$register(...)
...
Additional parameters passed to curl
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.
MIDAS$get_token(new_token = FALSE, ...)
new_token
logical Force requesting a new token, FALSE by default
...
additional parameters passed to curl
value()
Get real-time or current and forecast rate information. Passing an empty RIN will return the XSD for formatting uploads.
MIDAS$value(rin, query_type = "realtime", new_token = FALSE, ...)
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
rins()
Get list of available rates from MIDAS.
MIDAS$rins(signal_type = 1, new_token = FALSE, ...)
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
value_history()
Get historical rate information.
MIDAS$value_history(rin, start_date, end_date, new_token = FALSE, ...)
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
history_rins()
Get list of rates with history available from MIDAS.
MIDAS$history_rins(distribution_code, energy_code, new_token = FALSE, ...)
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
lookups()
Get lookup table information. Possible lookup tables are currently Country, Daytype, Distribution, Enduse, Energy, Location, RateType, Sector, State, and Unit.
MIDAS$lookups(table_name, new_token = FALSE, ...)
table_name
atomic character lookup table name.
new_token
logical Force requesting a new token, FALSE by default
...
additional parameters passed to curl
holiday()
Get holiday table information.
MIDAS$holiday(new_token = FALSE, ordered = TRUE, ...)
new_token
logical Force requesting a new token, FALSE by default
ordered
logical Sort returned data? TRUE by default
...
additional parameters passed to curl
upload_rate()
Requires special CEC approval. Upload access is generally only granted to load serving entities, with rare exceptions.
MIDAS$upload_rate(filename, upload_format = "xml", verbose = FALSE, ...)
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
upload_holiday()
Requires special CEC approval. Upload access is generally only granted to load serving entities, with rare exceptions.
MIDAS$upload_holiday(filename, upload_format = "json", verbose = FALSE, ...)
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
clone()
The objects of this class are cloneable with this method.
MIDAS$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.