From 98e5769e06ecff48eceae3c3d7ad3dd869c3b6e9 Mon Sep 17 00:00:00 2001 From: i Date: Wed, 21 Jun 2017 16:58:51 -0400 Subject: [PATCH 01/25] add quotes from IEX TOPS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nothing fancy, but it works… the output doesn't match the other quotes either .. maybe a to do .. or not? --- R/getQuote.R | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/R/getQuote.R b/R/getQuote.R index 105109d3..2ba3c976 100644 --- a/R/getQuote.R +++ b/R/getQuote.R @@ -3,6 +3,7 @@ # getQuote.IBrokers # getQuote.RBloomberg # getQuote.OpenTick +# getQuote.IEX `getQuote` <- function(Symbols,src='yahoo',what, ...) { @@ -173,3 +174,58 @@ yahooQuote.EOD <- structure(list("ohgl1v", c("Open", "High", nms <- optshort[w] return(structure(list(str,nms),class='quoteFormat')) } + + + + + + +getQuote.IEX <- function(symbols='vxx') { + convert.TOPS.time( + fromJSON( + curl( + form.IEX.url(symbols) + ) + ) + ) + } + + + +form.IEX.url <- function(symbols) { + paste0( 'https://api.iextrading.com/1.0/tops/last?symbols=', #TOPS only + paste0( + curl_escape(symbols), #eg AGI+ needs to be AGI%2b + collapse=',' + ) + ) + } + + +convert.TOPS.time <- function(quote.from.TOPS) { + #time (milliseconds since epoch) comes in as the fourth parameter + time.from.TOPS <- quote.from.TOPS[,4] + time.from.TOPS -> milliseconds.from.TOPS + + #very light error checking + if( any(!is.numeric(milliseconds.from.TOPS)) ) { + stop( "I thought TOPS was going to give me a numeric time (milliseconds since the epoch) ..." ) + } + if( any(milliseconds.from.TOPS < 1e12) ) { + stop( "That number of milliseconds is probably wrong (it dates back to 2001, before IEX was founded...)" ) + } + if( any(milliseconds.from.TOPS > 2e12) ) { + stop( "That number of milliseconds is probably wrong (it's the year 2033, by which time this software package will either be obsolete or updated)." ) + } + + #conversion + epoch <- '1970-01-01' + milliseconds.from.TOPS / 1000L -> seconds.from.TOPS + + #edit only the fourth column + as.POSIXct(seconds.from.TOPS, origin=epoch) -> time.from.TOPS + time.from.TOPS -> quote.from.TOPS[,4] + + #but return the whole object + return(quote.from.TOPS) + } From a2916b48aa6bade973def8828e9fbf0dd94350ee Mon Sep 17 00:00:00 2001 From: i Date: Wed, 21 Jun 2017 17:26:56 -0400 Subject: [PATCH 02/25] test IEX getQuote MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prove to travis that my other commit actually works… --- tests/tests.R | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/tests.R b/tests/tests.R index 51a60e15..2e95b77a 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -30,3 +30,44 @@ options(warn = 2) quantmod::getSymbols("SPY", src = "google", from = Sys.Date() - 10) options(warn = op.warn) + + +#IEX tests +structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), + size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), + .Names = c("symbol", "price", "size", "time"), + row.names = 1:2, class = "data.frame") -> here.now.vxx.snap + + + +#net test +try( getQuote.IEX('vxx') ) +try( getQuote.IEX( c('vxx','snap') ) ) +try( getQuote.IEX( list('vxx','snap') ) ) + + + +#right shape +stopifnot( identical( + dim(getQuote.IEX('cat')), + c(1L,4L) + ) +) + + +#called the expected thing +stopifnot( identical( + c("symbol", "price", "size", "time"), + names( getQuote.IEX('slb') ) + ) + + +#IEX quotes are of the expected type +expected.types <- structure(list(symbol = "character", price = "numeric", size = "integer", + time = c("POSIXct", "POSIXt")), .Names = c("symbol", "price", "size", "time")) + +stopifnot( identical( + lapply(getQuote.IEX('chd'), FUN=class), + expected.types + ) + ) From 8785e6e9024641873d58b1d95e403d1d3532a7b4 Mon Sep 17 00:00:00 2001 From: i Date: Wed, 21 Jun 2017 19:38:17 -0400 Subject: [PATCH 03/25] prefix curl::curl_escape &c curl, curl_escape, and readJSON need to have their package prefixed to satisfy travis --- R/getQuote.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/getQuote.R b/R/getQuote.R index 2ba3c976..645f093a 100644 --- a/R/getQuote.R +++ b/R/getQuote.R @@ -182,8 +182,8 @@ yahooQuote.EOD <- structure(list("ohgl1v", c("Open", "High", getQuote.IEX <- function(symbols='vxx') { convert.TOPS.time( - fromJSON( - curl( + jsonlite::fromJSON( + curl::curl( form.IEX.url(symbols) ) ) @@ -195,7 +195,7 @@ getQuote.IEX <- function(symbols='vxx') { form.IEX.url <- function(symbols) { paste0( 'https://api.iextrading.com/1.0/tops/last?symbols=', #TOPS only paste0( - curl_escape(symbols), #eg AGI+ needs to be AGI%2b + curl::curl_escape(symbols), #eg AGI+ needs to be AGI%2b collapse=',' ) ) From b3ba61cb818a79d628989857faa2286518d9caa8 Mon Sep 17 00:00:00 2001 From: i Date: Wed, 21 Jun 2017 19:42:09 -0400 Subject: [PATCH 04/25] make travis like the IEX build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit travis didn't like `try( getQuote.IEX( 'vxx' ) )`. Can't test this locally so just trying to `source` the definition of `getQuote.IEX` in there… --- tests/tests.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tests.R b/tests/tests.R index 2e95b77a..312a02db 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -33,6 +33,7 @@ options(warn = op.warn) #IEX tests +source('getQuote.R') structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), .Names = c("symbol", "price", "size", "time"), From fe81047ba59055f1b0badfba58f223fa7ca19482 Mon Sep 17 00:00:00 2001 From: i Date: Wed, 21 Jun 2017 20:02:42 -0400 Subject: [PATCH 05/25] no -> Josh does not like `a->b`, so I switched them all to `b<-a` --- R/getQuote.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/R/getQuote.R b/R/getQuote.R index 645f093a..25c9aec9 100644 --- a/R/getQuote.R +++ b/R/getQuote.R @@ -205,14 +205,14 @@ form.IEX.url <- function(symbols) { convert.TOPS.time <- function(quote.from.TOPS) { #time (milliseconds since epoch) comes in as the fourth parameter time.from.TOPS <- quote.from.TOPS[,4] - time.from.TOPS -> milliseconds.from.TOPS + milliseconds.from.TOPS <- time.from.TOPS #very light error checking if( any(!is.numeric(milliseconds.from.TOPS)) ) { - stop( "I thought TOPS was going to give me a numeric time (milliseconds since the epoch) ..." ) + stop( "I thought TOPS was going to give me a numeric time (milliseconds since the epoch) …" ) } if( any(milliseconds.from.TOPS < 1e12) ) { - stop( "That number of milliseconds is probably wrong (it dates back to 2001, before IEX was founded...)" ) + stop( "That number of milliseconds is probably wrong (it dates back to 2001, before IEX was founded…)" ) } if( any(milliseconds.from.TOPS > 2e12) ) { stop( "That number of milliseconds is probably wrong (it's the year 2033, by which time this software package will either be obsolete or updated)." ) @@ -220,11 +220,11 @@ convert.TOPS.time <- function(quote.from.TOPS) { #conversion epoch <- '1970-01-01' - milliseconds.from.TOPS / 1000L -> seconds.from.TOPS + seconds.from.TOPS <- milliseconds.from.TOPS / 1000L #edit only the fourth column - as.POSIXct(seconds.from.TOPS, origin=epoch) -> time.from.TOPS - time.from.TOPS -> quote.from.TOPS[,4] + time.from.TOPS <- as.POSIXct(seconds.from.TOPS, origin=epoch) + quote.from.TOPS[,4] <- time.from.TOPS #but return the whole object return(quote.from.TOPS) From d10c62c896688495b34ddbf5d8579cacf28137c4 Mon Sep 17 00:00:00 2001 From: i Date: Thu, 22 Jun 2017 15:57:42 -0400 Subject: [PATCH 06/25] ubuntu 16 upgrade travis build to Ubuntu 16, xenial xerus --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1a6e185e..d9180562 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: c sudo: required -dist: trusty +dist: xenial env: global: From 40cdf134e43f21d3da644f673c9dfbb2d446d2db Mon Sep 17 00:00:00 2001 From: i Date: Thu, 22 Jun 2017 16:04:32 -0400 Subject: [PATCH 07/25] source from ../R/. was sourcing from *tests* folder. no wonder travis didn't like it --- tests/tests.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests.R b/tests/tests.R index 312a02db..801176b4 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -33,7 +33,7 @@ options(warn = op.warn) #IEX tests -source('getQuote.R') +source('../R/getQuote.R') structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), .Names = c("symbol", "price", "size", "time"), From 19aab8cd394a209d1b100af0d3040a1604cc51b4 Mon Sep 17 00:00:00 2001 From: i Date: Thu, 22 Jun 2017 16:16:18 -0400 Subject: [PATCH 08/25] no need to source? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit just figuring out travis… --- tests/tests.R | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/tests.R b/tests/tests.R index 801176b4..2e95b77a 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -33,7 +33,6 @@ options(warn = op.warn) #IEX tests -source('../R/getQuote.R') structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), .Names = c("symbol", "price", "size", "time"), From 972e511cb754198ccc43f0b1f1563b8ea49e668b Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 11:19:40 -0400 Subject: [PATCH 09/25] =?UTF-8?q?let's=20try=20this=20the=20ugly=20way?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit delete & replace for travis… --- tests/tests.R | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/tests.R b/tests/tests.R index 2e95b77a..d4442a2a 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -40,10 +40,7 @@ structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), -#net test -try( getQuote.IEX('vxx') ) -try( getQuote.IEX( c('vxx','snap') ) ) -try( getQuote.IEX( list('vxx','snap') ) ) + From 47710bce3f7c2ba07fea36bb513a054607c332f8 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 14:47:44 -0400 Subject: [PATCH 10/25] use my r-travis copied dirk's `sample.travis.yaml` so I can edit other parts of this and get it to pass --- .travis.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9180562..79e06d53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -# Run Travis CI for R using https://eddelbuettel.github.io/r-travis/ - language: c sudo: required @@ -11,20 +9,20 @@ env: - _R_CHECK_FORCE_SUGGESTS_=false before_install: - - curl -OLs https://eddelbuettel.github.io/r-travis/run.sh && chmod 0755 run.sh - - ./run.sh bootstrap + - curl -OLs https://raw.githubusercontent.com/isomorphisms/r-travis/xenial/scripts/travis-tool.sh && chmod 0755 travis-tool.sh + - ./travis-tool.sh bootstrap install: - - ./run.sh install_aptget r-cran-zoo r-cran-xts r-cran-ttr r-cran-curl + - ./travis-tool.sh install_aptget r-cran-zoo r-cran-xts r-cran-ttr r-cran-curl script: - - ./run.sh run_tests + - ./travis-tool.sh run_tests after_failure: - - ./run.sh dump_logs + - ./travis-tool.sh dump_logs notifications: email: - on_success: change - on_failure: change + on_success: win@isomorphism.es #change + on_failure: lose@isomorphism.es #change From a04259017917d99975bc3ffc10432a3d0ebac1a8 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 15:19:54 -0400 Subject: [PATCH 11/25] nevermind xenial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit travis is still on trusty, so… --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79e06d53..b91ea9f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ -language: c +language: r sudo: required -dist: xenial +dist: trusty env: global: From 7a27d7f07eb11075550aa432c63403f429729e50 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 15:45:10 -0400 Subject: [PATCH 12/25] simpler travis looks like josh got an old version from dirk https://docs.travis-ci.com/user/languages/r/ --- .travis.yml | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index b91ea9f1..4d11bc29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,10 @@ language: r +cache: packages -sudo: required +sudo: false -dist: trusty +# dist: trusty -env: - global: - - _R_CHECK_FORCE_SUGGESTS_=false - -before_install: - - curl -OLs https://raw.githubusercontent.com/isomorphisms/r-travis/xenial/scripts/travis-tool.sh && chmod 0755 travis-tool.sh - - ./travis-tool.sh bootstrap - -install: - - ./travis-tool.sh install_aptget r-cran-zoo r-cran-xts r-cran-ttr r-cran-curl - -script: - - ./travis-tool.sh run_tests - -after_failure: - - ./travis-tool.sh dump_logs notifications: email: From 73681b4ea6b1b9c3a3647de5298f28047289476b Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 16:01:51 -0400 Subject: [PATCH 13/25] found that ) error it was in ```structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), .Names = c("symbol", "price", "size", "time"), row.names = 1:2, class = "data.frame")```, not the very sensible calls to `try` --- tests/tests.R | 67 +++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/tests/tests.R b/tests/tests.R index d4442a2a..bae2027d 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -1,70 +1,75 @@ -# Call as.zoo before quantmod is loaded and registers its S3 method -dc <- c("2015-01-01", "2016-01-01", "2017-01-01") -dd <- as.Date(dc) - -f <- data.frame(a = 1:3) -r <- f -rownames(r) <- dc - -zz.f.date <- zoo::as.zoo(f, order.by = dd) -zz.f.char <- zoo::as.zoo(f, order.by = dc) -zz.f <- zoo::as.zoo(f) +#IEX tests -zz.r.date <- zoo::as.zoo(r, order.by = dd) -zz.r.char <- zoo::as.zoo(r, order.by = dc) -zz.r <- zoo::as.zoo(r) +structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), + size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), + .Names = c("symbol", "price", "size", "time"), + row.names = 1:2, class = "data.frame") + ) -> here.now.vxx.snap -library(quantmod) -### quantmod:::as.zoo.data.frame -# should be the same as zoo:::as.zoo.data.frame when order.by is provided -stopifnot(identical(zz.f.char, as.zoo(f, order.by = dc))) -stopifnot(identical(zz.f.date, as.zoo(f, order.by = dd))) -stopifnot(identical(zz.r.char, as.zoo(r, order.by = dc))) -stopifnot(identical(zz.r.date, as.zoo(r, order.by = dd))) -# should not throw a warning -op.warn <- getOption("warn") -options(warn = 2) -quantmod::getSymbols("SPY", src = "google", from = Sys.Date() - 10) -options(warn = op.warn) -#IEX tests -structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), - size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), - .Names = c("symbol", "price", "size", "time"), - row.names = 1:2, class = "data.frame") -> here.now.vxx.snap +#net test +try( getQuote.IEX('vxx') ) +try( getQuote.IEX( c('vxx','snap') ) ) +try( getQuote.IEX( list('vxx','snap') ) ) + + + #right shape + stopifnot( identical( + dim(getQuote.IEX('cat')), + c(1L,4L) + ) + ) + + + #called the expected thing + stopifnot( identical( + c("symbol", "price", "size", "time"), + names( getQuote.IEX('slb') ) + ) + + + #IEX quotes are of the expected type + expected.types <- structure(list(symbol = "character", price = "numeric", size = "integer", + time = c("POSIXct", "POSIXt")), .Names = c("symbol", "price", "size", "time")) + + stopifnot( identical( + lapply(getQuote.IEX('chd'), FUN=class), + expected.types + ) + ) From 398c360a76bc9239559843f9649c96094716acb9 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 19:20:35 -0400 Subject: [PATCH 14/25] put back josh's tests accidentally deleted some of josh's tests --- tests/tests.R | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/tests.R b/tests/tests.R index bae2027d..a21c3e00 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -1,3 +1,74 @@ + + + + + +# Call as.zoo before quantmod is loaded and registers its S3 method + +dc <- c("2015-01-01", "2016-01-01", "2017-01-01") + +dd <- as.Date(dc) + + + + +f <- data.frame(a = 1:3) + +r <- f + +rownames(r) <- dc + + + + +zz.f.date <- zoo::as.zoo(f, order.by = dd) + +zz.f.char <- zoo::as.zoo(f, order.by = dc) + +zz.f <- zoo::as.zoo(f) + + + +zz.r.date <- zoo::as.zoo(r, order.by = dd) + + +zz.r.char <- zoo::as.zoo(r, order.by = dc) + +zz.r <- zoo::as.zoo(r) + + + +library(quantmod) + + + +### quantmod:::as.zoo.data.frame + + + +# should be the same as zoo:::as.zoo.data.frame when order.by is provided + +stopifnot(identical(zz.f.char, as.zoo(f, order.by = dc))) + +stopifnot(identical(zz.f.date, as.zoo(f, order.by = dd))) + +stopifnot(identical(zz.r.char, as.zoo(r, order.by = dc))) + +stopifnot(identical(zz.r.date, as.zoo(r, order.by = dd))) + + + +# should not throw a warning + +op.warn <- getOption("warn") + +options(warn = 2) + +quantmod::getSymbols("SPY", src = "google", from = Sys.Date() - 10) + +options(warn = op.warn) + + #IEX tests structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), From 7952b7e9183235d7ee490ca5f8d7b7f34fb0f75e Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 19:38:42 -0400 Subject: [PATCH 15/25] quantmod:: prefix with quantmod:: so travis finds these functions? --- tests/tests.R | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/tests/tests.R b/tests/tests.R index a21c3e00..811c7c99 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -6,34 +6,26 @@ # Call as.zoo before quantmod is loaded and registers its S3 method dc <- c("2015-01-01", "2016-01-01", "2017-01-01") - dd <- as.Date(dc) f <- data.frame(a = 1:3) - r <- f - rownames(r) <- dc zz.f.date <- zoo::as.zoo(f, order.by = dd) - zz.f.char <- zoo::as.zoo(f, order.by = dc) - zz.f <- zoo::as.zoo(f) zz.r.date <- zoo::as.zoo(r, order.by = dd) - - zz.r.char <- zoo::as.zoo(r, order.by = dc) - zz.r <- zoo::as.zoo(r) @@ -49,11 +41,8 @@ library(quantmod) # should be the same as zoo:::as.zoo.data.frame when order.by is provided stopifnot(identical(zz.f.char, as.zoo(f, order.by = dc))) - stopifnot(identical(zz.f.date, as.zoo(f, order.by = dd))) - stopifnot(identical(zz.r.char, as.zoo(r, order.by = dc))) - stopifnot(identical(zz.r.date, as.zoo(r, order.by = dd))) @@ -61,11 +50,8 @@ stopifnot(identical(zz.r.date, as.zoo(r, order.by = dd))) # should not throw a warning op.warn <- getOption("warn") - options(warn = 2) - quantmod::getSymbols("SPY", src = "google", from = Sys.Date() - 10) - options(warn = op.warn) @@ -85,11 +71,9 @@ structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), #net test -try( getQuote.IEX('vxx') ) - -try( getQuote.IEX( c('vxx','snap') ) ) - -try( getQuote.IEX( list('vxx','snap') ) ) +try( quantmod::getQuote.IEX('vxx') ) +try( quantmod::getQuote.IEX( c('vxx','snap') ) ) +try( quantmod::getQuote.IEX( list('vxx','snap') ) ) @@ -98,15 +82,10 @@ try( getQuote.IEX( list('vxx','snap') ) ) #right shape - stopifnot( identical( - - dim(getQuote.IEX('cat')), - + dim(quantmod::getQuote.IEX('cat')), c(1L,4L) - ) - ) @@ -116,11 +95,8 @@ stopifnot( identical( #called the expected thing stopifnot( identical( - c("symbol", "price", "size", "time"), - names( getQuote.IEX('slb') ) - ) @@ -130,17 +106,12 @@ stopifnot( identical( #IEX quotes are of the expected type expected.types <- structure(list(symbol = "character", price = "numeric", size = "integer", - time = c("POSIXct", "POSIXt")), .Names = c("symbol", "price", "size", "time")) stopifnot( identical( - lapply(getQuote.IEX('chd'), FUN=class), - expected.types - ) - ) From 3e1ead441c6a713c9f9010f376243edc5a0be4fd Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 19:53:01 -0400 Subject: [PATCH 16/25] ::: make that quantmod::: --- tests/tests.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/tests.R b/tests/tests.R index 811c7c99..9cac3917 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -71,8 +71,8 @@ structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), #net test -try( quantmod::getQuote.IEX('vxx') ) -try( quantmod::getQuote.IEX( c('vxx','snap') ) ) +try( quantmod:::getQuote.IEX('vxx') ) +try( quantmod:::getQuote.IEX( c('vxx','snap') ) ) try( quantmod::getQuote.IEX( list('vxx','snap') ) ) @@ -83,7 +83,7 @@ try( quantmod::getQuote.IEX( list('vxx','snap') ) ) #right shape stopifnot( identical( - dim(quantmod::getQuote.IEX('cat')), + dim(quantmod:::getQuote.IEX('cat')), c(1L,4L) ) ) @@ -96,7 +96,7 @@ stopifnot( identical( stopifnot( identical( c("symbol", "price", "size", "time"), - names( getQuote.IEX('slb') ) + names( quantmod:::getQuote.IEX('slb') ) ) @@ -111,7 +111,7 @@ expected.types <- structure(list(symbol = "character", price = "numeric", size = stopifnot( identical( - lapply(getQuote.IEX('chd'), FUN=class), + lapply(quantmod:::getQuote.IEX('chd'), FUN=class), expected.types ) ) From aba5db599b3da231fad94b7d977b9808395893a9 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 20:06:42 -0400 Subject: [PATCH 17/25] pandoc isn't needed for quantmod save time on travis build (why is it taking so long??) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4d11bc29..676eceb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ cache: packages sudo: false # dist: trusty +pandoc_version: false #ignore: false #default: 1.15.2 #latest: 1.19.2.1 notifications: From 6aa4541fc2e7b020307d18264aa67ee7e82cf4a9 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 20:56:55 -0400 Subject: [PATCH 18/25] =?UTF-8?q?s/=E2=80=A6/.../g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit non-ascii characters messing with R CMD check --- R/getQuote.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/getQuote.R b/R/getQuote.R index 25c9aec9..4525378f 100644 --- a/R/getQuote.R +++ b/R/getQuote.R @@ -209,10 +209,10 @@ convert.TOPS.time <- function(quote.from.TOPS) { #very light error checking if( any(!is.numeric(milliseconds.from.TOPS)) ) { - stop( "I thought TOPS was going to give me a numeric time (milliseconds since the epoch) …" ) + stop( "I thought TOPS was going to give me a numeric time (milliseconds since the epoch) ..." ) } if( any(milliseconds.from.TOPS < 1e12) ) { - stop( "That number of milliseconds is probably wrong (it dates back to 2001, before IEX was founded…)" ) + stop( "That number of milliseconds is probably wrong (it dates back to 2001, before IEX was founded...)" ) } if( any(milliseconds.from.TOPS > 2e12) ) { stop( "That number of milliseconds is probably wrong (it's the year 2033, by which time this software package will either be obsolete or updated)." ) From ffa80c9b277415aad644cd887b861eb15cf18a1e Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 21:02:45 -0400 Subject: [PATCH 19/25] 1.19.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit travis doesn't like my `pandoc` instructions … --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 676eceb9..8fbb1cb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,11 @@ + language: r cache: packages sudo: false # dist: trusty -pandoc_version: false #ignore: false #default: 1.15.2 #latest: 1.19.2.1 +pandoc_version: 1.19.2.1 #ignore: false #default: 1.15.2 #latest: 1.19.2.1 notifications: From 4fb16ff679203cb68387f6140f0e94a02cf0b1ba Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 23:29:48 -0400 Subject: [PATCH 20/25] s/./_/ maybe travis doesn't like `expected.types`? --- tests/tests.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tests.R b/tests/tests.R index 9cac3917..9057bf3d 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -105,13 +105,13 @@ stopifnot( identical( #IEX quotes are of the expected type -expected.types <- structure(list(symbol = "character", price = "numeric", size = "integer", +expected_types <- structure(list(symbol = "character", price = "numeric", size = "integer", time = c("POSIXct", "POSIXt")), .Names = c("symbol", "price", "size", "time")) stopifnot( identical( lapply(quantmod:::getQuote.IEX('chd'), FUN=class), - expected.types + expected_types ) ) From 5526d347f9f0d98b9458b3a5629cf11001912250 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 23:32:06 -0400 Subject: [PATCH 21/25] don't need pandoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit should speed up builds … I used the wrong syntax before --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8fbb1cb6..e6431baa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ - language: r cache: packages sudo: false # dist: trusty -pandoc_version: 1.19.2.1 #ignore: false #default: 1.15.2 #latest: 1.19.2.1 +# pandoc_version: 1.19.2.1 #ignore: false #default: 1.15.2 #latest: 1.19.2.1 +pandoc: false notifications: From 770bdaf2a5188ec23ece423cd7b2083e2cc47acf Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 23:32:58 -0400 Subject: [PATCH 22/25] trusty want it to build on R 3.4 which is not supported in precise pangolin --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e6431baa..e5f6fee6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ cache: packages sudo: false -# dist: trusty +dist: trusty # pandoc_version: 1.19.2.1 #ignore: false #default: 1.15.2 #latest: 1.19.2.1 pandoc: false From b21d19623dcb80ad3881ba1f4c457f63f483943c Mon Sep 17 00:00:00 2001 From: i Date: Fri, 23 Jun 2017 23:44:24 -0400 Subject: [PATCH 23/25] paren problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit found it… --- tests/tests.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tests.R b/tests/tests.R index 9057bf3d..bfdd86c9 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -56,12 +56,12 @@ options(warn = op.warn) #IEX tests - +here.now.vxx.snap <- structure(list(symbol = c("VXX", "SNAP"), price = c(12.785, 17.27), size = c(100L, 200L), time = c(1498075199.954, 1498075184.411), .Names = c("symbol", "price", "size", "time"), row.names = 1:2, class = "data.frame") - ) -> here.now.vxx.snap + ) @@ -97,6 +97,7 @@ stopifnot( identical( stopifnot( identical( c("symbol", "price", "size", "time"), names( quantmod:::getQuote.IEX('slb') ) + ) ) From ce5067a47a2ef3cbaa68b7ed1b698ecce10ae66b Mon Sep 17 00:00:00 2001 From: i Date: Sat, 24 Jun 2017 00:39:05 -0400 Subject: [PATCH 24/25] covr --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index e5f6fee6..41b3239d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,3 +13,8 @@ notifications: on_success: win@isomorphism.es #change on_failure: lose@isomorphism.es #change +r_packages: + - covr + +after_success: + - Rscript -e 'library(covr); codecov()' From 41d02c595aae0eeaadb1982a40784eb8288c599c Mon Sep 17 00:00:00 2001 From: i Date: Mon, 26 Jun 2017 22:43:39 -0400 Subject: [PATCH 25/25] back to Josh's travis.yaml there are hadleyverse dependencies in @jimhester and @craigcitro's `r` build @joshuaulrich doesn't want switching back for the PR --- .travis.yml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 41b3239d..4efc4ebc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,29 @@ -language: r -cache: packages +# Run Travis CI for R using https://eddelbuettel.github.io/r-travis/ -sudo: false +language: c + +sudo: required dist: trusty -# pandoc_version: 1.19.2.1 #ignore: false #default: 1.15.2 #latest: 1.19.2.1 -pandoc: false +env: + global: + - _R_CHECK_FORCE_SUGGESTS_=false -notifications: - email: - on_success: win@isomorphism.es #change - on_failure: lose@isomorphism.es #change +before_install: + - curl -OLs https://eddelbuettel.github.io/r-travis/run.sh && chmod 0755 run.sh + - ./run.sh bootstrap + +install: + - ./run.sh install_aptget r-cran-zoo r-cran-xts r-cran-ttr r-cran-curl -r_packages: - - covr +script: + - ./run.sh run_tests -after_success: - - Rscript -e 'library(covr); codecov()' +after_failure: + - ./run.sh dump_logs + +notifications: + email: + on_success: quantmod@mailinator.com + on_failure: quantmad@mailinator.com