bmrsIndoItsdo: BMRS Initial Demand Outturn API Service

Description Usage Arguments Details Value Author(s) References Examples

View source: R/bmrsIndoItsdo.R

Description

This function connects to the Elexon's BMRS API to retrieve Initial Demand Outturn (INDO) and Initial Transmission System Demand Out-Turn (ITSDO) data. Internet connection must be available.

Usage

1
2
3
4
5
6
7
bmrsIndoItsdo(
  fromdate,
  todate,
  apikey,
  batchsize = 60,
  apiurl = "https://api.bmreports.com/BMRS/INDOITSDO/v1"
)

Arguments

fromdate

A character object specifying the start date. Date is inclusive.

todate

A character object specifying the end date. Date is inclusive.

apikey

A character object specifying the API key. This is also known as scripting key on Elexon's website.

batchsize

An interger value indicating the batch size of each API call. (Number of days included in one call)

apiurl

A character object which points to the BMRS INDO/ITSDO API. Under most circumstances users do not have to change this. Default to 'https://api.bmreports.com/BMRS/INDOITSDO/v1'

Details

The function submits a request to the API. The response is in CSV format which function will parse internally and returns a R dataframe object. The data returned by this API is identical to the data displayed on BMRS dashboard https://www.bmreports.com/bmrs/?q=demand/initialdemandoutturn.

Value

A dataframe object containing API response data.

Author(s)

Timothy Wong, timothy.wong@hotmail.co.uk

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# Invoke the API (requires internet connection at this step)
response <- bmrsIndoItsdo(fromdate = "2020-01-01",
                          todate =  "2020-01-10",
                          apikey = "your api key goes here")

# Visualise the results on a chart
library(ggplot2)
ggplot(response, aes(x=publishtime, y=value,colour=recordtype)) +
  geom_line()

## End(Not run)

ukgasapi documentation built on Jan. 13, 2021, 3:17 p.m.