Skip to content

Commit

Permalink
Fix/45 pass currencies explicitly (#46)
Browse files Browse the repository at this point in the history
Pass `currencies` object explicitly to `check_missing_currency()`

closes #45

---------

Co-authored-by: CJ Yetman <cj@cjyetman.com>
  • Loading branch information
AlexAxthelm and cjyetman authored May 16, 2024
1 parent d221800 commit ac9144f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions R/add_portfolio_flags.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
#' financial data.
#'
#' @param portfolio A data frame containing a portfolio
#' @param currencies A data frame containing ISO 4217 currency codes and their exchange
#' rates.
#'
#' @return A data frame of the portfolio with the flags columns added
#'
#' @export

add_portfolio_flags <- function(portfolio) {
add_portfolio_flags <- function(
portfolio,
currencies
) {
### FLAGS/Exclusions

portfolio <- check_isin_format(portfolio)
portfolio <- check_missing_currency(portfolio)
portfolio <- check_missing_currency(portfolio, currencies)
portfolio <- check_valid_input_value(portfolio)
portfolio <- check_financial_data(portfolio)

Expand Down
5 changes: 4 additions & 1 deletion R/check_missing_currency.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
check_missing_currency <- function(portfolio_total) {
check_missing_currency <- function(
portfolio_total,
currencies
) {
# Currency blank or not in our currency data frame
portfolio_total %>%
mutate(has_currency = case_when(
Expand Down
5 changes: 4 additions & 1 deletion man/add_portfolio_flags.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac9144f

Please sign in to comment.