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

Adjust 4 statements for the usage of augmented assignments #460

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backtrader/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def _get_subday_cmpkey(self, dt):
point = point * 1e6 + dt.microsecond

# Apply compression to update point position (comp 5 -> 200 // 5)
point = point // self.compression
point //= self.compression

# Move to next boundary
point += 1
Expand Down
2 changes: 1 addition & 1 deletion backtrader/analyzers/drawdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def next(self):
r.max.moneydown = max(r.max.moneydown, moneydown)
r.max.drawdown = maxdrawdown = max(r.max.drawdown, drawdown)

r.len = r.len + 1 if drawdown else 0
r.len += 1 if drawdown else 0
r.max.len = max(r.max.len, r.len)


Expand Down
2 changes: 1 addition & 1 deletion backtrader/indicators/psar.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def next(self):
ep = lo
af = min(af + self.p.af, self.p.afmax)

sar = sar + af * (ep - sar) # calculate the sar for tomorrow
sar += af * (ep - sar) # calculate the sar for tomorrow

# make sure sar doesn't go into hi/lows
if tr: # long trade
Expand Down
2 changes: 1 addition & 1 deletion backtrader/resamplerfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _calcadjtime(self, greater=False):

# Apply compression to update the point position (comp 5 -> 200 // 5)
# point = (point // self.p.compression)
point = point // self.p.compression
point //= self.p.compression

# If rightedge (end of boundary is activated) add it unless recursing
point += self.p.rightedge
Expand Down