Skip to content

Commit

Permalink
Explicitly request volume column in riingo_iex_latest() (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan authored Sep 10, 2020
1 parent 71737da commit 3e536fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# riingo (development version)

* `riingo_iex_latest()` now also returns a `volume` column, like
`riingo_iex_prices()` (#18).

# riingo 0.3.0

* New `riingo_fx_quote()` for collecting current top-of-book data for forex
Expand Down
2 changes: 1 addition & 1 deletion R/url_constructor.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ retrieve_endpoint <- function(type, endpoint) {

"iex" = switch(endpoint,
"quote" = "",
"latest" = "/prices?",
"latest" = "/prices?columns=open,high,low,close,volume&",
"prices" = "/prices?columns=open,high,low,close,volume&"),

"tiingo" = switch(endpoint,
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-latest.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ test_that("latest riingo iex prices - can be pulled", {
prices <- riingo_iex_latest("AAPL")

expect_is(prices, "tbl_df")
expect_equal(ncol(prices), 6) # structurally should always have 6 cols
expect_equal(ncol(prices), 7) # structurally should always have 6 cols
expect_true("volume" %in% names(prices))
})

test_that("latest riingo iex prices - resample freq arg works", {
Expand Down Expand Up @@ -100,7 +101,7 @@ test_that("latest riingo iex prices - handles partial successes", {

expect_is(x, "tbl_df")
expect_equal(x$ticker[1], "AAPL")
expect_equal(ncol(x), 6)
expect_equal(ncol(x), 7)
})

# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 3e536fa

Please sign in to comment.