-
Notifications
You must be signed in to change notification settings - Fork 327
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
Provide more advice on how to interpret outputs of portfolio_manager #2
Comments
I'm also curious what negative weights mean for when Some of the weights exceed 100%, which, I assume, the use of leverage/margin loans will make that a possibility. |
Some info about the negative weights: "So the negative weights are just ignored during the forward and back tests. They are there just to show you the raw portfolios without any filtering." 1 |
From the link @edoreld posted:
So reading that correctly let's say I put in 5 stocks and get the following weights:
If I am long-only I can throw away C, it shouldn't be in my portfolio at all. So if I normalize the weights:
So for a $1000 portfolio that would be:
I think an example like that would be really helpful in the README! Or better yet, add a |
Let me back to you folks with a detailed response. Thanks for asking. |
@hatboysam - this is a perfect example so thanks a lot for sharing. So when is_long is set to 1, the weights are not constrained during optimization but during back and forward testing. When you build a long only portfolio, you can simple ignore the negative weights because that is what's happening during the testing. As for an example, I think @hatboysam has a pretty good one, that's exactly how everything is working right now. I would let someone else add a PR though if there is any interest in adding an example in the readme? |
@tradytics happy to do a PR but I actually don't understand how weights would work if short positions are allowed. Let's use the above example again. Would all of the long positions stay the same and I'd just add a $250 short position to the portfolio? Or would the size of all positions change? Also a follow up from my original question: does the algorithm assume rebalancing at any point or are these pure buy-and-hold portfolios? |
First thank you. It's very interesting. Same question as hatboysam about rebalancing : daily, monthly, never? |
For the author to confirm, but in my understanding:
|
@hatboysam if you just want to use longs, you can discard negative values and the weights would be the same. Likewise if you just want to use shorts. If you want to use both, just sum up the positive then sum up the absolute of the negatives. the sum of positives plus the sum of abs negatives is the total weight. Divide each part by the total weight and you will get the money proportion for longs and shorts. Now you can easily find the money allocation by dividing each positive weight by the sum of positives and so on... As @edoreld correctly mentioned, this algorithm does NOT consider re-balancing as of right now. You woud have to run it in shorter periods of time to find how to rebalance your portfolio. |
First of all thank you! This tool was so easy to get up and running, despite the obvious underlying complexity.
After running
portfolio_manager.py
on a few different stock lists I am left with the following simple questions:README
only explains the former, I am having trouble interpreting the latter. They seem to be wildly different!The text was updated successfully, but these errors were encountered: