Skip to content

Tail hedge#53

Open
aexsalomao wants to merge 3 commits into
Finance-Hub:masterfrom
aexsalomao:tail_hedge
Open

Tail hedge#53
aexsalomao wants to merge 3 commits into
Finance-Hub:masterfrom
aexsalomao:tail_hedge

Conversation

@aexsalomao
Copy link
Copy Markdown

Added DayCount functions


# Volatility, Mean (vol. adjusted)
freq_dict = {'daily': 21, 'weekly': 4, 'monthly': 1}
vols = np.log(df).diff(freq_dict[freq]).std() * np.sqrt(12.)
Copy link
Copy Markdown
Member

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)
Copy link
Copy Markdown
Member

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)
Copy link
Copy Markdown
Member

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]
Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants