-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
First off, Thank you for the wonderful work. This is very useful and I am sure will be appreciated by many. I've dabbled with a few packages for backtesting in python and this is by far my favorite.
The following is just my opinion, and certainly not critical. You commented it in your source code but for beginners, it might be confusing. Here is the line I am referring to:
backtesting.py/backtesting/backtesting.py
Line 1383 in 2bb8f29
| s.loc['Buy & Hold Return [%]'] = abs(c[-1] - c[0]) / c[0] * 100 # long OR short |
Expected Behavior
In a declining market, the stats line "Buy & Hold Return [%]" would normally show a negative return.
Actual Behavior
Instead, the result is calculated based on the absolute value calculation. This could be confusing to some. Perhaps add a new line "Short & Hold Return [%]" or change the line to "Best of (Long or Short) & Hold Return [%]"
Steps to Reproduce
- Chose a timeframe where your data series loses value
- stats = bt.run() then print (stats)
- Buy & Hold Return [%] will show a positive number.
Additional info
- Backtesting version: 0.2.0