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

🔇 update capitalcom.py and main.py #440

Merged
merged 5 commits into from
Apr 10, 2024
Merged

🔇 update capitalcom.py and main.py #440

merged 5 commits into from
Apr 10, 2024

Conversation

mraniki
Copy link
Owner

@mraniki mraniki commented Apr 10, 2024

No description provided.

@mraniki mraniki enabled auto-merge April 10, 2024 14:32
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 and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Docstrings: 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.

@@ -178,13 +178,15 @@ async def get_order_amount(self, quantity, instrument, is_percentage=True):
logger.debug("Quote {}", quote)

if not is_percentage and balance and quote:
logger.debug("Amount based on money {}", balance * quantity / quote)
Copy link

Choose a reason for hiding this comment

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

suggestion (code_clarification): Consider logging the calculated amount for clarity.

Logging the calculation directly is useful, but it might be clearer to calculate the amount in a separate line, then log it. This can help with debugging and readability.

Suggested change
logger.debug("Amount based on money {}", balance * quantity / quote)
amount_based_on_money = balance * quantity / quote
logger.debug("Amount based on money {}", amount_based_on_money)
return quantity

@@ -250,6 +252,6 @@ async def get_trade_confirmation(self, trade, instrument, action):
trade_confirmation += f"ℹ️ {trade['id']}\n"
trade_confirmation += f"🗓️ {trade['datetime']}"
if trade_confirmation:
return f"{self.name}:\n{trade_confirmation}"
return f"{trade_confirmation}"
Copy link

Choose a reason for hiding this comment

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

suggestion (code_refinement): Redundant string formatting.

The use of f-string is unnecessary here since trade_confirmation is already a string. You can return it directly.

Suggested change
return f"{trade_confirmation}"
return trade_confirmation

Comment on lines +99 to +101
# search_markets = self.client.searching_market(searchTerm=instrument)
await asyncio.sleep(1) # Wait for 1 second
logger.debug("Instrument verification: {}", search_markets)
# logger.debug("Instrument verification: {}", search_markets)
Copy link

Choose a reason for hiding this comment

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

suggestion (code_clarification): Clarify reason for commenting out code.

Commenting out code is acceptable for temporary changes, but it's important to clarify the reason. Consider adding a comment to explain why this code is being disabled, or remove it if it's no longer needed.

Suggested change
# search_markets = self.client.searching_market(searchTerm=instrument)
await asyncio.sleep(1) # Wait for 1 second
logger.debug("Instrument verification: {}", search_markets)
# logger.debug("Instrument verification: {}", search_markets)
# Temporarily disabled the market search and verification logging.
# This might be due to [REASON_FOR_DISABLING]. Consider revisiting.
# search_markets = self.client.searching_market(searchTerm=instrument)
await asyncio.sleep(1) # Wait for 1 second
# logger.debug("Instrument verification: {}", search_markets)

Copy link

codecov bot commented Apr 10, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 71.19%. Comparing base (1923d0e) to head (78df318).

Files Patch % Lines
cefi/handler/client.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #440      +/-   ##
==========================================
- Coverage   71.69%   71.19%   -0.50%     
==========================================
  Files           7        7              
  Lines         431      427       -4     
==========================================
- Hits          309      304       -5     
- Misses        122      123       +1     

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

@mraniki mraniki merged commit b4eac79 into main Apr 10, 2024
10 checks passed
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