Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/45 pass currencies explicitly #46

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)

Check warning on line 22 in R/add_portfolio_flags.R

View check run for this annotation

Codecov / codecov/patch

R/add_portfolio_flags.R#L22

Added line #L22 was not covered by tests
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.