business-science / riingo

An R interface to the Tiingo stock price API
https://business-science.github.io/riingo/
Other
51 stars 9 forks source link

IEX volume? #18

Closed rmicalet closed 3 years ago

rmicalet commented 3 years ago

I installed version 0.3 from CRAN and then tried the latest github version of riingo, but when I use the riingo_iex_latest function, it doesn't appear to be sending back the volume. Is there an argument that needs to be set for it to return the intraday volume?

rmicalet commented 3 years ago

Actually, riingo_iex_prices does return volume. I was using riingo_iex_latest and that doesn't appear to return volume.

DavisVaughan commented 3 years ago

I think that is a bug on my part. In the meantime you can use riingo_iex_prices() to essentially get the same thing.

library(riingo)

riingo_iex_prices(
  "AAPL", 
  start_date = Sys.Date(), 
  resample_frequency = "1min"
)
#> # A tibble: 97 x 7
#>    ticker date                 open  high   low close volume
#>    <chr>  <dttm>              <dbl> <dbl> <dbl> <dbl>  <dbl>
#>  1 AAPL   2020-09-10 13:30:00  120.  120.  119.  119.  22147
#>  2 AAPL   2020-09-10 13:31:00  119.  120.  119   119.  27906
#>  3 AAPL   2020-09-10 13:32:00  119.  120.  119.  120.  23282
#>  4 AAPL   2020-09-10 13:33:00  119.  120.  119.  119.   7507
#>  5 AAPL   2020-09-10 13:34:00  119.  119.  119.  119.  23973
#>  6 AAPL   2020-09-10 13:35:00  119.  119.  119.  119.  14245
#>  7 AAPL   2020-09-10 13:36:00  119.  119.  119.  119.   6144
#>  8 AAPL   2020-09-10 13:37:00  119.  119.  119.  119.  13760
#>  9 AAPL   2020-09-10 13:38:00  119.  119.  119.  119.  10679
#> 10 AAPL   2020-09-10 13:39:00  119.  119.  119.  119.  11450
#> # … with 87 more rows

Created on 2020-09-10 by the reprex package (v0.3.0.9001)


Note to self:

It looks like I needed to append the columns to the endpoint in retrieve_endpoint() for the "latest" section of "iex" like I did for "prices".

i.e. "latest" = "/prices?columns=open,high,low,close,volume&"

DavisVaughan commented 3 years ago

Let's keep it open because I think it is a bug

DavisVaughan commented 3 years ago

riingo 0.3.1 is on CRAN now with the fix to this https://cran.r-project.org/web/packages/riingo/index.html

> riingo::riingo_iex_latest("AAPL")
# A tibble: 391 x 7
   ticker date                 open  high   low close volume
   <chr>  <dttm>              <dbl> <dbl> <dbl> <dbl>  <dbl>
 1 AAPL   2020-09-11 13:30:00  115.  115.  114.  115.   3879
 2 AAPL   2020-09-11 13:31:00  115.  115.  114.  114.   3073
 3 AAPL   2020-09-11 13:32:00  114.  115   114.  114.   3501
 4 AAPL   2020-09-11 13:33:00  114.  115.  114.  114.   3459
 5 AAPL   2020-09-11 13:34:00  114.  114.  113.  114.  12160
 6 AAPL   2020-09-11 13:35:00  113.  114.  113.  114.   1260
 7 AAPL   2020-09-11 13:36:00  114.  114.  114.  114.   2405
 8 AAPL   2020-09-11 13:37:00  114.  114.  114.  114.   4055
 9 AAPL   2020-09-11 13:38:00  114.  114.  114.  114.   2721
10 AAPL   2020-09-11 13:39:00  114.  114.  114.  114.   1857
# … with 381 more rows