Skip to content

Sourcery refactored master branch #5

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jan 21, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from pythonjokeun January 21, 2023 05:06
Comment on lines -90 to -91
else:
pass
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main refactored with the following changes:

Comment on lines -92 to -94
else:
pass

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Indicator.__optimize_signal refactored with the following changes:

Comment on lines -188 to +189
# compute signal with best parameter
data = self.__compute_indicator(
return self.__compute_indicator(
period=self.setting['parameter']['period'],
lower=self.setting['parameter']['lower'],
upper=self.setting['parameter']['upper'])

return data
upper=self.setting['parameter']['upper'],
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Indicator.indicator refactored with the following changes:

This removes the following comments ( why? ):

# compute signal with best parameter

Comment on lines -65 to +89
logger.info('Attempt to buy ' + target + ' @ ' +
'{0:.8f}'.format(price) + ' ' + base)

self.__notify('Attempt to BUY ' + target + ' @ ' +
'{0:.8f}'.format(price) + ' ' + base)
logger.info(
(
(
(
f'Attempt to buy {target} @ '
+ '{0:.8f}'.format(price)
)
+ ' '
)
+ base
)
)

self.__notify(
(
(
(
f'Attempt to BUY {target} @ '
+ '{0:.8f}'.format(price)
)
+ ' '
)
+ base
)
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trade.buy refactored with the following changes:

Comment on lines -135 to +199
logger.info('Attempt to sell ' + target + ' @ ' +
'{0:.8f}'.format(price) + ' ' + base)

self.__notify('Attempt to SELL ' + target + ' @ ' +
'{0:.8f}'.format(price) + ' ' + base)
logger.info(
(
(
(
f'Attempt to sell {target} @ '
+ '{0:.8f}'.format(price)
)
+ ' '
)
+ base
)
)

self.__notify(
(
(
(
f'Attempt to SELL {target} @ '
+ '{0:.8f}'.format(price)
)
+ ' '
)
+ base
)
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trade.sell refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Jan 21, 2023

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.90%.

Quality metrics Before After Change
Complexity 11.51 🙂 10.69 🙂 -0.82 👍
Method Length 134.12 😞 134.00 😞 -0.12 👍
Working memory 2.15 ⭐ 2.10 ⭐ -0.05 👍
Quality 42.90% 😞 43.80% 😞 0.90% 👍
Other metrics Before After Change
Lines 432 505 73
Changed files Quality Before Quality After Quality Change
thewife/__main__.py 43.98% 😞 44.93% 😞 0.95% 👍
thewife/indicator.py 40.11% 😞 40.54% 😞 0.43% 👍
thewife/trade.py 44.90% 😞 46.13% 😞 1.23% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
thewife/indicator.py Indicator.__optimize_signal 22 😞 460 ⛔ 22.18% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
thewife/trade.py Trade.buy 9 🙂 401 ⛔ 38.78% 😞 Try splitting into smaller methods
thewife/__main__.py main 11 🙂 329 ⛔ 10 😞 41.75% 😞 Try splitting into smaller methods. Extract out complex expressions
thewife/trade.py Trade.sell 7 ⭐ 353 ⛔ 42.79% 😞 Try splitting into smaller methods
thewife/indicator.py Indicator.__fetch_ohlcv 1 ⭐ 200 😞 61.51% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

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

Successfully merging this pull request may close these issues.

0 participants