Skip to content

Commit

Permalink
Merge branch 'braverock:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kecoli authored Mar 3, 2022
2 parents a8f5a4c + 43dc232 commit 3431e26
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
Binary file not shown.
Binary file removed sandbox/Data Details CRSP SPGMI/FAdataCRSPandSPGMI.pdf
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions sandbox/Data Details CRSP SPGMI/stocks300stocks310compare.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
library(data.table)
library(FactorAnalytics)
data(stocksCRSP)
gics <- fread('stocksTickers310GICSgovindSPGMI.csv')
# unique(stocksCRSP$TickerLast) %in% unique(gics$Ticker)
sum(unique(stocksCRSP$TickerLast) %in% unique(gics$Ticker))
setdiff(unique(gics$Ticker),unique(stocksCRSP$TickerLast))

24 changes: 24 additions & 0 deletions sandbox/Data Details CRSP SPGMI/stocksSectorsCapgroupCounts.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
library(FactorAnalytics)
library(data.table)
data(stocksCRSP)
names(stocksCRSP)

# Probably add lines 7-12 to FFM Vignette
dim(stocksCRSP) # Next lines to make dim more clear
range(stocksCRSP[,Date])
length(unique(stocksCRSP[,Ticker]))
(nTickerLast <- length(unique(stocksCRSP[,TickerLast])))
(nDates <- length(unique(stocksCRSP[,Date])))
nDates*nTickerLast
dim(stocksCRSP)

# Get last date
lastDateCRSP <- tail(stocksCRSP[,Date],1)
stocksCRSPLast <- stocksCRSP[Date == lastDateCRSP]

# Sector counts, messed up by multiple names for some sectors
stocksCRSPLast[ , .N, by = Sector] # Nice data.table feature

# Capgroup counts
stocksCRSPLast[ , .N, by = CapGroup]
# I will add a barplot version in the FFM Vignette
Binary file not shown.
Binary file not shown.

0 comments on commit 3431e26

Please sign in to comment.