The National Grid publishes live market information through Market Information Provision Initiative (MIPI) API. It hosts a large volume of data (over 13,500 data items)1 and is used extensively on a daily basis.
The function dataItemExplorer
calls the MIPI API and returns data from the Data Item Explorer. The first argument dataitems
is a character vector of data items where multiple values are accepted. It must match with the data items provided on the Data Item Explorer. This function also requires fromdate
and todate
which specify the date range to return data from. The return type is a data.frame
object.
The National Grid API has certain limit of the size of the query. As a result, we need to implement batch mode if the query it too large. The batchsize
argument can be configured to limit the size of each API call. It will loop through all dates iteratively and return all results.
Since the return type is a data.frame
object, users can use standard plotting packages such as ggplot2
to visualise the response.
According to the National Grid↩︎