12 fix docs #13
Reference in New Issue
Block a user
Delete Branch "12-fix-docs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Come scritto nei commit, ho fatto un pò di pulizia del codice e di chiarezza.
Alcune parti erano da aggiustare (come le chiavi e le env) e quindi le ho messe a posto.
Altre parti ho fatto un refactor, come per esempio l'aggregator (dato che era un pò complesso per quello che faceva) e quindi l'ho ridotto ad una funzione che aggrega i dati che gli arrivano.
Inoltre ho anche aggiunto la funzione di aggregazione delle candele (history)
Gli assert sono stati lasciati come utilizzo di check per i valori. Anche se in produzione è meglio avere un ValueError è più comodo avere degli assert per chiarezza del codice.
La parte di
inspect.getsource()è lasciata per generare un log migliore quando vengono usate le APIPull Request Overview
This PR implements code cleanup and refactoring with the following changes:
timestrings totimestamp_msintegers for consistencyReviewed Changes
Copilot reviewed 37 out of 40 changed files in this pull request and generated 6 comments.
Show a summary per file
@pytest.mark.limitedmarkertimestamp_msinstead oftimetimestamp_msand removed deprecated methodsTip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -23,1 +17,3 @@price.time = str(price_data['time'])price.high = float(price_data.get('high', 0))price.low = float(price_data.get('low', 0))price.open = float(price_data.get('open', 0))Using assertions for API validation is not recommended in production code. Consider raising a more specific exception like
ValueErrororAPIDataErrorinstead.@@ -35,3 +35,3 @@def __init__(self, currency:str='USD'):api_key = os.getenv("CRYPTOCOMPARE_API_KEY")assert api_key is not None, "API key is required"assert api_key, "CRYPTOCOMPARE_API_KEY environment variable not set"Using assertions for API validation is not recommended in production code. Consider raising a more specific exception like
ValueErrororAPIDataErrorinstead.@@ -3,63 +3,29 @@ from agno.tools.yfinance import YFinanceToolsfrom .base import BaseWrapper, ProductInfo, PriceThe comment says the currency is after the '-' but the code takes the part before it (index 0). This logic appears incorrect - for 'BTC-USD', this would set quote_currency to 'BTC' instead of 'USD'.
@@ -48,2 +51,4 @@iterations = 0while iterations < len(self.wrappers):wrapper = self.wrappers[self.index]wrapper_name = wrapper.__class__.__name__Using
inspect.getsource()in production code can be expensive and may fail in some environments (compiled code, frozen executables). Consider logging only essential information like function name.Using
inspect.getsource()in production code can be expensive and may fail in some environments (compiled code, frozen executables). Consider logging only essential information like function name.@@ -0,0 +1,120 @@import pytestDebug print statement should be removed from production test code. Use logging or remove this line entirely.
Pull Request Overview
Copilot reviewed 38 out of 41 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -5,3 +5,3 @@def create_product_info(symbol: str, stock_data: dict) -> ProductInfo:def create_product_info(stock_data: dict[str, str]) -> ProductInfo:"""The type annotation dict[str, str] is too restrictive. The function expects numeric values for price calculations but the annotation suggests all values are strings, which could lead to type errors during float conversion.
@@ -0,0 +88,4 @@if unknown_sources > 0:score *= (1 - unknown_sources / len(sources))return max(0.0, min(1.0, score))The _calculate_confidence function is defined but never used in the codebase. Consider removing this unused function or documenting its intended future use.
@@ -48,2 +51,4 @@iterations = 0while iterations < len(self.wrappers):wrapper = self.wrappers[self.index]wrapper_name = wrapper.__class__.__name__Using inspect.getsource() for logging may have performance implications as it reads and parses source code on every function call. Consider adding a debug flag to conditionally enable this detailed logging.