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

🎨 and ♻️ ccxt execute_order refactoring #513

Merged
merged 12 commits into from
Sep 9, 2024
Merged

🎨 and ♻️ ccxt execute_order refactoring #513

merged 12 commits into from
Sep 9, 2024

Conversation

mraniki
Copy link
Owner

@mraniki mraniki commented Sep 9, 2024

Summary by Sourcery

Refactor the execute_order method in the CcxtHandler class for improved clarity and efficiency, update method descriptions in the CexClient class, and adjust import paths across various handler files to align with the new module structure.

Enhancements:

  • Refactor the execute_order method in CcxtHandler to improve code readability and maintainability by removing redundant code and simplifying logic.
  • Update the CexClient class to streamline method descriptions and remove unnecessary details about the CCXT library.

Chores:

  • Rename import paths from .client to ._client across multiple handler files to reflect the updated module structure.

Copy link

sourcery-ai bot commented Sep 9, 2024

Reviewer's Guide by Sourcery

This pull request refactors the CCXT execute_order function and makes minor improvements to documentation and code structure across multiple files in the cefi/handler directory. The main changes focus on simplifying the execute_order function, improving error handling, and updating import statements.

File-Level Changes

Change Details Files
Refactored the execute_order function in the CcxtHandler class
  • Simplified the function structure and improved readability
  • Removed unnecessary logging statements
  • Improved error handling and return statements
  • Updated parameter access to use direct dictionary indexing where appropriate
cefi/handler/ccxt.py
Updated import statements across multiple files
  • Changed import from '.client import CexClient' to '._client import CexClient'
cefi/handler/ccxt.py
cefi/handler/ctrader.py
cefi/handler/etoro.py
cefi/handler/metatrader.py
cefi/handler/ninjatrader.py
cefi/handler/thinkorswim.py
cefi/handler/tradestation.py
cefi/handler/tradingview.py
cefi/handler/sierrachart.py
cefi/handler/capitalcom.py
cefi/handler/degiro.py
cefi/handler/fxcm.py
cefi/handler/ibkr.py
cefi/handler/oanda.py
cefi/handler/schwab.py
Improved documentation and comments
  • Updated class and function docstrings
  • Removed redundant comments
  • Added missing function descriptions
cefi/handler/ccxt.py
cefi/handler/_client.py
cefi/handler/ctrader.py
Minor code cleanup and formatting
  • Removed empty lines
  • Fixed indentation
  • Corrected typos in comments
cefi/handler/etoro.py
cefi/handler/metatrader.py
cefi/handler/ninjatrader.py
cefi/handler/thinkorswim.py
cefi/handler/tradestation.py
cefi/handler/tradingview.py
cefi/handler/sierrachart.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @mraniki - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider removing the commented-out code in ccxt.py if it's no longer needed. If it's being kept for reference, add a comment explaining why.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

except Exception as e:
logger.error("{} Error {}", self.name, e)
return f"Error executing {self.name}"

# async def execute_order(self, order_params):
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider removing large blocks of commented-out code

While keeping the old version for reference can be helpful, large blocks of commented code can clutter the file. Consider using version control for this purpose instead.

Suggested change
# async def execute_order(self, order_params):
# Remove this commented-out method declaration

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 40.38462% with 31 lines in your changes missing coverage. Please review.

Project coverage is 66.28%. Comparing base (5e77cd6) to head (aec490b).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
cefi/handler/oanda.py 25.64% 29 Missing ⚠️
cefi/handler/ccxt.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #513      +/-   ##
==========================================
- Coverage   69.40%   66.28%   -3.13%     
==========================================
  Files           8        9       +1     
  Lines         487      519      +32     
==========================================
+ Hits          338      344       +6     
- Misses        149      175      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mraniki mraniki merged commit a6df6bb into main Sep 9, 2024
10 checks passed
This pull request was closed.
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.

1 participant