-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
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.
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
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) |
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.
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.
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}" |
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.
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.
return f"{trade_confirmation}" | |
return trade_confirmation |
# 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) |
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.
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.
# 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) |
Codecov ReportAttention: Patch coverage is
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. |
No description provided.