Skip to content

backtrader_addons/analyzers/trade_list.py : float division by zero  #1

Description

@FGU1

Ab-trader, first of all, thanks for the addons !

I noticed that backtrader_addons/analyzers/trade_list.py can give a divide by 0 error :

line 78, in notify_trade
pbar = pnl / barlen
ZeroDivisionError: float division by zero

I guess this happen when entry and exit occur in the same bar.
Looks like checking barlen for 0 value would be safer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions