Refactor market system and improve app configuration
- Refactor market system from singleton function to class-based architecture with MarketAPIs - Add automatic API key detection for Coinbase and CryptoCompare wrappers - Improve error handling and logging with agno.utils.log throughout the application - Split Models class into separate methods for online and local model availability - Add proper JSON response extraction with thinking pattern support - Enhance ToolAgent with better state management for provider and style selection - Update Gradio app with proper server configuration and logging
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from coinbase.rest import RESTClient
|
||||
from app.markets.base import ProductInfo, BaseWrapper, Price
|
||||
|
||||
@@ -6,8 +7,13 @@ class CoinBaseWrapper(BaseWrapper):
|
||||
Wrapper per le API di Coinbase.
|
||||
La documentazione delle API è disponibile qui: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/introduction
|
||||
"""
|
||||
def __init__(self, api_key:str, api_private_key:str, currency: str = "USD"):
|
||||
def __init__(self, api_key:str = None, api_private_key:str = None, currency: str = "USD"):
|
||||
if api_key is None:
|
||||
api_key = os.getenv("COINBASE_API_KEY")
|
||||
assert api_key is not None, "API key is required"
|
||||
|
||||
if api_private_key is None:
|
||||
api_private_key = os.getenv("COINBASE_API_SECRET")
|
||||
assert api_private_key is not None, "API private key is required"
|
||||
|
||||
self.currency = currency
|
||||
|
||||
Reference in New Issue
Block a user