'yfR:Error in download.Error in `vec_slice()`: ! `x` must be a vector, not NULL
I am sure I have installed the latest packages include "quantomd":(devtools::install_github("joshuaulrich/quantmod", ref = "358-getsymbols-new.session")) But still fail to use yfR.I realized that the problem may be in the "quantmod" . When I use the functions of "quantmod" to get data, it will also report an error.
About fyR:
my_ticker <- 'FB'
first_date <- Sys.Date() - 30
last_date <- Sys.Date()
df_yf <- yf_get(tickers = my_ticker, first_date = first_date, last_date = last_date)
── Running yfR for 1 stocks | 2022-04-06 --> 2022-05-06 (30 days) ──
ℹ Downloading data for benchmark ticker ^GSPC
ℹ (1/1) Fetching data for FB
! - not cached
✖ - error in download..
ℹ Binding price data
Error in vec_slice()
:
! x
must be a vector, not NULL.
Run rlang::last_error()
to see where the error occurred.
Warning messages:
1: Unknown or uninitialised column: ticker
.
2: Unknown or uninitialised column: threshold_decision
.
3: Unknown or uninitialised column: ticker
.
4: Unknown or uninitialised column: price_adjusted
.
####################################################
rlang::last_error() <error/vctrs_error_scalar_type> Error in
vec_slice()
: !x
must be a vector, not NULL.
Backtrace:
- yfR::yf_get(tickers = my_ticker, first_date = first_date, last_date = last_date)
- yfR:::calc_ret(...)
- dplyr::lag(P)
- vctrs::vec_slice(inputs$x, seq_len(xlen - n))
Run
rlang::last_trace()
to see the full context. ##############################################
rlang::last_trace() <error/vctrs_error_scalar_type> Error in
vec_slice()
: !x
must be a vector, not NULL.
Backtrace: ▆
- ├─yfR::yf_get(tickers = my_ticker, first_date = first_date, last_date = last_date)
- │ └─yfR:::calc_ret(...)
- │ └─dplyr::lag(P)
- │ ├─vctrs::vec_c(...)
- │ └─vctrs::vec_slice(inputs$x, seq_len(xlen - n))
- └─vctrs:::stop_scalar_type(
<fn>
(NULL), "x",<env>
) - └─vctrs:::stop_vctrs(...)
-
└─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = vctrs_error_call(call))
About quantmod:
getSymbols("AAPL", src = "yahoo") # from yahoo financ Warning: AAPL download failed; trying again. Error in getSymbols.yahoo(Symbols = "AAPL", env = , verbose = FALSE, : Unable to import “AAPL”. AAPL download failed after two attempts. Error message: Timeout was reached: [query2.finance.yahoo.com] Operation timed out after 10005 milliseconds with 0 out of 0 bytes received
getSymbols("AAPL", src = "yahoo") # from yahoo financ Warning: AAPL download failed; trying again. Error in getSymbols.yahoo(Symbols = "AAPL", env = , verbose = FALSE, : Unable to import “AAPL”. AAPL download failed after two attempts. Error message: HTTP error 403.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|