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

Row mismatch #3

Closed
inoddy opened this issue Aug 3, 2023 · 5 comments
Closed

Row mismatch #3

inoddy opened this issue Aug 3, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@inoddy
Copy link

inoddy commented Aug 3, 2023

nz50 = Index$new('^NZ50')
nz = nz50$get_history(start = '2003-01-03', interval = '1d')

produces

Error in $<-.data.frame(*tmp*, adj_close, value = c(1954.9599609375, :
replacement has 5070 rows, data has 5191

nz50 = Ticker$new('^NZ50')
nz = nz50$get_history(start = '2003-01-03', interval = '1d')

produces

Error in data.frame(date = as_datetime(unlist(data$timestamp)), volume = unlist(indicators$volume), :
arguments imply differing number of rows: 5191, 5070

@aravindhebbali aravindhebbali self-assigned this Aug 3, 2023
@aravindhebbali aravindhebbali added the bug Something isn't working label Aug 3, 2023
@aravindhebbali
Copy link
Member

The mismatch in rows is due to NULL values not being handled by the package. Will fix this at the earliest.

@tkfull
Copy link

tkfull commented Dec 19, 2023

Great package, thanks. I also ran across this bug. Looking forward to when it gets fixed! Thank you!

@aravindhebbali
Copy link
Member

Please install the latest development version from GitHub:

# install.packages("pak")
pak::pak("rsquaredacademy/yahoofinancer")
library(yahoofinancer)
nz50 = Index$new('^NZ50')
nz = nz50$get_history(start = '2003-01-03', interval = '1d')
head(nz)
#>                  date volume    high     low    open   close adj_close
#> 1 2003-01-02 21:00:00      0 1954.96 1954.96 1954.96 1954.96   1954.96
#> 2 2003-01-05 21:00:00      0 1981.10 1981.10 1981.10 1981.10    1981.1
#> 3 2003-01-06 21:00:00      0 1992.42 1992.42 1992.42 1992.42   1992.42
#> 4 2003-01-07 21:00:00      0 1987.99 1987.99 1987.99 1987.99   1987.99
#> 5 2003-01-08 21:00:00      0 1984.45 1984.45 1984.45 1984.45   1984.45
#> 6 2003-01-09 21:00:00      0 1998.91 1998.91 1998.91 1998.91   1998.91

Created on 2023-12-19 with reprex v2.0.2

@aravindhebbali
Copy link
Member

Apologies, I fixed the issue for the indices but not the ticker.

library(yahoofinancer)
nz50 = Ticker$new('^NZ50')
nz = nz50$get_history(start = '2003-01-03', interval = '1d')
head(nz)
#>                  date volume    high     low    open   close adj_close
#> 1 2003-01-02 21:00:00      0 1954.96 1954.96 1954.96 1954.96   1954.96
#> 2 2003-01-05 21:00:00      0 1981.10 1981.10 1981.10 1981.10    1981.1
#> 3 2003-01-06 21:00:00      0 1992.42 1992.42 1992.42 1992.42   1992.42
#> 4 2003-01-07 21:00:00      0 1987.99 1987.99 1987.99 1987.99   1987.99
#> 5 2003-01-08 21:00:00      0 1984.45 1984.45 1984.45 1984.45   1984.45
#> 6 2003-01-09 21:00:00      0 1998.91 1998.91 1998.91 1998.91   1998.91

Created on 2023-12-20 with reprex v2.0.2

@aravindhebbali
Copy link
Member

@tkfull

library(yahoofinancer)
x <- Ticker$new('hubb')
y <- x$get_history(start = '1995-01-01', interval = '1d')
head(y)
#>                  date volume   high    low     open  close adj_close
#> 1 1995-01-03 14:30:00  42630 25.179 24.822 25.12381 25.179  10.92304
#> 2 1995-01-04 14:30:00  72660 25.536 25.179 25.18095 25.536  11.07792
#> 3 1995-01-05 14:30:00  37380 25.953 25.536 25.54286 25.893  11.23278
#> 4 1995-01-06 14:30:00  95970 25.893 25.595 25.83809 25.595  11.10351
#> 5 1995-01-09 14:30:00      0 25.595 25.595 25.59500 25.595  11.10351
#> 6 1995-01-10 14:30:00  44400 25.813 25.500 25.69000 25.500   11.0623

Created on 2023-12-20 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants