def cal_beta(): #TODO: name D1M D3M M12M M36M dictD = OrderedDict({ '1M': 15, '3M': 50, '6M': 100, '12M': 200, '24M': 450 }) #TODO: why so many months are lost? refer to betaD.csv dictM = OrderedDict({'12M': 10, '24M': 20, '36M': 24, '60M': 24}) combD, combM = _get_comb() # combD=combD[-800000:] # combM=combM[-40000:] monthly_cal(combD, 'D', dictD, _beta, 'betaD') monthly_cal(combM, 'M', dictM, _beta, 'betaM')
def cal_volatility(): dictD = {'1M': 15, '3M': 50, '6M': 100, '12M': 200, '24M': 450} dictM = {'12M': 10, '24M': 20, '36M': 24, '60M': 24} combD, combM = _get_comb() monthly_cal(combD, 'D', dictD, _vol, 'volD') monthly_cal(combD, 'D', dictD, _volss, 'volssD') monthly_cal(combD, 'D', dictD, _idioVol_capm, 'idioVol_capmD') monthly_cal(combD, 'D', dictD, _idioVol_ff3, 'idioVol_ff3D') monthly_cal(combM, 'M', dictM, _vol, 'volM') monthly_cal(combM, 'M', dictM, _volss, 'volssM') monthly_cal(combM, 'M', dictM, _idioVol_capm, 'idioVol_capmM') monthly_cal(combM, 'M', dictM, _idioVol_ff3, 'idioVol_ff3M') monthly_cal(combM, 'M', dictM, _idioVol_ffc, 'idioVol_ffcM')
def cal_volatility(): dictD = OrderedDict({ '1M': 15, '3M': 50, '6M': 100, '12M': 200, '24M': 450 }) dictM = OrderedDict({'12M': 10, '24M': 20, '36M': 24, '60M': 24}) combD, combM = _get_comb() monthly_cal(combD, 'D', dictD, partial(_vol, square_m=252**0.5), 'volD') monthly_cal(combD, 'D', dictD, partial(_volss, square_m=252**0.5), 'volssD') monthly_cal(combD, 'D', dictD, partial(_idioVol_capm, square_m=252**0.5), 'idioVol_capmD') monthly_cal(combD, 'D', dictD, partial(_idioVol_ff3, square_m=252**0.5), 'idioVol_ff3D') monthly_cal(combM, 'M', dictM, partial(_vol, square_m=12**0.5), 'volM') monthly_cal(combM, 'M', dictM, partial(_volss, square_m=12**0.5), 'volssM') monthly_cal(combM, 'M', dictM, partial(_idioVol_capm, square_m=12**0.5), 'idioVol_capmM') monthly_cal(combM, 'M', dictM, partial(_idioVol_ff3, square_m=12**0.5), 'idioVol_ff3M') monthly_cal(combM, 'M', dictM, partial(_idioVol_ffc, square_m=12**0.5), 'idioVol_ffcM')
def cal_beta(): dictD = {'1M': 15, '3M': 50, '6M': 100, '12M': 200, '24M': 450} dictM = {'12M': 10, '24M': 20, '36M': 24, '60M': 24} combD, combM = _get_comb() monthly_cal(combD, 'D', dictD, _beta, 'betaD') monthly_cal(combM, 'M', dictM, _beta, 'betaM')
def cal_skewnewss(): dictD = OrderedDict({ '1M': 15, '3M': 50, '6M': 100, '12M': 200, '24M': 450 }) dictM = OrderedDict({'12M': 10, '24M': 20, '36M': 24, '60M': 24}) combD, combM = _get_comb() monthly_cal(combD, 'D', dictD, _skew, 'skewD') monthly_cal(combD, 'D', dictD, _coskew, 'coskewD') monthly_cal(combD, 'D', dictD, _idioskew, 'idioskewD') monthly_cal(combM, 'M', dictM, _skew, 'skewM') monthly_cal(combM, 'M', dictM, _coskew, 'coskewM') monthly_cal(combM, 'M', dictM, _idioskew, 'idioskewM')