-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Equity Plot legend shows original 100% investment which may cause confusion #178
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
Comments
Yeah, the plot section is called Equity. It's the same in backtrader, bt, and PyAlgoTrade, albeit they show it in absolute currency units. In backtesting.py, dollar amount is available via I've been annoyed with discrepancy in the legend label vs. value in |
:) I hesitated even mentioning it because I knew you had bigger more important things to work on. If you did need a vote, I'd say change it to return but ONLY if and when it was convenient. As a half measure, for readability, you could change the plot section to "Equity Return" and then |
I found a backwards compatible way I like. You can achieve the plot you want with: bt.plot(plot_equity=False, plot_return=True) Somewhat explicit, but it works. I haven't flipped the default because we refer to equity curve in several tutorials, and I didn't feel like diving into all that now. 😄 |
This is excellent. Thanks for that. Speaking of tutorials and documentation, I was thinking that may be a good way for me to help out. As an example, when you roll out 3.0 the new stats table will need to be updated in various areas throughout the documentation and the website, etc. Some I can fix through PRs, others I can just flag and inventory for you. I was also thinking about doing some writing and possibly some YouTube videos for the project, but to be honest, I am a bit self conscious about my crude code so perhaps I could run things by you privately so you can help make sure that I am not teaching people bad python. My thinking was to do a few articles and videos on how an investment manager thinks about and "battle tests" a trading strategy. Focusing more the areas I am comfortable teaching, like the fundamentals of critical thinking and building portfolios of strategies rather than relying on a single strategy to achieve better outcomes. As part of the series, I will use backtesting.py as the core tool to demonstrate and share the code for people to follow along. If you are open to something like this, let me know. I may not start it right away, but then again, I might jump right into it and start creating videos privately until I feel they are ready for public consumption. If you are up for it, you let me know the best contact info for collaboration, you can use my email [email protected] If not, that is perfectly fine as well. |
That should actually be as easy as running: jupyter nbconver --to notebook --execute *.ipynb But, sure, you can do that! Honestly, been meaning to ask you already in #150 (comment) to contrib that notebook comparing strategy to a benchmark strategy, with pyfolio and all! 😃 I'm totally open to any new tutorials that would fit here. Rest assured, any code that lands in this repo would first get to pass a thorough and strict code review, leaving you, if anything, eventually quite satisfied with your coding work. 😛
This, too, would be appreciated, and I think I'd learn a thing or two myself! I—FWIW—am open to any kind of materials you feel like making. If they're good, I have absolutely no reservations about linking to where they're hosted. This might provide some additional exposure to your fund, but it would definitely add to the credibility of this project! 😊 |
Just wanted to let you know I didn't disappear. Just been busy. I'll be circling back to this soon, hopefully in the next few weeks. |
Thanks, I'm definitely looking forward to it! 😊 Do check out the new model-based backtest optimization — might not be wholly your cuppa, but it opens up a world of new opportunities: A previously infeasible optimization of ten parameters with three values each is now almost a breeze. |
Oooh! I'm getting excited. You really are killing it here with this project. I'm very glad to help wherever I can. So, in the interest of keeping the project organized and free of clutter, how should I share things that aren't really issues, but maybe dumb questions about my low-level python/pandas/ etc.? I was thinking, the best way would be for me to
Am I on the right track with this sequence? |
Sure, that works. I'll be watching your fork and get notified of any issues you raise. You also have my email. If some questions are too noobish, you might as well go gather some karma on StackOverflow. I wouldn't mind obtaining some backlinks from there. 😛 When the questions are on-topic and relevant potentially to a wider audience, like some we have already, those are welcome here, of course. |
Perfect, and great point about the backlinks. I'll write some things on Medium blog as well as publish an article or two on Forbes mentioning the project. |
Expected Behavior
Note this is nitpicky but I noticed a few people misunderstanding the legend when I showed it to them so only a focus group of a few, take the following with a grain of salt.
The plot legend shows the peak and final equity value as a % but it doesn't subtract the original 100% from the result. This gives the impression that the peak and final "Return" of the strategy was 100% higher than it actually was. I fully recognize that the use of the word "return" was inferred by my brain, not by the chart, but I don't think I'm alone in keying in on the % sign as an indicator of returns.
This would be fine if it were a "growth of $100" type of chart and used a $ instead of a % However because it is labeled in % (which would be my preference) then perhaps consider subtracting 100% from the legend
Peak %
andFinal %
. I think it is perfectly reasonable to show the y-axis starting at 100% but if you wanted to get technical, you could change it to a 0% starting point so everything lined up.Actual Behavior
The chart shows the percent of the original investment, for example in the image below, the "Peak (690%)" and "Final (689%)" imply 690% and 689% of the original invested amount, not a 690% /689% return. The actual returns would have only been 590%/589% over that time period.
Again, this was just something someone else pointed out to me as a bother and I think tend to agree. It is certainly not a priority or even consensus.
The text was updated successfully, but these errors were encountered: