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

Safety #10

Merged
merged 14 commits into from
May 10, 2019
Merged

Safety #10

merged 14 commits into from
May 10, 2019

Conversation

DavisVaughan
Copy link
Collaborator

Closes #6 by using purrr::safely() to catch any tickers that fail. If all fail, an error is thrown. Otherwise, the user is warned about the tickers that fail but the rest of the data is returned.

Example from that issue:

library(riingo)

tickers <- c("AAPL","IBM","F","BADTICKER")

riingo_prices(tickers)
#> Warning: Download failure with BADTICKER, removing. See full message below:
#> The ticker name, BADTICKER, is invalid or data is currently not available. Check ticker validity with is_supported_ticker().
#> Tiingo msg) Error: Ticker 'BADTICKER' not found
#> # A tibble: 753 x 14
#>    ticker date                close  high   low  open volume adjClose
#>    <chr>  <dttm>              <dbl> <dbl> <dbl> <dbl>  <int>    <dbl>
#>  1 AAPL   2018-05-10 00:00:00  190.  190.  188.  188. 2.80e7     187.
#>  2 AAPL   2018-05-11 00:00:00  189.  190.  187.  189. 2.62e7     186.
#>  3 AAPL   2018-05-14 00:00:00  188.  190.  188.  189. 2.08e7     186.
#>  4 AAPL   2018-05-15 00:00:00  186.  187.  185.  187. 2.37e7     184.
#>  5 AAPL   2018-05-16 00:00:00  188.  188.  186   186. 1.92e7     186.
#>  6 AAPL   2018-05-17 00:00:00  187.  189.  186.  188  1.73e7     185.
#>  7 AAPL   2018-05-18 00:00:00  186.  188.  186.  187. 1.83e7     184.
#>  8 AAPL   2018-05-21 00:00:00  188.  189.  187.  188  1.84e7     186.
#>  9 AAPL   2018-05-22 00:00:00  187.  189.  187.  188. 1.52e7     185.
#> 10 AAPL   2018-05-23 00:00:00  188.  188.  186.  186. 2.01e7     186.
#> # … with 743 more rows, and 6 more variables: adjHigh <dbl>, adjLow <dbl>,
#> #   adjOpen <dbl>, adjVolume <int>, divCash <dbl>, splitFactor <dbl>

Created on 2019-05-10 by the reprex package (v0.2.1.9000)

@DavisVaughan DavisVaughan merged commit 9c50e38 into master May 10, 2019
@DavisVaughan DavisVaughan deleted the safety branch May 10, 2019 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

riingo prices fails if there is any invalid tickers
1 participant