This function will add your FMP API key to your .Renviron file so it can be called securely without being stored in your code. After you have installed your key, it can be called any time by typing Sys.getenv('FMP_API_KEY').

fmp_api_key(key, install = TRUE, overwrite = FALSE)

Arguments

key

character. The API key acquired from 'https://financialmodelingprep.com/developer/docs/pricing/'

install

logical. If TRUE, will install the key in your .Renviron file for use in future sessions. If FALSE, key is only loaded for the current R session and will not persist when a new session is loaded. This is potentially useful if you wish to access the API from a non-personal computer. Default is TRUE.

overwrite

logical. If TRUE, overwrite any existing FMP_API_KEY that you already have in your .Renviron file.

Examples

if (FALSE) {
key <- "my_api_key"

fmp_api_key(key)

# first time, either reload your environment or restart R
# reload environment with the following
readRenviron("~/.Renviron")

# you can check it with:
Sys.getenv("FMP_API_KEY")
}