Title: | Access to RFR (Risk-Free Rate) Curves Produced by the EIOPA |
Version: | 0.1.1 |
Description: | Provides EIOPA (European Insurance And Occupational Pensions Authority) risk-free rates. Please note that the author of this package is not affiliated with EIOPA. The data is accessed through a REST API available at https://mehdiechchelh.com/api/. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
Imports: | httr, jsonlite, curl, |
RoxygenNote: | 7.1.1 |
Collate: | 'const.R' 'api.R' 'eiopaR.R' 'utils.R' |
Suggests: | testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2021-05-31 06:11:26 UTC; mehdi.echchelh |
Author: | Mehdi Echchelh [aut, cre] |
Maintainer: | Mehdi Echchelh <mehdi.echel@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2021-05-31 07:20:12 UTC |
Base URL to the API.
Description
Base URL to the API.
Usage
API_BASE_URL()
Value
A string: the base URL to the API.
Build path to the options endpoint.
Description
Build path to the options endpoint.
Usage
PATH_GET_OPTIONS(field)
Arguments
field |
the field name for the endpoint giving the available options |
Value
A string: the path to the options endpoint.
Build path to the RFR (risk-free rate) endpoint.
Description
Build path to the RFR (risk-free rate) endpoint.
Usage
PATH_GET_RFR(type, region, params)
Arguments
type |
one of the types available by the API (see |
region |
one of the regions available by the API (see |
params |
additional GET parameters |
Value
A string: the path to the RFR endpoint.
This function is a helper to make get requests to the API.
Description
This function is a helper to make get requests to the API.
Usage
api_get(path)
Arguments
path |
the path to an endpoint of the API |
Value
A list of class "eiopaR_api". It has at least the following components:
- content
the JSON content parsed to a list.
- path
the path to the requested endpoint.
- response
the raw response.
Options available
Description
Returns the available options for a specific field.
Usage
get_options(field)
Arguments
field |
a string like "region", "year" or "month" |
Value
A vector of type "character": the list of the available options for field
.
Examples
## Not run:
get_options("region")
## End(Not run)
Query EIOPA risk-free rate (RFR).
Description
This function query and returns the EIOPA risk-free interest rate term structures from an API.
Note: this function is getting the data from an API. Your IP can be temporary or permanently blocked if too many queries are executed.
For optimal performance, we recommend to limit the number of calls to this function.
EIOPA website : https://www.eiopa.europa.eu/tools-and-data/risk-free-interest-rate-term-structures_en
Usage
get_rfr(
type = options_rfr_types(),
region,
year = NULL,
month = NULL,
format = c("data.frame")
)
Arguments
type |
the type of the risk-free rate, see |
region |
the region to query (examples: "FR". see |
year |
the year of the RFR. |
month |
the month of the RFR. |
format |
the format for the output data. Currently the only option is "data.frame". |
Value
A list of class "eiopa_rfr", with components:
- data
a data.frame containing the risk-free rate curves.
- metadata
a data.frame containing metadata about the risk-free rate curves.
See Also
get_rfr_with_va, get_rfr_no_va
Examples
## Not run:
get_rfr("with_va", "FR", 2019, 12)
get_rfr("no_va", "FR", c(2016, 2019), 12)
## End(Not run)
Query EIOPA RFR without volatility adjustment
Description
This function query and returns the EIOPA risk-free interest rate term structures from an API.
Note: this function is getting the data from an API. Your IP can be temporary or permanently blocked if too many queries are executed.
For optimal performance, we recommend to limit the number of calls to this function.
EIOPA website : https://www.eiopa.europa.eu/tools-and-data/risk-free-interest-rate-term-structures_en
Usage
get_rfr_no_va(region, year = NULL, month = NULL, format = c("data.frame"))
Arguments
region |
the region to query (examples: "FR". see |
year |
the year of the RFR. |
month |
the month of the RFR. |
format |
the format for the output data. Currently the only option is "data.frame". |
Value
A list of class "eiopa_rfr", with at least the following components:
- data
a data.frame containing the risk-free rate curves.
- metadata
a data.frame containing metadata about the risk-free rate curves.
See Also
get_rfr, get_rfr_with_va
Examples
## Not run:
get_rfr_no_va("FR", 2019, 12)
get_rfr_no_va("BE", 2020, 11)
## End(Not run)
Query EIOPA RFR with volatility adjustment.
Description
This function query and returns the EIOPA risk-free interest rate term structures from an API.
Note: this function is getting the data from an API. Your IP can be temporary or permanently blocked if too many queries are executed.
For optimal performance, we recommend to limit the number of calls to this function.
EIOPA website : https://www.eiopa.europa.eu/tools-and-data/risk-free-interest-rate-term-structures_en
Usage
get_rfr_with_va(region, year = NULL, month = NULL, format = c("data.frame"))
Arguments
region |
the region to query (examples: "FR". see |
year |
the year of the RFR. |
month |
the month of the RFR. |
format |
the format for the output data. Currently the only option is "data.frame". |
Value
A list of class "eiopa_rfr", with components:
- data
a data.frame containing the risk-free rate curves.
- metadata
a data.frame containing metadata about the risk-free rate curves.
See Also
get_rfr, get_rfr_no_va
Examples
## Not run:
get_rfr_with_va("FR", 2019, 12)
get_rfr_with_va("BE", 2020, 11)
## End(Not run)
Available curves
Description
This function returns a list of the available options for the risk-free-rates curves.
(see argument "type" for get_rfr
)
Usage
options_rfr_types()
Value
vector of strings: the different options available.
See Also
get_rfr
Examples
options_rfr_types()
Parse the risk free rates API response
Description
This function is used to parse data received from the API to various formats.
Usage
parse_rfr(resp, format)
Arguments
resp |
A response from the API (status 200, type/JSON). The response should have a "data" keyword with the value of an array containing the risk free rates. |
format |
One of the output format ("data.frame" is currently the only option). |
Value
A list of class "eiopa_rfr", with at least the following components:
- data
a data.frame containing the risk-free rate curves.
- metadata
a data.frame containing metadata about the risk-free rate curves.
Parse the risk free rates API response into a dataframe
Description
This function is used to parse data received from the API into data.frame.
Usage
parse_rfr_to_df(resp)
Arguments
resp |
A response from the API (status 200, type/JSON). The response should have a "data" keyword with the value of an array containing the risk free rates. |
Value
A list of class "eiopa_rfr", with at least the following components:
- data
a data.frame containing the risk-free rate curves.
- metadata
a data.frame containing metadata about the risk-free rate curves.
Print eiopa_rfr object
Description
Print eiopa_rfr object in a readable format
Usage
## S3 method for class 'eiopa_rfr'
print(x, ...)
Arguments
x |
a response from the API |
... |
further arguments passed to or from other methods. |
Value
An instance of class "eiopa_rfr". It is a list with at least the following components:
- data
a data.frame containing the risk-free rate curves.
- metadata
a data.frame containing metadata about the risk-free rate curves.
Examples
## Not run:
resp <- get_rfr_with_va("FR", 2019, 11)
print(resp)
## End(Not run)
Wrapper for GET requests
Description
Wrapper for GET requests
Usage
try_GET(x, ...)
Arguments
x |
the url to request |
... |
additional parameters passed to the GET function. |
Value
The result of the GET request.