braverock / quantstrat

289 stars 114 forks source link

blotter and quantstrat not compliant with R 3.6.0 #115

Closed thestockman27 closed 4 years ago

thestockman27 commented 4 years ago

what version of R should I revert to in order to use these packages?

jaymon0703 commented 4 years ago

Hi @thestockman27 you should not have to revert in order to use these packages. Are you experiencing a particular issue when using R 3.6.0? Can you provide details?

Since upgrading our Travis.ci distro to Ubuntu 18.04 there is a minimum requirement for installing quantstrat with at least R 3.5.0. Any version from R 3.5.0 and above should work for using these packages. For more info you can see https://github.com/braverock/quantstrat/issues/110.

braverock commented 4 years ago

@thestockman27 yes, please provide any error output you are seeing. blotter and quantstrat work fine under R 3.6.0 and 3.6.1

Here is the startup message from my machine:

version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Loading required package: quantstrat
Loading required package: quantmod
Loading required package: xts
Loading required package: zoo
Loading required package: stats

Attaching package: ‘zoo’

The following objects are masked from ‘package:base’:

    as.Date, as.Date.numeric

Loading required package: TTR
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
Version 0.4-0 included new data defaults. See ?getSymbols.
Loading required package: blotter
Loading required package: FinancialInstrument
Loading required package: PerformanceAnalytics
Loading required package: foreach

and the output of sessionInfo():

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blis-openmp/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] graphics  grDevices utils     datasets  stats     methods   base     

other attached packages:
[1] quantstrat_0.16.2          foreach_1.4.7              blotter_0.14.7             PerformanceAnalytics_1.5.3 FinancialInstrument_1.3.1  quantmod_0.4-15            TTR_0.23-4                 xts_0.12-0                
[9] zoo_1.8-6                 

loaded via a namespace (and not attached):
[1] quadprog_1.5-7   lattice_0.20-38  codetools_0.2-16 MASS_7.3-51.4    grid_3.6.1       curl_4.0         boot_1.3-23      iterators_1.0.12 compiler_3.6.1  
thestockman27 commented 4 years ago

Hi there! Thanks for the speedy reply. When attempting to run install the packages via install_github(), I receive the following error messages. Any idea how I may be able to resolve? I didn't bother to attempt downloading quantstrat seeing as I could not get blotter to install successfully.  Code: `install.packages("devtools") install.packages("FinancialInstrument") install.packages("PerformanceAnalytics")

library(devtools) devtools::install_github("braverock/blotter") devtools::install_github("braverock/quantstrat")`

First Error: Failed to install 'FinancialInstrument' from GitHub: (converted from warning) cannot remove prior installation of package ‘curl’

Second Error: Failed to install 'xts' from GitHub: (converted from warning) installation of package C:/Users/qwerty/AppData/Local/Temp/Rtmp2XJULf/file40a070f56e75/xts_0.12-0.tar.gz’ had non-zero exit status

Third Error: Failed to install 'blotter' from GitHub: (converted from warning) cannot remove prior installation of package ‘curl’

jaymon0703 commented 4 years ago

Hmm, you cannot install anything from GH. Seems like there is a conflict with a 'curl' package. Try removing that, installing 'Rcurl' then trying again to install from GH?

thestockman27 commented 4 years ago

Rcurl seemed to resolve the first and second errors. However, blotter still seems to be having trouble.

when using this installation command: devtools::install_github("braverock/quantstrat") I receive the following error message Error: Failed to install 'blotter' from GitHub: (converted from warning) installation of package ‘C:/Users/qwerty/AppData/Local/Temp/RtmpiuN8Ii/file53c20d57e78/blotter_0.14.7.tar.gz’ had non-zero exit status

Alternatively, I attempted using this installation command: install.packages("blotter", repos="http://R-Forge.R-project.org")

and received this error message: Warning in install.packages : package ‘blotter’ is not available (for R version 3.6.0)

I appreciate your help here, I am in over my head at this point...

jaymon0703 commented 4 years ago

blotter is not on CRAN, so you have to install from GH. Try install blotter first, then quantstrat?

thestockman27 commented 4 years ago

whoops, i copied the wrong line for the first installation attempt i noted above. I should say devtools::install_github("braverock/blotter")

this too, returns the non-zero exit status error.

braverock commented 4 years ago

devtools should give more output than that if installation fails. Please provide all the output. I can see that you are on Windows. Make sure you have the latest installation of Rtools in addition to devtools.

https://cran.r-project.org/bin/windows/Rtools/index.html

thestockman27 commented 4 years ago

I followed the Rtools link you provided, downloaded the recommended version, and installed it alongside the other packages in my R/win-library/3.6 folder. Unfortunately, it doesn't look like it was successful, as I cannot access it from the console. > library(Rtools) Error in library(Rtools) : there is no package called ‘Rtools’

Below is the output from the failed installation of blotter: `> library(devtools)

devtools::install_github("braverock/blotter") Downloading GitHub repo braverock/blotter@master √ checking for file 'C:\Users\dstoc\AppData\Local\Temp\RtmpiuN8Ii\remotes53c23a5ad7\braverock-blotter-16349ee/DESCRIPTION' ... preparing 'blotter': √ checking DESCRIPTION meta-information ... cleaning src checking for LF line-endings in source and make files and shell scripts checking for empty or unneeded directories looking to see if a 'data/datalist' file should be added building 'blotter_0.14.7.tar.gz'

Installing package into ‘C:/Users/dstoc/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified)

*** arch - i386 C:/RBuildTools/3.5/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c calcPosAvgCost.c -o calcPosAvgCost.o C:/RBuildTools/3.5/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c init.c -o init.o C:/RBuildTools/3.5/mingw_32/bin/gcc -shared -s -static-libgcc -o blotter.dll tmp.def calcPosAvgCost.o init.o -LC:/PROGRA~1/R/R-36~1.0/bin/i386 -lR installing to C:/Users/dstoc/Documents/R/win-library/3.6/00LOCK-blotter/00new/blotter/libs/i386

* arch - x64 C:/RBuildTools/3.5/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c calcPosAvgCost.c -o calcPosAvgCost.o C:/RBuildTools/3.5/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c init.c -o init.o C:/RBuildTools/3.5/mingw_64/bin/gcc -shared -s -static-libgcc -o blotter.dll tmp.def calcPosAvgCost.o init.o -LC:/PROGRA~1/R/R-36~1.0/bin/x64 -lR installing to C:/Users/dstoc/Documents/R/win-library/3.6/00LOCK-blotter/00new/blotter/libs/x64 R data demo ** byte-compile and prepare package for lazy loading Error: (converted from warning) package 'xts' was built under R version 3.6.1 Execution halted ERROR: lazy loading failed for package 'blotter'

jaymon0703 commented 4 years ago

Hi @thestockman27 Rtools is not an R package but instead a collection of resources for building packages for R under Microsoft Windows, or for building R itself (version 1.9.0 or later).

Can you try again after upgrading to R version 3.6.1 or the latest 3.6.2? I upgraded my version of R from 3.4.3 to 3.6.2 to see if i could reproduce your issue, and i could not. The package installs successfully and as expected. Below is my output.

> install_github("braverock/blotter")
Downloading GitHub repo braverock/blotter@master
Installing 9 packages: xts, FinancialInstrument, PerformanceAnalytics, quantmod, zoo, TTR, foreach, quadprog, iterators
Installing packages into ‘C:/Users/jmackie/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/xts_0.11-2.zip'
Content type 'application/zip' length 962644 bytes (940 KB)
downloaded 940 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/FinancialInstrument_1.3.1.zip'
Content type 'application/zip' length 551635 bytes (538 KB)
downloaded 538 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/PerformanceAnalytics_1.5.3.zip'
Content type 'application/zip' length 2866711 bytes (2.7 MB)
downloaded 2.7 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/quantmod_0.4-15.zip'
Content type 'application/zip' length 965762 bytes (943 KB)
downloaded 943 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/zoo_1.8-6.zip'
Content type 'application/zip' length 1103870 bytes (1.1 MB)
downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/TTR_0.23-6.zip'
Content type 'application/zip' length 522407 bytes (510 KB)
downloaded 510 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/foreach_1.4.7.zip'
Content type 'application/zip' length 419921 bytes (410 KB)
downloaded 410 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/quadprog_1.5-8.zip'
Content type 'application/zip' length 54859 bytes (53 KB)
downloaded 53 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/iterators_1.0.12.zip'
Content type 'application/zip' length 343817 bytes (335 KB)
downloaded 335 KB

