CRSP
(→WEB Access R) |
(→WEB Access R) |
||
Line 73: | Line 73: | ||
* use sftp to upload / download your date (like with your [https://zid.univie.ac.at/online-speicherplatz/anleitungen/sftp/ Online-Speicherplatz] | * use sftp to upload / download your date (like with your [https://zid.univie.ac.at/online-speicherplatz/anleitungen/sftp/ Online-Speicherplatz] | ||
* http://calc.isor.univie.ac.at:8787 | * http://calc.isor.univie.ac.at:8787 | ||
− | * explore some commands | + | * explore some commands, for the sake of functionality only (not to make any sense) |
− | ###### Example#1 | + | ###### Example#1 |
+ | # search for "EGSA"and perform some actions | ||
+ | # comment, not interpreted | ||
? system | ? system | ||
? system.time() | ? system.time() | ||
− | help("crsp.data. | + | help("crsp.data.usstock") ## we have licensed US-Stock 1925 and 4 US-Indices and CCM |
− | system2("uptime") ## load average < 10 ! | + | system2("uptime") ## load average < 10 ! (otherwise too many concurrent users) |
library(data.table, crsp) | library(data.table, crsp) | ||
setwd('~/crsp') | setwd('~/crsp') | ||
Line 93: | Line 95: | ||
plot.ts(MyEGASData$MPRC) | plot.ts(MyEGASData$MPRC) | ||
######## Example #2 | ######## Example #2 | ||
+ | # read tickers from one file perform some operations and write results to another file | ||
# myTechies <- read.csv('/home/su/crsp/techcompanies.tickers', header = FALSE) | # myTechies <- read.csv('/home/su/crsp/techcompanies.tickers', header = FALSE) | ||
myTechies <- scan(file = 'techcompanies.tickers', what = 'character', sep = ',') | myTechies <- scan(file = 'techcompanies.tickers', what = 'character', sep = ',') |
Revision as of 11:38, 17 March 2021
Contents |
1 CRSP, COMPUSTAT, CCM
1.1 CUPL Tools
1.1.1 access to your remote text terminal
1.1.1.1 require credentials
email the VDC sysadmin to provide credentials and get your remote text terminal prepared.
- host: crsp.vdc.univie.ac.at
- user: your username
- password: your password
1.1.2 VPN
If working from home you have to establish a Virtual Private Network (VPN) to Uni first (see ZID/VPN).
1.1.3 SSH
If working from Windows, you might need to install an SSH-client (like PUTTY) to use Secure Shell (SSH) to connect to your terminal. Accept the server key.
Also see ZID's explanation
1.1.4 usage of a terminal
Now you work remotely and use the remote host's command line (which is the bash shell, don't type the beginning "$", which is the prompt):
the midnight-commander (mc) provides a built-in editor mcedit (exit it with Alt+0)
$ mc
$ mcedit ts_samp7.rqt
e.g. use ts_print to process a requirementfile ts_samp7.rqt and get the output ts_samp7.out:
$ ts_print ts_samp7.rqt
use mc / mcedit to look into ts_samp7.out:
$ mcedit ts_samp7.out
use e.g. this command to get the switches for the command crsp_print:
$ crsp_print /d1 /var/crsp/2019-07/crspdata/cmz201807
1.1.5 download the results onto your desktop / laptop
use an SFTP client like CyberDuck on a Mac or WinScp on Windows to download the results (e.g. ts_samp7.out) onto your desktop for further processing. Provide your SSH credentials:
1.1.6 documentation
Please read some manuals to gain experience with the ts_sampleX.rqt files in your home directory
- CRSP Utilities and Program Libraries (CUPL)
- CCM Data Guide
- and maybe the xf-understanding_the_data guide.
- collected thoughts .
1.2 WEB Access R
- apply for login-credentials andreas.loibl@univie.ac.at
- use sftp to upload / download your date (like with your Online-Speicherplatz
- http://calc.isor.univie.ac.at:8787
- explore some commands, for the sake of functionality only (not to make any sense)
###### Example#1 # search for "EGSA"and perform some actions # comment, not interpreted ? system ? system.time() help("crsp.data.usstock") ## we have licensed US-Stock 1925 and 4 US-Indices and CCM system2("uptime") ## load average < 10 ! (otherwise too many concurrent users) library(data.table, crsp) setwd('~/crsp') getwd() myheaders <- data.table(crsp.data.usstock('sfz_hdr')) myEGASHeaders <- myheaders[HTSYMBOL %like% "EGAS" & BEGDT > "1986-01-8"]$KYPERMNO myMonthly <- crsp.data.usstock("sfz_mth") nrow(myMonthly) ncol(myMonthly) head(myMonthly,10) MyEGASData <- myMonthly[myMonthly$KYPERMNO %in% c(myEGASHeaders),] head(MyEGASData) tail(MyEGASData) plot.ts(MyEGASData$MPRC) ######## Example #2 # read tickers from one file perform some operations and write results to another file # myTechies <- read.csv('/home/su/crsp/techcompanies.tickers', header = FALSE) myTechies <- scan(file = 'techcompanies.tickers', what = 'character', sep = ',') myTechiesHeaders <- myheaders[myheaders$HTSYMBOL %in% c(myTechies)] #fileDsk <- tempfile("MyTechiesHeaders") fileDsk <- "MyTechiesHeaders" #setwd("~/R_workspace/from_uspace/privat/crsp_sample1/") write.table(t(myTechiesHeaders), file='./MyTechiesHeaders') # file.show(fileDsk) # if(interactive()) file.show(fileDsk) unlink(fileDsk) # tidy up myTechiesData <- myMonthly[myMonthly$KYPERMNO %in% c(myTechiesHeaders$KYPERMNO),] plot.ts(log(myTechiesData$MPRC))