-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'braverock:master' into master
- Loading branch information
Showing
7 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+32.9 KB
sandbox/Data Details CRSP SPGMI/Guide for Data Details CRSP SPGMI Folder 02 23 22.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
24
sandbox/Data Details CRSP SPGMI/stocksSectorsCapgroupCounts.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.