Skip to content

Clarification suggestion for stats output "Buy" & Hold label in output #150

@blockforcecapital

Description

@blockforcecapital

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:

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

  1. Chose a timeframe where your data series loses value
  2. stats = bt.run() then print (stats)
  3. Buy & Hold Return [%] will show a positive number.

Additional info

  • Backtesting version: 0.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions