Closed haimsitt closed 4 years ago
There isn't a builtin way to do that, but you should be able to create a risk free asset and re-run the optimisation
Thanks for the quick response. How would you define a risk free asset in pandas?
You could create a column with constant returns
If the time series has a constant daily return than the sharpe ratio is infinite.
Do you mean conceptually, or this is the result of a numerical attempt?
An asset with constant returns is the definition of a risk-free asset. Also, the Sharpe ratio is not technically infinite because the numerator will also be zero.
On Thu, Jun 25, 2020 at 10:09 PM haimsitt notifications@github.com wrote:
If the time series has a constant daily return than the sharpe ratio is infinite.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/robertmartin8/PyPortfolioOpt/issues/143#issuecomment-649566151, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZ7ECM27EIY2OTQNFOP2ZDRYNLB7ANCNFSM4OBWD44A .
You are correct. If an asset with a risk free asset has returns that are equal to the risk free returns than the Sharpe ratio is 0. Say you have the weights for the portfolio maximizing the Sharpe ratio. If you use leverage you can achieve a higher Sharpe ratio if you also invest in the risk free asset (depending on your loan rate). Maybe you can add leverage to the max_sharpe function ?
My feature request is partially theoretical, so I will close it for now. Thanks :D
When i use the max_sharpe function it returns the optimal weight for every asset in my dataframe.
Is there a way to find out the optimal weights when investing in the risk free asset and investing in the market?