Skip to content

Conversation

@aexsalomao
Copy link

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
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
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
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
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