package ‘xts’ successfully unpacked and MD5 sums checked
package ‘FinancialInstrument’ successfully unpacked and MD5 sums checked
package ‘PerformanceAnalytics’ successfully unpacked and MD5 sums checked
package ‘quantmod’ successfully unpacked and MD5 sums checked
package ‘zoo’ successfully unpacked and MD5 sums checked
package ‘TTR’ successfully unpacked and MD5 sums checked
package ‘foreach’ successfully unpacked and MD5 sums checked
package ‘quadprog’ successfully unpacked and MD5 sums checked
package ‘iterators’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\jmackie\AppData\Local\Temp\RtmpMVMu8g\downloaded_packages
✓  checking for file 'C:\Users\jmackie\AppData\Local\Temp\RtmpMVMu8g\remotesb14039d62c26\braverock-blotter-16349ee/DESCRIPTION' (395ms)
─  preparing 'blotter': (544ms)
✓  checking DESCRIPTION meta-information ... 
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts (662ms)
─  checking for empty or unneeded directories
─  looking to see if a 'data/datalist' file should be added
─  building 'blotter_0.14.7.tar.gz'

Installing package into ‘C:/Users/jmackie/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'blotter' ...
** using staged installation
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/gcc  -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG          -O3 -Wall  -std=gnu99 -mtune=generic -c calcPosAvgCost.c -o calcPosAvgCost.o
c:/Rtools/mingw_32/bin/gcc  -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG          -O3 -Wall  -std=gnu99 -mtune=generic -c init.c -o init.o
c:/Rtools/mingw_32/bin/gcc -shared -s -static-libgcc -o blotter.dll tmp.def calcPosAvgCost.o init.o -LC:/PROGRA~1/R/R-36~1.2/bin/i386 -lR
installing to C:/Users/jmackie/Documents/R/win-library/3.6/00LOCK-blotter/00new/blotter/libs/i386

*** arch - x64
c:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mtune=generic -c calcPosAvgCost.c -o calcPosAvgCost.o
c:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mtune=generic -c init.c -o init.o
c:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o blotter.dll tmp.def calcPosAvgCost.o init.o -LC:/PROGRA~1/R/R-36~1.2/bin/x64 -lR
installing to C:/Users/jmackie/Documents/R/win-library/3.6/00LOCK-blotter/00new/blotter/libs/x64
** R
** data
** demo
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'blotter'
    finding HTML links ... done
    AcctReturns                             html  
    IBM                                     html  
    PortfReturns                            html  
    addAcctTxn                              html  
    addDiv                                  html  
    addPortfInstr                           html  
    addTxn                                  html  
    amzn                                    html  
    blotter-package                         html  
    calcPortfWgt                            html  
    calcPosAvgCost                          html  
    calcTxnAvgCost                          html  
    calcTxnValue                            html  
    chart.ME                                html  
    chart.Posn                              html  
    chart.Reconcile                         html  
    chart.Spread                            html  
    dailyTxnPL                              html  
    extractTxns                             html  
    getAccount                              html  
    getByPortf                              html  
    getBySymbol                             html  
    getEndEq                                html  
    getPortfAcct                            html  
    getPortfolio                            html  
    getPos                                  html  
    getPosAvgCost                           html  
    getPosQty                               html  
    getTxns                                 html  
    hist.mcsim                              html  
    hist.txnsim                             html  
    initAcct                                html  
    initPortf                               html  
    initPosPL                               html  
    initSummary                             html  
    initTxn                                 html  
    is.account                              html  
    is.portfolio                            html  
    mcsim                                   html  
    pennyPerShare                           html  
    perTradeStats                           html  
    plot.mcsim                              html  
    plot.txnsim                             html  
    put.account                             html  
    put.portfolio                           html  
    quantile.mcsim                          html  
    quantile.txnsim                         html  
    summary.mcsim                           html  
    summary.txnsim                          html  
    tradeQuantiles                          html  
    tradeStats                              html  
    txnsim                                  html  
    txnsim.portfs                           html  
    txnsim.portnames                        html  
    txnsim.txns                             html  
    updateAcct                              html  
    updateEndEq                             html  
    updatePortf                             html  
    updatePosPL                             html  
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (blotter)
> 
thestockman27 commented 4 years ago

SUCCESS!

I can't thank you each enough for your help and patience here, I never would've figured this out on my own.

Now I can get back to learning!

jaymon0703 commented 4 years ago

Thanks for confirming, and closing the issue. Happy learning!