Creazione branch tool, refactor degli import e soppressione dei warning

This commit is contained in:
trojanhorse47
2025-09-29 12:22:02 +02:00
parent 4615ebe63e
commit c82f10b32c
11 changed files with 72 additions and 46 deletions

View File

@@ -1,6 +1,6 @@
from app.markets.base import BaseWrapper
from app.markets.coinbase import CoinBaseWrapper
from app.markets.cryptocompare import CryptoCompareWrapper
from src.app.markets.base import BaseWrapper
from src.app.markets.coinbase import CoinBaseWrapper
from src.app.markets.cryptocompare import CryptoCompareWrapper
from agno.utils.log import log_warning
@@ -30,8 +30,8 @@ class MarketAPIs(BaseWrapper):
for wrapper in wrapper_builders:
try:
result.append(wrapper(currency=currency))
except Exception as _:
log_warning(f"{wrapper} cannot be initialized, maybe missing API key?")
except Exception as e:
log_warning(f"{wrapper} cannot be initialized: {e}")
assert result, "No market API keys set in environment variables."
return result
@@ -39,7 +39,9 @@ class MarketAPIs(BaseWrapper):
def __init__(self, currency: str = "USD"):
"""
Inizializza la classe con la valuta di riferimento e la priorità dei provider.
:param currency: Valuta di riferimento (default "USD")
Args:
currency: Valuta di riferimento (default "USD")
"""
self.currency = currency
self.wrappers = MarketAPIs.get_list_available_market_apis(currency=currency)

View File

@@ -1,6 +1,6 @@
import os
from coinbase.rest import RESTClient
from app.markets.base import ProductInfo, BaseWrapper, Price
from src.app.markets.base import ProductInfo, BaseWrapper, Price
class CoinBaseWrapper(BaseWrapper):
"""

View File

@@ -1,6 +1,6 @@
import os
import requests
from app.markets.base import ProductInfo, BaseWrapper, Price
from src.app.markets.base import ProductInfo, BaseWrapper, Price
BASE_URL = "https://min-api.cryptocompare.com"
@@ -8,7 +8,7 @@ class CryptoCompareWrapper(BaseWrapper):
"""
Wrapper per le API pubbliche di CryptoCompare.
La documentazione delle API è disponibile qui: https://developers.coindesk.com/documentation/legacy/Price/SingleSymbolPriceEndpoint
!!ATTENZIONE!! sembra essere una API legacy e potrebbe essere deprecata in futuro.
!ATTENZIONE! Sembra essere una API legacy e potrebbe essere deprecata in futuro.
"""
def __init__(self, api_key:str = None, currency:str='USD'):
if api_key is None: