-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor f-string formatting. #166
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
Conversation
backtesting/_plotting.py
Outdated
f"(index datetime resolution: '{time_resolution}'). " | ||
"Skipping.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"(index datetime resolution: '{time_resolution}'). " | |
"Skipping.", | |
f"(index datetime resolution: '{time_resolution}'). Skipping.", |
backtesting/backtesting.py
Outdated
If size is a value between 0 and 1, it is interpreted as a fraction | ||
of current available liquidity (cash plus `Position.pl` minus used margin). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If size is a value between 0 and 1, it is interpreted as a fraction | |
of current available liquidity (cash plus `Position.pl` minus used margin). | |
If size is a value between 0 and 1, it is interpreted as a fraction of current | |
available liquidity (cash plus `Position.pl` minus used margin). |
backtesting/backtesting.py
Outdated
assert 0 < cash, "cash shosuld be >0, is {}".format(cash) | ||
assert 0 <= commission < .1, "commission should be between 0-10%, is {}".format(commission) | ||
assert 0 < margin <= 1, "margin should be between 0 and 1, is {}".format(margin) | ||
assert 0 < cash, f"cash shosuld be >0, is {cash}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert 0 < cash, f"cash shosuld be >0, is {cash}" | |
assert 0 < cash, f"cash should be >0, is {cash}" |
backtesting/backtesting.py
Outdated
raise ValueError(f"Long orders require: " | ||
f"SL ({sl}) < LIMIT ({limit or stop or self.last_price}) < TP ({tp})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError(f"Long orders require: " | |
f"SL ({sl}) < LIMIT ({limit or stop or self.last_price}) < TP ({tp})") | |
raise ValueError( | |
"Long orders require: " | |
f"SL ({sl}) < LIMIT ({limit or stop or self.last_price}) < TP ({tp})") |
The usual style guidelines say either hanging or indented, but not mixed. Thought flake8 catches that. 🤔
backtesting/backtesting.py
Outdated
raise ValueError(f"Short orders require: " | ||
f"TP ({tp}) < LIMIT ({limit or stop or self.last_price}) < SL ({sl})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError(f"Short orders require: " | |
f"TP ({tp}) < LIMIT ({limit or stop or self.last_price}) < SL ({sl})") | |
raise ValueError( | |
"Short orders require: " | |
f"TP ({tp}) < LIMIT ({limit or stop or self.last_price}) < SL ({sl})") |
Would you care to rebase on / merge in the current master? The PR went out of sync. Also welcome to address the proposed amendments. 😁 |
Fixes: kernc/backtesting.py#161 Closes: kernc/backtesting.py#166 Thanks @Alex-CodeLab Squashed commit of the following: commit 363641d2b827957338ff338564323ebf1ee0e98e Merge: aad278c 773a85f Author: Kernc <kerncece@gmail.com> Date: Thu Nov 12 21:35:41 2020 +0100 Merge branch 'master' commit aad278cb1fe3f206a011817ac9047afc737eb70d Author: Kernc <kerncece@gmail.com> Date: Thu Nov 12 20:42:30 2020 +0100 add some more f-strings where useful commit 4fd6ac51b54a924791fee34c49301fe5618d3769 Author: Kernc <kerncece@gmail.com> Date: Thu Nov 12 20:24:08 2020 +0100 address comments commit 5ab6cb343d768a3874407b85b7bf7c8dd2c6f743 Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 19:40:57 2020 +0100 Update _plotting.py commit 00bb39e5d24f0fd1e47e94062d87ce268834c8cc Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 19:40:02 2020 +0100 Update backtesting.py commit 6c633bcbccd750960d5e5219a6d09b890f3c1639 Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 19:35:55 2020 +0100 Update backtesting.py commit 732068a6a5a3d152584ae32179a355b3611bb6a9 Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 19:26:55 2020 +0100 Update backtesting.py commit 21fed39e3e323cc399194f9e3d4485fb01182346 Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 19:19:25 2020 +0100 Update backtesting.py commit e0b929e308996f41df81ff8339bce94adf4a53aa Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 18:49:30 2020 +0100 Update backtesting.py commit 696669a71f90a355d44d61c4f0e53510b2e68163 Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 18:02:10 2020 +0100 Update backtesting.py commit e38b25f3e7afdfccd5e9aa5fdf5241b95f9cc78c Author: Alex ⚡ <1678423+Alex-CodeLab@users.noreply.github.com> Date: Sat Oct 31 17:42:43 2020 +0100 Update backtesting.py commit 6bd749296ddc9e5202c7765dde0a79323eda2e9b Author: alex <alex.sd3@gmail.com> Date: Sat Oct 31 16:29:38 2020 +0100 Refactor f-string formating.
Use f-string formatting where useful.
Fixes #161