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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use another augmented assignment statement #523

Open
1 task done
elfring opened this issue Nov 2, 2021 · 0 comments
Open
1 task done

Use another augmented assignment statement #523

elfring opened this issue Nov 2, 2021 · 0 comments
Labels
good first issue Good for newcomers

Comments

@elfring
Copy link

elfring commented Nov 2, 2021

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

馃憖 Some source code analysis tools can help to find opportunities for improving software components.
馃挱 I propose to increase the usage of augmented assignment statements accordingly.

Describe the solution you'd like.

diff --git a/examples/martingale.py b/examples/martingale.py
index dcbcf7a..f4ffcfa 100644
--- a/examples/martingale.py
+++ b/examples/martingale.py
@@ -176,7 +176,7 @@ class MartingaleTrader(object):
                     target_value = total_buying_power - self.last_price
                 target_qty = int(target_value / self.last_price)
                 if self.streak_increasing:
-                    target_qty = target_qty * -1
+                    target_qty *= -1
                 self.send_order(target_qty)
         # Update our account balance
         self.equity = float(self.api.get_account().equity)

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

@haxdds haxdds added the good first issue Good for newcomers label Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants