Skip to content

VaR for Long/Short Portfolios #11

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

Open
julius-datajunkie opened this issue Nov 3, 2023 · 1 comment
Open

VaR for Long/Short Portfolios #11

julius-datajunkie opened this issue Nov 3, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@julius-datajunkie
Copy link

Weight supplied that adds to 0 will yield error due to

self.pnl = pd.DataFrame(np.average(self.returns, 1, self.weights),
                        index=self.returns.index,
                        columns=["Daily PnL"])

A workaround that I have used is to change the above to:

self.pnl = pd.DataFrame((self.returns * self.weights).sum(axis=1),
                        index=self.returns.index,
                        columns=["Daily PnL"])

The above change will make the PnL into a long short excess return for the portfolio. However, the backtest() function doesn't yield correct graph though.

@ibaris ibaris added the enhancement New feature or request label Nov 4, 2023
@ibaris ibaris self-assigned this Nov 4, 2023
@ibaris
Copy link
Owner

ibaris commented Nov 4, 2023

That is a very good point! Thank you very much. I will try to implement and include short positions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants