aboutsummaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/TAGS388
-rw-r--r--R/backtest_tranches.R14
-rw-r--r--R/pretty_plots.R3
-rw-r--r--R/thetas-curve.R9
-rw-r--r--R/thetas-durations.R8
-rw-r--r--R/tranches_RV_BC.R13
-rw-r--r--R/yieldcurve.R2
-rw-r--r--R/zerorecovery_index.R13
8 files changed, 207 insertions, 243 deletions
diff --git a/R/TAGS b/R/TAGS
index 7d381632..1e4eea78 100644
--- a/R/TAGS
+++ b/R/TAGS
@@ -1,10 +1,10 @@
./backtest_tranches.R,69
aargs1,0
-bbps18,543
-ffiles19,555
-ddates20,648
-bbasis21,688
+bbps18,378
+ffiles19,390
+ddates20,483
+bbasis21,523
./bandits.R,484
cconn2,20
@@ -40,15 +40,6 @@ ffixed.rebal82,2166
mmemb94,2436
ttickerslist109,2847
-./beta_trade.R,100
-ddata4,34
-rreturns6,143
-RR7,198
-cchol8,220
-eema10,254
-eema.slow15,435
-bbeta.ewm22,625
-
./build_cds_database.R,463
ddrv3,35
ddbCon4,65
@@ -76,53 +67,50 @@ pprep.data62,2278
ssqlstr65,2441
tticker_company75,2878
-./build_portfolios.R,187
+./build_portfolios.R,163
aargs4,38
-ccode.dir11,201
-ccalibration.date37,1206
-iindex39,1277
-iindex40,1306
-gglobal.params41,1355
-ccusipdata43,1438
-ccashspread.discount44,1472
-ccurrdealnames45,1497
+ccalibration.date27,734
+iindex29,805
+iindex30,834
+gglobal.params31,883
+ccusipdata33,958
+ccashspread.discount34,992
+ccurrdealnames35,1017
-./build_scenarios.R,235
+./build_scenarios.R,214
hhostname4,35
aargs11,165
-ccode.dir19,333
-ccalibration.date38,1071
-ssettledate39,1116
-ccalibration40,1154
-ZZ42,1333
-ww43,1352
-NNgrid46,1399
-ssupport47,1412
-nn.scenarios48,1449
-rrecov.adj49,1468
-pparams50,1483
+ccalibration.date33,812
+ssettledate34,857
+ccalibration35,895
+ZZ37,1074
+ww38,1093
+NNgrid41,1140
+ssupport42,1153
+nn.scenarios43,1190
+rrecov.adj44,1209
+pparams45,1224
./calibrate_tranches_BC.R,39
ccode.dir2,32
ttranchedata.dir3,67
-./calibrate_tranches_MF.R,124
+./calibrate_tranches_MF.R,104
aargs5,54
-ccode.dir11,248
-ddata.dir12,283
-iindex30,890
-iindex31,926
-iindex32,968
-iindex34,1036
-ddist37,1163
+ddata.dir11,248
+iindex29,681
+iindex30,717
+iindex31,759
+iindex33,827
+ddist36,954
./calibration.R,141
bbuildSC3,35
gget.cdsSchedule14,418
sset.singlenamesdata25,874
-sset.tranchedata66,2834
-bbuild.skew146,6609
-bbuild.MFdist178,8055
+sset.tranchedata67,2898
+bbuild.skew147,6673
+bbuild.MFdist179,8119
./cds_functions_generic.R,1681
sabstractcurve12,258
@@ -176,25 +164,25 @@ ccdshazardrate.shaped509,23838
ccdshazardrate519,24225
bbondhazardrate.shaped557,25685
ttweakportfolio586,26845
-iindexpv611,27697
-iindexduration653,29416
-iindexspread661,29796
-iindextheta674,30306
-pportfoliospread686,30769
-pportfolioduration712,31974
-ttweakcurves717,32199
-ssurvivalProbability1743,33414
-ssurvivalProbability.exact766,34331
-FFEP784,34906
-SSP792,35248
-SSPmatrix798,35465
-DDP2818,36197
-SSPmatrix2835,36957
-ccreditcurve.maturity854,37719
-fforward.cl867,38050
-fforward.prot874,38292
-ddefaultAdjustedForwardIndexPrice881,38534
-fforwardflatcds890,38897
+iindexpv611,27700
+iindexduration653,29419
+iindexspread661,29799
+iindextheta674,30309
+pportfoliospread686,30772
+pportfolioduration712,31977
+ttweakcurves717,32202
+ssurvivalProbability1743,33417
+ssurvivalProbability.exact766,34334
+FFEP784,34909
+SSP792,35251
+SSPmatrix798,35468
+DDP2818,36200
+SSPmatrix2835,36960
+ccreditcurve.maturity854,37722
+fforward.cl867,38053
+fforward.prot874,38295
+ddefaultAdjustedForwardIndexPrice881,38537
+fforwardflatcds890,38900
./cds_tester.R,172
ccurrency6,93
@@ -237,19 +225,18 @@ ppricesBBB74,2436
ppricesBB79,2576
ppricesNA84,2712
-./creditIndex.R,226
-rroot.dir1,0
-nn.int8,137
-ggh9,150
-NNgrid10,170
-ccreditIndex12,184
-`$<-.creditIndex24,644
-cc.creditIndex31,776
-pprint.creditIndex35,925
-lload.index60,1916
-ccsvheaders73,2322
-ttocsv93,3198
-ttosql106,3826
+./creditIndex.R,207
+nn.int4,76
+ggh5,89
+NNgrid6,109
+ccreditIndex8,123
+`$<-.creditIndex20,583
+cc.creditIndex27,715
+pprint.creditIndex31,864
+lload.index56,1855
+ccsvheaders69,2261
+ttocsv89,3137
+ttosql102,3765
./curve_trades.R,150
iindex.quotes5,48
@@ -338,27 +325,26 @@ ddownload.cdscurves4,39
wwrite.tranchedata21,749
bbbgConn35,1319
-./load_cf.R,404
+./load_cf.R,384
aargs9,128
-rroot.dir11,168
-ttradedate17,284
-iindex27,844
-iindex28,873
-ccalibration.date30,916
-ccs32,988
-ddm35,1127
-ssanitize.column36,1135
-pprocesszipfiles43,1352
-ggetconfig71,2490
-ggetdealcf81,2825
-ggetcusip_indicdata187,7906
-ggetcusipcf210,8974
-ccompute.delta288,12945
-ccfdata325,14360
-ccusipdata329,14565
-ssave.dir330,14622
-ssqlstring335,14806
-ddawndb347,15284
+ttradedate12,222
+iindex22,498
+iindex23,527
+ccalibration.date25,570
+ccs27,642
+ddm30,781
+ssanitize.column31,789
+pprocesszipfiles38,1006
+ggetconfig66,2144
+ggetdealcf76,2479
+ggetcusip_indicdata182,7560
+ggetcusipcf205,8628
+ccompute.delta283,12599
+ccfdata320,14014
+ccusipdata324,14219
+ssave.dir325,14276
+ssqlstring330,14460
+ddawndb342,14938
./load_loanprices_data.R,183
ffields.corp13,339
@@ -472,22 +458,22 @@ ddist29,1160
ddist30,1197
ddistw31,1245
-./pretty_plots.R,281
-rroot.dir2,17
-ddate4,107
-ddists6,127
-ssupport12,332
-ttradedate27,994
-ccalibration.date28,1029
-ggetcusip.pv32,1264
-iindex.pv38,1489
-ggetcusip_indicdata60,2454
-ttradedate83,3522
-ddealname84,3557
-hhy.pv85,3580
-bbally13186,3624
-ssupport90,3875
-ddf92,3927
+./pretty_plots.R,278
+ddate2,17
+rroot.dir3,36
+ddists4,71
+ssupport10,276
+ttradedate25,938
+ccalibration.date26,973
+ggetcusip.pv30,1208
+iindex.pv36,1433
+ggetcusip_indicdata58,2398
+ttradedate81,3466
+ddealname82,3501
+hhy.pv83,3524
+bbally13184,3568
+ssupport88,3819
+ddf90,3871
./reinvestingdistribution.R,190
pp3,31
@@ -521,43 +507,39 @@ ggetlastdate139,5153
gget.indexquotes148,5497
gget.skews154,5776
-./test_options.R,244
-rroot.dir1,0
-ccode.dir2,35
-ttradedate10,482
-iindex12,537
-iindex13,573
-iindex14,615
-ttweakindex17,822
-rref29,1407
-nnewindex30,1418
-hh31,1453
-eexerciseDates32,1526
-ffp34,1615
-ffp235,1625
-ccalib41,1852
-ooption50,2211
+./test_options.R,212
+ttradedate9,168
+iindex11,223
+iindex12,259
+iindex13,301
+ttweakindex16,508
+rref28,1093
+nnewindex29,1104
+hh30,1139
+eexerciseDates31,1212
+ffp33,1301
+ffp234,1311
+ccalib40,1538
+ooption49,1897
-./thetas-curve.R,178
-ccode.dir6,65
-ddata.src12,308
-iindex.closeprice14,383
-gget.maturities27,883
-mmaturities48,1635
-qquotes49,1689
-iindex50,1741
-ssqlstr51,1803
-uunique.dates54,1944
+./thetas-curve.R,162
+ddata.src11,161
+iindex.closeprice13,236
+gget.maturities26,736
+mmaturities47,1488
+qquotes48,1542
+iindex49,1594
+ssqlstr50,1656
+uunique.dates53,1797
-./thetas-durations.R,184
-ccode.dir7,87
-hhostname9,123
-gget.indexquotes.table16,380
-gget.indexmaturity33,1043
-ffastduration42,1417
-ffasttheta58,1873
-ssqlstr.duration81,2657
-ssqlstr.theta83,2803
+./thetas-durations.R,166
+hhostname7,87
+gget.indexquotes.table14,266
+gget.indexmaturity31,929
+ffastduration40,1303
+ffasttheta56,1759
+ssqlstr.duration79,2543
+ssqlstr.theta81,2689
./time_of_default.R,364
sspreads1,0
@@ -623,10 +605,9 @@ MMFlossdist.prepay.joint493,18126
MMFrecovery520,19261
MMFlossdist534,19779
-./tranches_RV_BC.R,53
+./tranches_RV_BC.R,34
ooption_list6,164
aargs20,953
-ccode.dir33,1482
./transactions.R,98
ttransdir1,0
@@ -636,50 +617,39 @@ sstripext4,93
ppurchased17,458
ssold22,633
-./VaR.R,162
-rroot.dir2,32
-ttradedate20,617
-iindex21,656
-rrho23,703
-sskew.shocks25,795
-ppvshocks126,846
-sshock.spreads28,894
-bbefore29,967
-ppv.shocks230,997
+./VaR.R,146
+ttradedate14,285
+iindex15,324
+rrho17,371
+sskew.shocks19,463
+ppvshocks120,514
+sshock.spreads22,562
+bbefore23,635
+ppv.shocks224,665
./xmltotab.R,39
iinput3,70
ttop4,132
ttable5,154
-./yieldcurve.R,123
-rroot.dir2,19
-ggetMarkitIRData10,185
-tthirdwed18,534
-nnextthirdwed24,659
-bbuildMarkitYC29,744
-eexportYC66,1964
+./yieldcurve.R,105
+ggetMarkitIRData4,35
+tthirdwed12,384
+nnextthirdwed18,509
+bbuildMarkitYC23,594
+eexportYC60,1814
-./zerorecovery_index.R,336
-ccode.dir1,0
-ttradedate10,359
-iindex12,421
-iindex13,457
-iindex14,499
-ttweak18,793
-zzerorecov.portfolio19,821
-ccs21,906
-sstartdate22,921
-ppl.list23,948
-ttradedate34,1237
-iindex36,1299
-iindex37,1335
-iindex38,1377
-ttweak42,1671
-zzerorecov.portfolio43,1699
-ccs45,1784
-sstartdate46,1799
-ppl.list47,1826
+./zerorecovery_index.R,177
+zzerorecov.pv10,169
+ddelta24,684
+ttradedate34,1158
+iindex36,1220
+iindex37,1256
+uupfront42,1546
+ttradedate50,1768
+iindex52,1830
+iindex53,1866
+uupfront59,2156
lossdistrib/R/distrib.R,812
GGHquad25,1171
@@ -692,25 +662,25 @@ rrecovdist191,7384
llossdist.joint229,8749
llossdist.prepay.joint256,9707
llossdistC317,12303
-llossdistCZ323,12584
-llossdistC.truncated335,13070
-eexp.trunc343,13391
-rrec.trunc350,13604
-rrecovdistC361,13915
-llossdistC.prepay.joint367,14130
-llossdistC.prepay.jointZ374,14449
-llossrecovdist390,15115
-llossrecovdist.term403,15610
-llossrecovdist.joint.term423,16331
-ddist.transform440,17014
-sshockprob462,17713
-sshockseverity481,18418
-ddshockprob490,18742
-ddqnorm494,18846
-ffit.prob498,18894
-ffit.probC522,19579
-sstochasticrecov529,19804
-sstochasticrecovC540,20254
-BBClossdist547,20551
-BBClossdistC578,21636
-BBCER596,22474
+llossdistCZ324,12591
+llossdistC.truncated335,13078
+eexp.trunc343,13389
+rrec.trunc350,13602
+rrecovdistC361,13913
+llossdistC.prepay.joint367,14128
+llossdistC.prepay.jointZ374,14447
+llossrecovdist390,15113
+llossrecovdist.term403,15608
+llossrecovdist.joint.term423,16329
+ddist.transform440,17012
+sshockprob462,17711
+sshockseverity481,18416
+ddshockprob490,18740
+ddqnorm494,18844
+ffit.prob498,18892
+ffit.probC522,19577
+sstochasticrecov529,19802
+sstochasticrecovC540,20252
+BBClossdist547,20549
+BBClossdistC578,21634
+BBCER596,22472
diff --git a/R/backtest_tranches.R b/R/backtest_tranches.R
index f9614f04..2d4cca30 100644
--- a/R/backtest_tranches.R
+++ b/R/backtest_tranches.R
@@ -1,16 +1,16 @@
args <- commandArgs(trailingOnly=TRUE)
if(.Platform$OS.type == "unix"){
- root.dir <- "/home/share/CorpCDOs"
+ root.dir <- "/home/serenitas/CorpCDOs"
}else{
- root.dir <- "//WDSENTINEL/share/CorpCDOs"
+ root.dir <- "//diskstation/share/CorpCDOs"
}
-source(file.path(root.dir, "code", "R", "cds_utils.R"))
-source(file.path(root.dir, "code", "R", "cds_functions_generic.R"))
-source(file.path(root.dir, "code", "R", "tranche_functions.R"))
-source(file.path(root.dir, "code", "R", "yieldcurve.R"))
-source(file.path(root.dir, "code", "R", "optimization.R"))
+source("cds_utils.R")
+source("cds_functions_generic.R")
+source("tranche_functions.R")
+source("yieldcurve.R")
+source("optimization.R")
load.index("hy21")
## calibrate HY21
diff --git a/R/pretty_plots.R b/R/pretty_plots.R
index 5a46f174..0d3fcba4 100644
--- a/R/pretty_plots.R
+++ b/R/pretty_plots.R
@@ -1,7 +1,6 @@
library(ggplot2)
-source(file.path(Sys.getenv("CODE_DIR"), "R", "load_cf.R"))
date <- Sys.Date()
-
+root.dir <- Sys.getenv("BASE_DIR")
dists <- list()
for(deal in c('ares29', 'bally131')) {
load(file.path(root.dir, "Scenarios", sprintf("Intex Curves_%s", date), "csv", paste(deal, "RData", sep=".")))
diff --git a/R/thetas-curve.R b/R/thetas-curve.R
index 2923c83b..7597925b 100644
--- a/R/thetas-curve.R
+++ b/R/thetas-curve.R
@@ -3,11 +3,10 @@ library(lazyeval)
library(logging)
basicConfig()
-code.dir <- "~/projects/code/"
-source(file.path(code.dir, "R", "yieldcurve.R"))
-source(file.path(code.dir, "R", "calibration.R"), chdir=TRUE)
-source(file.path(code.dir, "R", "serenitasdb.R"))
-source(file.path(code.dir, "R", "creditIndex.R"))
+source("yieldcurve.R")
+source("calibration.R")
+source("serenitasdb.R")
+source("creditIndex.R")
data.src <- src_postgres("serenitasdb", "debian", 5432, "serenitas_user")
diff --git a/R/thetas-durations.R b/R/thetas-durations.R
index f542358f..e4ea3110 100644
--- a/R/thetas-durations.R
+++ b/R/thetas-durations.R
@@ -4,14 +4,12 @@ library(doParallel)
library(dplyr)
library(tidyr)
-code.dir <- Sys.getenv("CODE_DIR")
-
hostname <- system("hostname", intern=TRUE)
registerDoParallel(if(hostname=="debian") 4 else 8)
-source(file.path(code.dir, "R", "serenitasdb.R"))
-source(file.path(code.dir, "R", "cds_functions_generic.R"))
-source(file.path(code.dir, "R", "yieldcurve.R"))
+source("serenitasdb.R")
+source("cds_functions_generic.R")
+source("yieldcurve.R")
get.indexquotes.table <- function(indextype, series, tenors=c("3yr", "5yr", "7yr"),
onlymissing=TRUE) {
diff --git a/R/tranches_RV_BC.R b/R/tranches_RV_BC.R
index 1fd63791..62e648f8 100644
--- a/R/tranches_RV_BC.R
+++ b/R/tranches_RV_BC.R
@@ -27,15 +27,14 @@ if(is.null(args$config)){
runs <- list(mappings=list(c(args$index1, args$tenor1, args$index2, args$tenor2)))
}else{
library(yaml)
- runs <- yaml.load_file(file.path(Sys.getven("CODE_DIR"), "etc", args$config))
+ runs <- yaml.load_file(file.path(Sys.getenv("CODE_DIR"), "etc", args$config))
}
-code.dir <- Sys.getven("CODE_DIR")
-source(file.path(code.dir, "R", "optimization.R"))
-source(file.path(code.dir, "R", "calibration.R"), chdir=TRUE)
-source(file.path(code.dir, "R", "serenitasdb.R"))
-source(file.path(code.dir, "R", "creditIndex.R"))
-source(file.path(code.dir, "R", "tranche_functions.R"))
+source("optimization.R")
+source("calibration.R")
+source("serenitasdb.R")
+source("creditIndex.R")
+source("tranche_functions.R")
for(r in runs$mappings){
index.name1 <- r[1]
diff --git a/R/yieldcurve.R b/R/yieldcurve.R
index 7cf3317b..a73b28bd 100644
--- a/R/yieldcurve.R
+++ b/R/yieldcurve.R
@@ -1,5 +1,5 @@
require(RQuantLib)
-source(file.path(Sys.getenv("CODE_DIR"), "R", "db.R"))
+source("db.R")
getMarkitIRData <- function(date=Sys.Date(), currency=c("USD", "EUR")) {
## returns Markit rates from serenitasdb
diff --git a/R/zerorecovery_index.R b/R/zerorecovery_index.R
index bb9e6658..8e3c039b 100644
--- a/R/zerorecovery_index.R
+++ b/R/zerorecovery_index.R
@@ -1,11 +1,10 @@
-code.dir <- Sys.getenv("CODE_DIR")
library(logging)
-source(file.path(code.dir, "R", "yieldcurve.R"))
-source(file.path(code.dir, "R", "optimization.R"))
-source(file.path(code.dir, "R", "calibration.R"), chdir=TRUE)
-source(file.path(code.dir, "R", "serenitasdb.R"))
-source(file.path(code.dir, "R", "creditIndex.R"))
-source(file.path(code.dir, "R", "tranche_functions.R"))
+source("yieldcurve.R")
+source("optimization.R")
+source("calibration.R")
+source("serenitasdb.R")
+source("creditIndex.R")
+source("tranche_functions.R")
zerorecov.pv <- function(portfolio, cs, tradedate=Sys.Date()) {