Skip to content
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

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

Open
FGU1 opened this issue Jul 28, 2020 · 0 comments
Open

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

FGU1 opened this issue Jul 28, 2020 · 0 comments

Comments

@FGU1
Copy link

FGU1 commented Jul 28, 2020

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

@FGU1 FGU1 changed the title float division by zero backtrader_addons/analyzers/trade_list.py : float division by zero Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant