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

docs updatee #487

Merged
merged 12 commits into from
Jul 7, 2024
Merged

docs updatee #487

merged 12 commits into from
Jul 7, 2024

Conversation

grzesir
Copy link
Contributor

@grzesir grzesir commented Jul 7, 2024

No description provided.

Copy link
Contributor

korbit-ai bot commented Jul 7, 2024

My review is in progress 📖 - I will have feedback for you in a few minutes!

@grzesir grzesir merged commit b954c8e into master Jul 7, 2024
1 of 2 checks passed
Copy link
Contributor

@korbit-ai korbit-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.

I have reviewed your code and found 6 potential issues. To discuss my individual comments that I have added, tag me in replies using @korbit-ai.


Please react with a 👍 to my comments that you find helpful and a 👎 to those you find unhelpful - this will help me learn and improve as we collaborate.

f"Polygon rate limit reached. Sleeping for {PolygonClient.WAIT_SECONDS_RETRY} seconds before trying again. If you want to avoid this, consider a paid subscription with Polygon at https://polygon.io/?utm_source=affiliate&utm_campaign=lumi10 Please use the full link to give us credit for the sale, it helps support this project. You can use the coupon code 'LUMI10' for 10% off.",
"red",
except MaxRetryError as e:
url = urlunparse(urlparse(kwargs['path'])._replace(query=""))
Copy link
Contributor

Choose a reason for hiding this comment

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

category Logging Severity Major

It looks like the log message includes a URL with query parameters. To enhance security, please remove any query parameters from the URL before logging to avoid potential exposure of sensitive information.

@@ -506,7 +511,6 @@ class PolygonClient(RESTClient):
''' Rate Limited RESTClient with factory method '''

WAIT_SECONDS_RETRY = 60
Copy link
Contributor

Choose a reason for hiding this comment

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

category Naming

The variable name 'WAIT_SECONDS_RETRY' in the PolygonClient class could be more descriptive. Consider renaming it to 'RATE_LIMIT_RETRY_DELAY_SECONDS' to clarify that it represents the delay before retrying a request due to rate limiting.

@@ -3904,6 +3904,9 @@ def send_spark_chart_to_discord(self, stats_df, portfolio_value, now, days=180):
# Resanple the stats dataframe to daily but keep the datetime column
stats_df = stats_df.resample("D", on="datetime").last().reset_index()

# Drop the cash column because it's not needed
stats_df = stats_df.drop(columns=["cash"])
Copy link
Contributor

Choose a reason for hiding this comment

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

category Readability and Maintainability

It seems that the 'cash' column is being dropped without checking if it exists in the DataFrame. To improve the robustness of the code, please add a check to ensure the 'cash' column is present before attempting to drop it. This will prevent a KeyError in case the column is not found.

"Polygon rate limit reached.\n\n"
f"REST API call affected: {url}\n\n"
f"Sleeping for {PolygonClient.WAIT_SECONDS_RETRY} seconds seconds before trying again.\n\n"
"If you want to avoid this, consider a paid subscription with Polygon at https://polygon.io/?utm_source=affiliate&utm_campaign=lumi10\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

category Logging

The log message contains an affiliate link. It's generally not a good practice to include such links in log messages. Consider removing it or replacing it with a more generic message about considering a paid subscription.

@@ -5,7 +5,7 @@

setuptools.setup(
name="lumibot",
version="3.5.10",
version="3.5.12",
Copy link
Contributor

Choose a reason for hiding this comment

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

category Documentation

I noticed that the version number has been updated in the setup.py file. It would be helpful to include a brief summary of the changes made in this new version in the pull request summary or in the code comments. This will provide context for the version change and make it easier for others to understand what changes have been made.

logging.error(colored_message)
logging.debug(f"Error: {e}")
time.sleep(PolygonClient.WAIT_SECONDS_RETRY)
Copy link
Contributor

Choose a reason for hiding this comment

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

category Tests

The hard-coded time.sleep(PolygonClient.WAIT_SECONDS_RETRY) call in the _get method of PolygonClient can hinder automated testing by introducing a fixed delay. Consider making this delay configurable through a parameter or environment variable to improve testability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants