Skip to content
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

Daily Mean Hard Coded Definition #168

Open
staymadson opened this issue Jun 9, 2022 · 1 comment
Open

Daily Mean Hard Coded Definition #168

staymadson opened this issue Jun 9, 2022 · 1 comment

Comments

@staymadson
Copy link

staymadson commented Jun 9, 2022

            self.daily_mean = r.mean() * 252
            self.daily_vol = np.std(r, ddof=1) * np.sqrt(252)

            # if type(self.rf) is float:
            if isinstance(self.rf, float):
                self.daily_sharpe = r.calc_sharpe(rf=self.rf, nperiods=252)
                self.daily_sortino = calc_sortino_ratio(r, rf=self.rf, nperiods=252)
            # rf is a price series
            else:
                _rf_daily_price_returns = self.rf.to_returns()
                self.daily_sharpe = r.calc_sharpe(
                    rf=_rf_daily_price_returns, nperiods=252
                )
                self.daily_sortino = calc_sortino_ratio(
                    r, rf=_rf_daily_price_returns, nperiods=252
                )

The yearly return data is hard coded to 252 days which accurately represents trading on the NYSE or other standard markets. However, other markets trade 365 (366) days per year, or somewhere in between (e.g. 6 days a week for futures). The returns should either dynamically adjust based on the time series presented or offer an ability to set the number of trading days.

@timkpaine
Copy link
Collaborator

#145

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

No branches or pull requests

2 participants