This vignette explains the functions offered by
'financr'.
Overview
Source. Yahoo Finance is used consistently as a data source across the package.
Inputs. Each function expects a specific type of input, based on its prefix.
| Prefix | Example | Expected_input |
|---|---|---|
| search_ | search_assets('Saab') |
Free-text(s) |
| get_ | get_historic('^DJI') |
Financial symbol(s) such as a ticker symbol1 (e.g., ‘AAPL’) or ISO 3-letter currency code2 (e.g., ‘USD’) |
| last_ | last_indices() |
Do not require any input. All arguments are optional |
Outputs. All the 'financr' functions
return a standardized data.frame, see the last section ‘Return Conventions’.
Functions with the '_historic' suffix return an historic
of financial data, while the others retrieve latest financial data.
Details
search_ family.
| Example | Returned data.frame
|
|---|---|
search_assets('Saab', get_values = T) |
Assets names, ticker symbols, latest insights and financial values |
search_assets('Saab') |
Assets names and symbol(s) associated with the texts searched |
search_assets_quick('Saab') |
Assets names and symbol(s) associated with the text searched |
- Source : Yahoo Finance API (https://query2.finance.yahoo.com)
get_ family.
| Example | Input | Returned data.frame
|
|---|---|---|
get_historic('SDV1.F') & get_historic_light('SDV1.F')
|
Asset symbol(s), such as ticker symbols | Historic of financial data |
get_values('SDV1.F') |
Asset symbol(s) | Latest insights and financial values |
get_similar('SDV1.F') |
Asset symbol(s) | Latest symbols associated with those provided and similarity scores |
get_changes('USD', 'EUR') |
ISO currency code(s) | Latest exchanges rates |
get_changes_historic('USD', 'EUR') |
ISO currency code(s) | Historic of exchanges rates |
- Source : Yahoo Finance API (https://query2.finance.yahoo.com)
last_ family.
| Example | data.frame_returned |
|---|---|
last_market_summary() |
Latest summary information for a set of major financial market indices* |
last_indices() |
World indices latest insights and values (USD)‡ |
last_currencies() |
ISO currency codes for currencies, names and (optionally) latest values* (USD) |
last_crypto() |
100 major crypto-currencies latest insights and values (USD)‡ |
* : Retrieve latest data from Yahoo Finance API (https://query2.finance.yahoo.com)
‡ : Scraping latest data from Yahoo Finance pages, i.e. https://finance.yahoo.com/markets/world-indices/ or […]/markets/crypto
See the vignette of the ‘last_’ functions.
vignette("last_family", package = "financr")
Other function.
| Example | Input | Data.frame_returned |
|---|---|---|
valid_symbol("SAABF") |
Text(s) to verify | (logical values) Validity of financial symbol(s) |
- Source : Yahoo Finance API (https://query2.finance.yahoo.com)
Return Conventions
Regarding a data.frame returned by
'financr' functions, the column names are:
- following the ‘snake_case’ conventions3, e.g., in lowercase and without spaces;
- and symbols are replaced (e.g., “%’ is replaced by ‘percent’).
