Lista di cryptovalute #36
Reference in New Issue
Block a user
Delete Branch "31-lista-di-cryptovalute"
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?
This pull request introduces a new tool for retrieving cryptocurrency symbols, refactors how market tools are initialized, and removes the currency configuration from the API settings. These changes enhance the flexibility and maintainability of the codebase, particularly in how market data is accessed and managed.
Pull Request Overview
This pull request introduces a new cryptocurrency symbols lookup tool and refactors the market API initialization by removing the hardcoded currency configuration. The main purpose is to enhance flexibility in handling cryptocurrency symbols and improve maintainability by simplifying the currency handling logic.
Key changes:
CryptoSymbolsToolsclass that fetches and caches cryptocurrency symbols from Yahoo Financecurrencyparameter fromMarketAPIsToolinitialization and theAPIConfigclassReviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -57,7 +57,9 @@ class BinanceWrapper(MarketWrapper):"""The
str.index()method raises aValueErrorwhen the substring is not found, rather than returning -1. This will cause a runtime error when processing symbols without a hyphen. Useasset_id.find('-')instead, which returns -1 when not found, or handle theValueErrorexception.@@ -61,7 +61,9 @@ class CoinBaseWrapper(MarketWrapper):)The
str.index()method raises aValueErrorwhen the substring is not found, rather than returning -1. This will cause a runtime error when processing symbols without a hyphen. Useasset_id.find('-')instead, which returns -1 when not found, or handle theValueErrorexception.@@ -47,8 +47,9 @@ class YFinanceWrapper(MarketWrapper):Formatta il simbolo per yfinance.The
str.index()method raises aValueErrorwhen the substring is not found, rather than returning -1. This will cause a runtime error when processing symbols without a hyphen. Useasset_id.find('-')instead, which returns -1 when not found, or handle theValueErrorexception.@@ -0,0 +1,103 @@import osThe return type documentation states 'list[str]' but the actual return type is 'list[tuple[str, str]]'. Update the docstring to reflect the correct return type.
Corrected grammar in comment from 'It looks like is the max' to 'It looks like this is the max'.
@@ -0,0 +20,4 @@def __init__(self, cache_file: str = 'resources/cryptos.csv'):self.cache_file = cache_fileself.final_table = pd.read_csv(self.cache_file) if os.path.exists(self.cache_file) else pd.DataFrame() # type: ignore[nitpick] This line is overly complex with multiple operations. Consider splitting it into separate lines for better readability: check file existence, then read CSV or create empty DataFrame.