11# ### GLOBAL SETTINGS
22
3- quickrun = F # use T if you want to run quickly for testing
4- quickrunlist = c(' DivOmit' ,' realestate' ,' nanalyst' )
5- feed.verbose = F # use T if you want lots of feedback
6-
73options(dplyr.summarise.inform = FALSE )
84
95# ### PATHS
10- pathProject = paste0(getwd(), ' /' )
11-
126pathPredictors = paste0(pathProject , ' Signals/Data/Predictors/' )
137pathPlacebos = paste0(pathProject , ' Signals/Data/Placebos/' )
148pathCRSPPredictors = paste0(pathProject , ' Signals/Data/CRSPPredictors/' )
@@ -21,26 +15,44 @@ pathDataSummary = paste0(pathProject, 'Portfolios/Data/Summary/')
2115
2216pathResults = paste0(pathProject , ' Results/' )
2317
24- # Create folders if they don't exist
18+ # # Create folders if they don't exist
19+ # Portfolios/ paths
2520dir.create(pathResults )
2621dir.create(paste0(pathProject , ' Portfolios/Data' ))
2722dir.create(paste0(pathDataPortfolios ))
2823dir.create(paste0(pathDataIntermediate ))
29- dir.create(paste0(pathCRSPPredictors ))
24+
25+ # Signals/Data/ paths
26+ dir.create(paste0(pathProject ,' Signals/Data/' ))
27+ dir.create(paste0(pathPredictors ))
28+ dir.create(paste0(pathPlacebos ))
29+ dir.create(paste0(pathtemp ))
30+
3031
3132# ### PACKAGES
3233# Check for and potentially install missing packages
3334install.packages(setdiff(c(' tidyverse' , ' lubridate' , ' readxl' , ' writexl' , ' pryr' , ' fst' ,
34- ' RPostgres' , ' getPass' , ' extrafont' , ' xtable' , ' gridExtra' ),
35+ ' RPostgres' , ' getPass' , ' xtable' , ' gridExtra' ,
36+ ' ggrepel' ,' data.table' ),
3537 rownames(installed.packages())))
3638
39+ # Use the extrafonts package, to get nicer fonts for output figures
40+ # Code issues warnings when not installed but runs nevertheless
41+ # See https://cran.r-project.org/web/packages/extrafont/README.html
42+ if (! ' extrafont' %in% rownames(installed.packages())) {
43+ install.packages(' extrafont' )
44+ extrafont :: font_import()
45+ }
46+
47+
3748options(stringsAsFactors = FALSE )
3849library(tidyverse )
3950library(lubridate )
4051library(readxl )
4152library(writexl )
4253library(pryr )
4354library(fst )
55+ library(data.table ) # for handling daily crsp
4456
4557# for WRDS access
4658library(RPostgres )
@@ -58,10 +70,17 @@ loadfonts()
5870library(xtable )
5971options(xtable.floating = FALSE )
6072library(gridExtra )
73+ library(ggrepel )
6174
6275# system dependent settings
6376dlmethod <- " auto"
64- optFontFamily = ' Palatino Linotype' # doesn't agree with linux command line
77+
78+ if (' Palatino Linotype' %in% fonts()) {
79+ optFontFamily = ' Palatino Linotype'
80+ } else {
81+ optFontFamily = ' '
82+ }
83+
6584sysinfo <- Sys.info()
6685if (sysinfo [1 ] == " Linux" ) {
6786 dlmethod <- " wget"
@@ -350,7 +369,8 @@ loop_over_strategies = function(
350369 strategylist
351370 , saveportcsv = F
352371 , saveportpath = NA
353- , saveportNmin = 20
372+ , saveportNmin = 1
373+ , passive_gain = F
354374 ){
355375
356376 Nstrat = dim(strategylist )[1 ]
@@ -387,6 +407,7 @@ loop_over_strategies = function(
387407 , portperiod = strategylist $ portperiod [i ]
388408 , q_filt = strategylist $ q_filt [i ]
389409 , filterstr = strategylist $ filterstr [i ]
410+ , passive_gain = passive_gain
390411 )
391412
392413 }
0 commit comments