-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tail hedge #53
base: master
Are you sure you want to change the base?
Tail hedge #53
Conversation
|
||
# Volatility, Mean (vol. adjusted) | ||
freq_dict = {'daily': 21, 'weekly': 4, 'monthly': 1} | ||
vols = np.log(df).diff(freq_dict[freq]).std() * np.sqrt(12.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ann. factor 12. needs to depend on the frequency chosen. Otherwise, it's wrong.
# Volatility, Mean (vol. adjusted) | ||
freq_dict = {'daily': 21, 'weekly': 4, 'monthly': 1} | ||
vols = np.log(df).diff(freq_dict[freq]).std() * np.sqrt(12.) | ||
mus = (np.log(df).diff(freq_dict[freq]) * 12.).mean().div(vols) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ann. factor 12. needs to depend on the frequency chosen. Otherwise, it's wrong.
|
||
if window: | ||
dd = _window_dd_single(df.iloc[:, 0], window=window) # Fixed window drawdown | ||
ann_factor = 252. / float(window) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this only works for daily data. Please revise.
dc = DayCounts('ACT/360', calendar='us_trading') | ||
if ann_factor is None: | ||
range_d1_d0 = dc.days(start_dates, end_dates) | ||
ann_factor = [365.25 / float(d) for d in range_d1_d0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this only works for daily data. Please revise.
Added DayCount functions