From fc0ba1e37d63e6d6b8b93f39df921fdb90edec5d Mon Sep 17 00:00:00 2001 From: Berack96 Date: Mon, 29 Sep 2025 21:06:50 +0200 Subject: [PATCH 1/6] Add demo scripts for Coinbase and CryptoCompare; remove outdated market agent demo --- demos/{example.py => agno_demo.py} | 10 ++- demos/cdp_market_demo.py | 116 ----------------------------- demos/coinbase_demo.py | 36 +++++++++ demos/cryptocompare_demo.py | 36 +++++++++ demos/market_agent_demo.py | 100 ------------------------- src/app/markets/cryptocompare.py | 2 +- 6 files changed, 80 insertions(+), 220 deletions(-) rename demos/{example.py => agno_demo.py} (67%) delete mode 100644 demos/cdp_market_demo.py create mode 100644 demos/coinbase_demo.py create mode 100644 demos/cryptocompare_demo.py delete mode 100644 demos/market_agent_demo.py diff --git a/demos/example.py b/demos/agno_demo.py similarity index 67% rename from demos/example.py rename to demos/agno_demo.py index c1fa08c..38b29ce 100644 --- a/demos/example.py +++ b/demos/agno_demo.py @@ -1,3 +1,9 @@ +#### FOR ALL FILES OUTSIDE src/ FOLDER #### +import sys +import os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) +########################################### + from agno.agent import Agent from agno.models.google import Gemini from agno.tools.reasoning import ReasoningTools @@ -8,9 +14,7 @@ try: reasoning_agent = Agent( model=Gemini(), - tools=[ - ReasoningTools(), - ], + tools=[ReasoningTools()], instructions="Use tables to display data.", markdown=True, ) diff --git a/demos/cdp_market_demo.py b/demos/cdp_market_demo.py deleted file mode 100644 index 307d02f..0000000 --- a/demos/cdp_market_demo.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python3 -""" -Demo script per testare il MarketAgent aggiornato con Coinbase CDP -""" - -import sys -import os -sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) - -from src.app.agents.market_agent import MarketAgent -import logging - -# Setup logging -logging.basicConfig( - level=logging.INFO, - format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' -) - -def main(): - print("๐Ÿš€ Test MarketAgent con Coinbase CDP") - print("=" * 50) - - # Inizializza l'agent - agent = MarketAgent() - - # Verifica provider disponibili - providers = agent.get_available_providers() - print(f"๐Ÿ“ก Provider disponibili: {providers}") - - if not providers: - print("โš ๏ธ Nessun provider configurato. Verifica il file .env") - print("\nPer Coinbase CDP, serve:") - print("CDP_API_KEY_NAME=your_key_name") - print("CDP_API_PRIVATE_KEY=your_private_key") - print("\nPer CryptoCompare, serve:") - print("CRYPTOCOMPARE_API_KEY=your_api_key") - return - - # Mostra capabilities di ogni provider - for provider in providers: - capabilities = agent.get_provider_capabilities(provider) - print(f"๐Ÿ”ง {provider.upper()}: {capabilities}") - - print("\n" + "=" * 50) - - # Test ottenimento prezzo singolo - test_symbols = ["BTC", "ETH", "ADA"] - - for symbol in test_symbols: - print(f"\n๐Ÿ’ฐ Prezzo {symbol}:") - - # Prova ogni provider - for provider in providers: - try: - price = agent.get_asset_price(symbol, provider) - if price: - print(f" {provider}: ${price:,.2f}") - else: - print(f" {provider}: N/A") - except Exception as e: - print(f" {provider}: Errore - {e}") - - print("\n" + "=" * 50) - - # Test market overview - print("\n๐Ÿ“Š Market Overview:") - try: - overview = agent.get_market_overview(["BTC", "ETH", "ADA", "DOT"]) - - if overview["data"]: - print(f"๐Ÿ“ก Fonte: {overview['source']}") - - for crypto, prices in overview["data"].items(): - if isinstance(prices, dict): - usd_price = prices.get("USD", "N/A") - eur_price = prices.get("EUR", "N/A") - - if eur_price != "N/A": - print(f" {crypto}: ${usd_price} (โ‚ฌ{eur_price})") - else: - print(f" {crypto}: ${usd_price}") - else: - print("โš ๏ธ Nessun dato disponibile") - - except Exception as e: - print(f"โŒ Errore nel market overview: {e}") - - print("\n" + "=" * 50) - - # Test funzione analyze - print("\n๐Ÿ” Analisi mercato:") - try: - analysis = agent.analyze("Market overview") - print(analysis) - except Exception as e: - print(f"โŒ Errore nell'analisi: {e}") - - # Test specifico Coinbase CDP se disponibile - if 'coinbase' in providers: - print("\n" + "=" * 50) - print("\n๐Ÿฆ Test specifico Coinbase CDP:") - - try: - # Test asset singolo - btc_info = agent.get_coinbase_asset_info("BTC") - print(f"๐Ÿ“ˆ BTC Info: {btc_info}") - - # Test asset multipli - multi_assets = agent.get_coinbase_multiple_assets(["BTC", "ETH"]) - print(f"๐Ÿ“Š Multi Assets: {multi_assets}") - - except Exception as e: - print(f"โŒ Errore nel test Coinbase CDP: {e}") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/demos/coinbase_demo.py b/demos/coinbase_demo.py new file mode 100644 index 0000000..8b6bd41 --- /dev/null +++ b/demos/coinbase_demo.py @@ -0,0 +1,36 @@ +#### FOR ALL FILES OUTSIDE src/ FOLDER #### +import sys +import os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) +########################################### + +from dotenv import load_dotenv +from app.markets import CoinBaseWrapper + +def main(): + print("Demo Coinbase CDP") + + print("=== Chiavi API ===") + print(f" COINBASE_API_KEY: {os.getenv('COINBASE_API_KEY') is not None}") + print(f" COINBASE_API_SECRET: {os.getenv('COINBASE_API_SECRET') is not None}") + + # Inizializza le API + coinbase = CoinBaseWrapper() + + # ottenimento prezzo attuale + print("=== Demo prezzo attuale ===") + test_symbols = ["BTC", "ETH", "ADA"] + for symbol in test_symbols: + info = coinbase.get_product(symbol) + print(f" {symbol}: ${info.price:,.2f}") + + # ottenimento prezzi storici + print("\n=== Demo prezzi storici ===") + test_symbols = ["BTC", "ETH"] + for symbol in test_symbols: + prices = coinbase.get_historical_prices(symbol) + print(f" {symbol}: {" ".join([f'${entry["price"]:,.2f}' for entry in prices[:5]])}") # mostra solo i primi 5 + +if __name__ == "__main__": + load_dotenv() + main() diff --git a/demos/cryptocompare_demo.py b/demos/cryptocompare_demo.py new file mode 100644 index 0000000..f929b87 --- /dev/null +++ b/demos/cryptocompare_demo.py @@ -0,0 +1,36 @@ +#### FOR ALL FILES OUTSIDE src/ FOLDER #### +import sys +import os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) +########################################### + +from dotenv import load_dotenv +from app.markets.cryptocompare import CryptoCompareWrapper + +def main(): + print("Demo CryptoCompare") + + print("=== Chiavi API ===") + print(f" CRYPTOCOMPARE_API_KEY: {os.getenv('CRYPTOCOMPARE_API_KEY') is not None}") + + # Inizializza le API + cryptocompare = CryptoCompareWrapper() + + # ottenimento prezzo attuale + print("=== Demo prezzo attuale ===") + test_symbols = ["BTC", "ETH", "ADA"] + for symbol in test_symbols: + info = cryptocompare.get_product(symbol) + print(f" {symbol}: ${info.price:,.2f}") + + # ottenimento prezzi storici + print("=== Demo prezzi storici ===") + test_symbols = ["BTC", "ETH"] + for symbol in test_symbols: + prices = cryptocompare.get_historical_prices(symbol) + prices = [f'[${entry.high:,.2f}-${entry.low:,.2f}]' for entry in prices] + print(f" {symbol}: {" ".join(prices[:5])}") # mostra solo i primi 5 + +if __name__ == "__main__": + load_dotenv() + main() \ No newline at end of file diff --git a/demos/market_agent_demo.py b/demos/market_agent_demo.py deleted file mode 100644 index 1ef8f21..0000000 --- a/demos/market_agent_demo.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python3 -""" -Esempio di utilizzo del MarketAgent unificato. -Questo script mostra come utilizzare il nuovo MarketAgent che supporta -multiple fonti di dati (Coinbase e CryptoCompare). -""" - -import sys -from pathlib import Path - -# Aggiungi il path src al PYTHONPATH -src_path = Path(__file__).parent / "src" -sys.path.insert(0, str(src_path)) - -from dotenv import load_dotenv -from app.agents.market_agent import MarketAgent - -# Carica variabili d'ambiente -load_dotenv() - -def main(): - print("๐Ÿš€ Market Agent Demo\n") - - try: - # Inizializza il market agent (auto-configura i provider disponibili) - agent = MarketAgent() - - # Mostra provider disponibili - providers = agent.get_available_providers() - print(f"๐Ÿ“ก Available providers: {providers}") - - if not providers: - print("โŒ No providers configured. Please check your .env file.") - print("Required variables:") - print(" For Coinbase: COINBASE_API_KEY, COINBASE_SECRET, COINBASE_PASSPHRASE") - print(" For CryptoCompare: CRYPTOCOMPARE_API_KEY") - return - - # Mostra le capacitร  di ogni provider - print("\n๐Ÿ”ง Provider capabilities:") - for provider in providers: - capabilities = agent.get_provider_capabilities(provider) - print(f" {provider}: {capabilities}") - - # Ottieni panoramica del mercato - print("\n๐Ÿ“Š Market Overview:") - overview = agent.get_market_overview(["BTC", "ETH", "ADA"]) - print(f"Data source: {overview.get('source', 'Unknown')}") - - for crypto, prices in overview.get('data', {}).items(): - if isinstance(prices, dict): - usd = prices.get('USD', 'N/A') - eur = prices.get('EUR', 'N/A') - if eur != 'N/A': - print(f" {crypto}: ${usd} (โ‚ฌ{eur})") - else: - print(f" {crypto}: ${usd}") - - # Analisi completa del mercato - print("\n๐Ÿ“ˆ Market Analysis:") - analysis = agent.analyze("comprehensive market analysis") - print(analysis) - - # Test specifici per provider (se disponibili) - if 'cryptocompare' in providers: - print("\n๐Ÿ”ธ CryptoCompare specific test:") - try: - btc_price = agent.get_single_crypto_price("BTC", "USD") - print(f" BTC price: ${btc_price}") - - top_coins = agent.get_top_cryptocurrencies(5) - if top_coins.get('Data'): - print(" Top 5 cryptocurrencies by market cap:") - for coin in top_coins['Data'][:3]: # Show top 3 - coin_info = coin.get('CoinInfo', {}) - display = coin.get('DISPLAY', {}).get('USD', {}) - name = coin_info.get('FullName', 'Unknown') - price = display.get('PRICE', 'N/A') - print(f" {name}: {price}") - except Exception as e: - print(f" CryptoCompare test failed: {e}") - - if 'coinbase' in providers: - print("\n๐Ÿ”ธ Coinbase specific test:") - try: - ticker = agent.get_coinbase_ticker("BTC-USD") - price = ticker.get('price', 'N/A') - volume = ticker.get('volume_24h', 'N/A') - print(f" BTC-USD: ${price} (24h volume: {volume})") - except Exception as e: - print(f" Coinbase test failed: {e}") - - print("\nโœ… Demo completed successfully!") - - except Exception as e: - print(f"โŒ Demo failed: {e}") - print("Make sure you have configured at least one provider in your .env file.") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/src/app/markets/cryptocompare.py b/src/app/markets/cryptocompare.py index 188a2c2..aa220fa 100644 --- a/src/app/markets/cryptocompare.py +++ b/src/app/markets/cryptocompare.py @@ -49,7 +49,7 @@ class CryptoCompareWrapper(BaseWrapper): def get_all_products(self) -> list[ProductInfo]: raise NotImplementedError("CryptoCompare does not support fetching all assets") - def get_historical_prices(self, asset_id: str, day_back: int = 10) -> list[dict]: + def get_historical_prices(self, asset_id: str, day_back: int = 10) -> list[Price]: assert day_back <= 30, "day_back should be less than or equal to 30" response = self.__request("/data/v2/histohour", params = { "fsym": asset_id, -- 2.49.1 From 38b84893797360cb849ac9b976b10b2ebb7cc9ad Mon Sep 17 00:00:00 2001 From: Berack96 Date: Wed, 22 Oct 2025 09:07:44 +0200 Subject: [PATCH 2/6] remove old docs --- docs/Async_Implementation_Detail.md | 203 ------------------------ docs/Market_Data_Implementation_Plan.md | 96 ----------- docs/Piano di Sviluppo.md | 73 --------- 3 files changed, 372 deletions(-) delete mode 100644 docs/Async_Implementation_Detail.md delete mode 100644 docs/Market_Data_Implementation_Plan.md delete mode 100644 docs/Piano di Sviluppo.md diff --git a/docs/Async_Implementation_Detail.md b/docs/Async_Implementation_Detail.md deleted file mode 100644 index 9642dff..0000000 --- a/docs/Async_Implementation_Detail.md +++ /dev/null @@ -1,203 +0,0 @@ -# ๐Ÿš€ Diagramma Dettaglio: Implementazione Asincrona - -## โšก Async Market Data Collection (Fase 3) - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ”ง TOOL AGENT โ”‚ -โ”‚ โ”‚ -โ”‚ async def interact(query, provider, style): โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“Š market_data = await market_agent.analyze_async() โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ฐ news_data = await news_agent.analyze_async() โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿฆ social_data = await social_agent.analyze_async() โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿค– prediction = await predictor.predict_async(...) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ“Š MARKET AGENT - ASYNC IMPLEMENTATION โ”‚ -โ”‚ โ”‚ -โ”‚ async def analyze_async(self, query): โ”‚ -โ”‚ symbols = extract_symbols(query) # ["BTC", "ETH"] โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿ”„ tasks = [ โ”‚ -โ”‚ โ”‚ self._query_coinbase_async(symbols), โ”‚ -โ”‚ โ”‚ self._query_cryptocompare_async(symbols), โ”‚ -โ”‚ โ”‚ self._query_binance_async(symbols) โ”‚ -โ”‚ โ”‚ ] โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿ“Š results = await asyncio.gather(*tasks) โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ–ผ โ”‚ -โ”‚ ๐Ÿงฎ aggregate_results(results) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ โฑ๏ธ TIMING DIAGRAM โ”‚ -โ”‚ โ”‚ -โ”‚ Time: 0ms 500ms 1000ms 1500ms 2000ms โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ ๐Ÿ“ก Start all requests โ”‚ -โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿฆ Coinbase Request โ”‚ โ”‚ -โ”‚ โ”‚ โœ… Response โ”‚ (1.2s) โ”‚ -โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ“Š CryptoCompare Request โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โœ… Response (0.8s) โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ ๐ŸŸก Binance โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โœ… Response (0.3s - mock) โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ Wait for all... โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ ๐Ÿงฎ Aggregate (1.2s total) โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿ“ˆ Performance Gain: โ”‚ -โ”‚ Sequential: 1.2s + 0.8s + 0.3s = 2.3s โ”‚ -โ”‚ Parallel: max(1.2s, 0.8s, 0.3s) = 1.2s โ”‚ -โ”‚ Improvement: ~48% faster! ๐Ÿš€ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - -## ๐Ÿงฎ Aggregation Algorithm Detail - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ”ฌ DATA AGGREGATION LOGIC โ”‚ -โ”‚ โ”‚ -โ”‚ def aggregate_market_data(results): โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“Š Input Data: โ”‚ -โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ โ”‚ coinbase: {"BTC": 63500, "ETH": 4150} โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ cryptocomp: {"BTC": 63450, "ETH": 4160} โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ binance: {"BTC": 63600, "ETH": 4140} โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿงฎ Price Calculation: โ”‚ -โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ โ”‚ BTC_prices = [63500, 63450, 63600] โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ BTC_avg = 63516.67 โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ BTC_std = 75.83 โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ BTC_spread = (max-min)/avg = 0.24% โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐ŸŽฏ Confidence Scoring: โ”‚ -โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ โ”‚ confidence = 1 - (std_dev / mean) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ if spread < 0.5%: confidence += 0.1 โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ if sources >= 3: confidence += 0.05 โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ BTC_confidence = 0.94 (excellent!) โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿ“ˆ Market Signals: โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ spread_analysis: โ”‚ โ”‚ -โ”‚ โ”‚ "Low spread (0.24%) indicates healthy liq." โ”‚ โ”‚ -โ”‚ โ”‚ volume_trend: โ”‚ โ”‚ -โ”‚ โ”‚ "Combined volume: 4.1M USD" โ”‚ โ”‚ -โ”‚ โ”‚ price_divergence: โ”‚ โ”‚ -โ”‚ โ”‚ "Max deviation: 0.24% - Normal range" โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - -## ๐Ÿ”„ Error Handling & Resilience - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ›ก๏ธ RESILIENCE STRATEGY โ”‚ -โ”‚ โ”‚ -โ”‚ Scenario 1: One Provider Fails โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿฆ Coinbase: โœ… Success (BTC: $63500) โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ“Š CryptoComp: โŒ Timeout/Error โ”‚ โ”‚ -โ”‚ โ”‚ ๐ŸŸก Binance: โœ… Success (BTC: $63600) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Result: Continue with 2 sources โ”‚ โ”‚ -โ”‚ โ”‚ Confidence: 0.89 (slightly reduced) โ”‚ โ”‚ -โ”‚ โ”‚ Note: "CryptoCompare unavailable" โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ Scenario 2: Multiple Providers Fail โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿฆ Coinbase: โŒ API Limit โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ“Š CryptoComp: โœ… Success (BTC: $63450) โ”‚ โ”‚ -โ”‚ โ”‚ ๐ŸŸก Binance: โŒ Network Error โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Result: Single source data โ”‚ โ”‚ -โ”‚ โ”‚ Confidence: 0.60 (low - warn user) โ”‚ โ”‚ -โ”‚ โ”‚ Note: "Limited data - consider waiting" โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ Scenario 3: All Providers Fail โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿฆ Coinbase: โŒ Maintenance โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ“Š CryptoComp: โŒ API Down โ”‚ โ”‚ -โ”‚ โ”‚ ๐ŸŸก Binance: โŒ Rate Limit โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Result: Graceful degradation โ”‚ โ”‚ -โ”‚ โ”‚ Message: "Market data temporarily unavailable" โ”‚ โ”‚ -โ”‚ โ”‚ Fallback: Cached data (if available) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - -## ๐Ÿ“Š JSON Output Schema - -```json -{ - "aggregated_data": { - "BTC_USD": { - "price": 63516.67, - "confidence": 0.94, - "sources_count": 3, - "last_updated": "2025-09-23T17:30:00Z" - }, - "ETH_USD": { - "price": 4150.33, - "confidence": 0.91, - "sources_count": 3, - "last_updated": "2025-09-23T17:30:00Z" - } - }, - "individual_sources": { - "coinbase": { - "BTC": {"price": 63500, "volume": "1.2M", "status": "online"}, - "ETH": {"price": 4150, "volume": "25.6M", "status": "online"} - }, - "cryptocompare": { - "BTC": {"price": 63450, "volume": "N/A", "status": "active"}, - "ETH": {"price": 4160, "volume": "N/A", "status": "active"} - }, - "binance": { - "BTC": {"price": 63600, "volume": "2.1M", "status": "mock"}, - "ETH": {"price": 4140, "volume": "18.3M", "status": "mock"} - } - }, - "market_signals": { - "spread_analysis": "Low spread (0.24%) indicates healthy liquidity", - "volume_trend": "Combined BTC volume: 3.3M USD (+12% from avg)", - "price_divergence": "Max deviation: 0.24% - Normal range", - "data_quality": "High - 3 sources, low variance", - "recommendation": "Data suitable for trading decisions" - }, - "metadata": { - "query_time_ms": 1247, - "sources_queried": ["coinbase", "cryptocompare", "binance"], - "sources_successful": ["coinbase", "cryptocompare", "binance"], - "sources_failed": [], - "aggregation_method": "weighted_average", - "confidence_threshold": 0.75 - } -} -``` - ---- -*Diagramma dettaglio asincrono: 2025-09-23* -*Focus: Performance, Resilienza, Qualitร  Dati* \ No newline at end of file diff --git a/docs/Market_Data_Implementation_Plan.md b/docs/Market_Data_Implementation_Plan.md deleted file mode 100644 index e494ca7..0000000 --- a/docs/Market_Data_Implementation_Plan.md +++ /dev/null @@ -1,96 +0,0 @@ -# ๐Ÿš€ Piano di Implementazione - Market Data Enhancement - -## ๐Ÿ“‹ Roadmap Implementazioni - -### **Fase 1: Binance Mock Provider** -**Obiettivo**: Aggiungere terzo provider per test aggregazione -- โœ… Creare `binance_signer.py` con mock data -- โœ… Integrare nel MarketAgent -- โœ… Testare detection automatica provider -- **Deliverable**: 3 provider funzionanti (Coinbase, CryptoCompare, Binance) - -### **Fase 2: Interrogazione Condizionale** -**Obiettivo**: Auto-detection credenziali e interrogazione intelligente -- โœ… Migliorare detection chiavi API nel MarketAgent -- โœ… Skip provider se credenziali mancanti (no errori) -- โœ… Logging informativo per provider disponibili/non disponibili -- โœ… Gestione graceful degradation -- **Deliverable**: Sistema resiliente che funziona con qualsiasi combinazione di provider - -### **Fase 3: Interrogazione Asincrona + Aggregazione JSON** -**Obiettivo**: Performance boost e formato dati professionale - -#### **3A. Implementazione Asincrona** -- โœ… Refactor MarketAgent per supporto `async/await` -- โœ… Chiamate parallele a tutti i provider disponibili -- โœ… Timeout management per provider lenti -- โœ… Error handling per provider che falliscono - -#### **3B. Aggregazione Dati Intelligente** -- โœ… Calcolo `confidence` basato su concordanza prezzi -- โœ… Analisi `spread` tra provider -- โœ… Detection `price_divergence` per anomalie -- โœ… Volume trend analysis -- โœ… Formato JSON strutturato: - -```json -{ - "aggregated_data": { - "BTC_USD": { - "price": 43250.12, - "confidence": 0.95, - "sources_count": 4 - } - }, - "individual_sources": { - "coinbase": {"price": 43245.67, "volume": "1.2M"}, - "binance": {"price": 43255.89, "volume": "2.1M"}, - "cryptocompare": {"price": 43248.34, "volume": "0.8M"} - }, - "market_signals": { - "spread_analysis": "Low spread (0.02%) indicates healthy liquidity", - "volume_trend": "Volume up 15% from 24h average", - "price_divergence": "Max deviation: 0.05% - Normal range" - } -} -``` - -**Deliverable**: Sistema asincrono con analisi avanzata dei dati di mercato - -## ๐ŸŽฏ Benefici Attesi - -### **Performance** -- โšก Tempo risposta: da ~4s sequenziali a ~1s paralleli -- ๐Ÿ”„ Resilienza: sistema funziona anche se 1-2 provider falliscono -- ๐Ÿ“Š Qualitร  dati: validazione incrociata tra provider - -### **Professionalitร ** -- ๐Ÿ“ˆ Confidence scoring per decisioni informate -- ๐Ÿ” Market signals per trading insights -- ๐Ÿ“‹ Formato standardizzato per integrazioni future - -### **Scalabilitร ** -- โž• Facile aggiunta nuovi provider -- ๐Ÿ”ง Configurazione flessibile via environment -- ๐Ÿ“ Logging completo per debugging - -## ๐Ÿงช Test Strategy - -1. **Unit Tests**: Ogni provider singolarmente -2. **Integration Tests**: Aggregazione multi-provider -3. **Performance Tests**: Confronto sync vs async -4. **Resilience Tests**: Fallimento provider singoli -5. **E2E Tests**: Full workflow con UI Gradio - -## ๐Ÿ“… Timeline Stimata - -- **Fase 1**: ~1h (setup Binance mock) -- **Fase 2**: ~1h (detection condizionale) -- **Fase 3**: ~2-3h (async + aggregazione) -- **Testing**: ~1h (validation completa) - -**Total**: ~5-6h di lavoro strutturato - ---- -*Documento creato: 2025-09-23* -*Versione: 1.0* \ No newline at end of file diff --git a/docs/Piano di Sviluppo.md b/docs/Piano di Sviluppo.md deleted file mode 100644 index c4b1a51..0000000 --- a/docs/Piano di Sviluppo.md +++ /dev/null @@ -1,73 +0,0 @@ -# Guida alla Realizzazione del Progetto - -Questa guida รจ una lista di controllo per l'implementazione del tuo progetto. รˆ divisa in fasi logiche, ognuna con i compiti specifici da svolgere. - -## Fase 1: Preparazione e Architettura di Base - -### Impostazione dell'ambiente - -* Scegliere il linguaggio di programmazione (es. **Python**). -* Utilizzare la libreria `agno` per la creazione di agenti e **LangChain/LlamaIndex** per la gestione dell'LLM e dell'orchestrazione. - -### Definizione dell'Architettura degli agenti - -* Definire la classe base per gli agenti, con metodi comuni come `execute()` e `reason()`. -* Delineare i ruoli e le interfacce di tutti gli agenti (`RicercatoreDati`, `AnalistaSentiment`, `MotorePredittivo`, `Orchestratore`), stabilendo come comunicheranno tra loro. - ---- - -## Fase 2: Implementazione degli Agenti Core - -### Agente `RicercatoreDati` - -* Implementare la logica per connettersi a un'API di exchange (es. **Binance, Coindesk, CoinMarketCap**). -* Testare la capacitร  di recuperare dati in tempo reale per diverse criptovalute (prezzo, volume, capitalizzazione) e **assicurarsi che la gestione degli errori sia robusta**. - -### Agente `AnalistaSentiment` - -* **Agente `Social`:** - * Scegliere un metodo per lo scraping di forum e social media (es. **Reddit API, librerie per Twitter/X, BeautifulSoup per web scraping**). - * Implementare un modulo di analisi del testo per classificare il sentiment (positivo, negativo, neutro) utilizzando **modelli pre-addestrati (es. VADER) o fine-tuning di modelli piรน avanzati**. -* **Agente `News`:** - * Ottenere una chiave API per un servizio di notizie (es. **NewsAPI**). - * Implementare la logica per cercare articoli pertinenti a una criptovaluta specifica o al mercato in generale, e **filtrare le notizie in base a parole chiave rilevanti**. - -### Agente `MotorePredittivo` - -* Definire la logica per integrare i dati numerici del `RicercatoreDati` con il sentiment dell'`AnalistaSentiment`. -* Creare un **prompt avanzato** per l'LLM che lo guidi a generare previsioni e strategie. Dovrai usare tecniche come la **chain-of-thought** per rendere il ragionamento trasparente. Assicurarsi che il prompt includa vincoli specifici per lo stile di investimento (aggressivo/conservativo). - ---- - -## Fase 3: Costruzione dell'Orchestratore e Test di Integrazione - -### Implementazione dell'Agente Orchestratore - -* **Gestione dell'Input Utente:** Creare un metodo che riceve la richiesta dell'utente (es. `analizza_cripto('Bitcoin', 'aggressivo')`). Analizzare il tipo di richiesta e le preferenze utente. -* **Recupero della Memoria Utente:** Integrare la logica per recuperare la cronologia delle richieste passate dal database e preparare i dati come contesto aggiuntivo per l'LLM. -* **Orchestrazione e Flusso di Lavoro:** Chiamare gli agenti (`RicercatoreDati`, `AnalistaSentiment`) e passare i risultati combinati all'**Agente `MotorePredittivo`** per generare previsioni e strategie. -* **Valutazione e Selezione Strategica:** Ricevere le previsioni dal `MotorePredittivo` e applicare le regole di valutazione basate sulle preferenze dell'utente per selezionare le strategie piรน appropriate. -* **Presentazione e Persistenza:** Costruire il report finale e salvare la sessione completa nel database. - ---- - -## Fase 4: Gestione della Persistenza e dell'Interfaccia Utente - -* **Database per la persistenza:** Scegli un database (es. **Firestore, MongoDB, PostgreSQL**) per salvare la cronologia delle richieste degli utenti. Implementa la logica per salvare e recuperare le sessioni di consulenza passate, associandole a un ID utente, e **struttura i dati per una ricerca efficiente**. - -* **Interfaccia utente (UI):** Costruisci un'interfaccia utente semplice e intuitiva che permetta di inserire i parametri di richiesta. Aggiungi una sezione per visualizzare i risultati, inclusi i grafici e le note che spiegano il ragionamento dell'agente. - ---- - -## Fase 5: Test del Sistema - -* **Test unitari:** Esegui test su ogni agente singolarmente per assicurarti che funzioni correttamente (es. l'agente `RicercatoreDati` recupera i dati, l'agente `AnalistaSentiment` classifica correttamente un testo). **Crea dei mock per le API esterne per testare la logica interna senza dipendenze esterne**. -* **Test di integrazione:** Esegui scenari di test completi per l'intero sistema. Verifica che l'orchestrazione tra gli agenti avvenga senza intoppi e che i dati vengano passati correttamente tra di essi. - ---- - -## Fase 6: Valutazione dei Risultati - -* **Valutazione della qualitร :** Verifica la qualitร  delle raccomandazioni generate. L'output รจ logico e ben argomentato? -* **Trasparenza del ragionamento:** Controlla che le note (`Ragionamenti`) siano chiare e forniscano un'effettiva trasparenza del processo decisionale dell'agente. -* **Confronto e validazione:** Confronta le raccomandazioni con dati storici e scenari ipotetici per valutarne la plausibilitร . \ No newline at end of file -- 2.49.1 From b33389c4b6ef8232f5314d5f2e19ba184bc6b807 Mon Sep 17 00:00:00 2001 From: Berack96 Date: Wed, 22 Oct 2025 09:17:09 +0200 Subject: [PATCH 3/6] Aggiornata la documentazione dell'architettura dell'app --- docs/App_Architecture_Diagrams.md | 802 ++++++++++++++++++++++-------- 1 file changed, 592 insertions(+), 210 deletions(-) diff --git a/docs/App_Architecture_Diagrams.md b/docs/App_Architecture_Diagrams.md index a498770..792d05c 100644 --- a/docs/App_Architecture_Diagrams.md +++ b/docs/App_Architecture_Diagrams.md @@ -4,37 +4,82 @@ ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐ŸŒ GRADIO UI โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ User Input โ”‚ โ”‚ Provider โ”‚ โ”‚ Style โ”‚ โ”‚ -โ”‚ โ”‚ (Query) โ”‚ โ”‚ (Model) โ”‚ โ”‚ (Conservative/ โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Aggressive) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ ๐ŸŒ INTERFACCE UTENTE โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿ’ฌ Gradio Web Interface โ”‚ โ”‚ +โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ Chat โ”‚ โ”‚ Model โ”‚ โ”‚ Strategy (Strategy) โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ History โ”‚ โ”‚Dropdown โ”‚ โ”‚ - Conservative โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ - Aggressive โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿ“ฑ Telegram Bot Interface โ”‚ โ”‚ +โ”‚ โ”‚ (Mini App con integrazione Gradio) โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ”ง TOOL AGENT โ”‚ -โ”‚ (Central Orchestrator) โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ 1. Collect Data โ”‚ โ”‚ 2. Analyze โ”‚ โ”‚ 3. Predict & โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ Sentiment โ”‚ โ”‚ Recommend โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ ๐ŸŽฏ CHAT MANAGER โ”‚ +โ”‚ (Gestione Conversazioni) โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ - Mantiene storico messaggi (history) โ”‚ โ”‚ +โ”‚ โ”‚ - Gestisce input Pipeline (PipelineInputs) โ”‚ โ”‚ +โ”‚ โ”‚ - Salva/Carica chat (JSON) โ”‚ โ”‚ +โ”‚ โ”‚ - Interfaccia Gradio (gradio_build_interface) โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ“Š AGENT ECOSYSTEM โ”‚ +โ”‚ ๐Ÿ”„ AGNO WORKFLOW PIPELINE โ”‚ +โ”‚ (Orchestrazione Asincrona) โ”‚ โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚ -โ”‚ โ”‚ MARKET โ”‚ โ”‚ NEWS โ”‚ โ”‚ SOCIAL โ”‚ โ”‚ PREDICTOR โ”‚โ”‚ -โ”‚ โ”‚ AGENT โ”‚ โ”‚ AGENT โ”‚ โ”‚ AGENT โ”‚ โ”‚ AGENT โ”‚โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚โ”‚ -โ”‚ โ”‚ ๐Ÿ“ˆ Coinbase โ”‚ โ”‚ ๐Ÿ“ฐ News API โ”‚ โ”‚ ๐Ÿฆ Social โ”‚ โ”‚ ๐Ÿค– LLM โ”‚โ”‚ -โ”‚ โ”‚ ๐Ÿ“Š CryptoCmpโ”‚ โ”‚ โ”‚ โ”‚ Media โ”‚ โ”‚ Analysis โ”‚โ”‚ -โ”‚ โ”‚ ๐ŸŸก Binance โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚ +โ”‚ Step 1: ๐Ÿ” Query Check โ†’ Verifica query crypto โ”‚ +โ”‚ Step 2: ๐Ÿค” Condition Check โ†’ Valida se procedere โ”‚ +โ”‚ Step 3: ๐Ÿ“Š Info Recovery โ†’ Team di raccolta dati โ”‚ +โ”‚ Step 4: ๐Ÿ“ Report Generation โ†’ Genera report finale โ”‚ +โ”‚ โ”‚ +โ”‚ Pipeline Events: QUERY_CHECK | QUERY_ANALYZER | โ”‚ +โ”‚ INFO_RECOVERY | REPORT_GENERATION | โ”‚ +โ”‚ TOOL_USED | RUN_FINISHED โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ + โ–ผ +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿค– AGNO AGENT ECOSYSTEM โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿ‘” TEAM LEADER (Agno Team) โ”‚ โ”‚ +โ”‚ โ”‚ - Coordina Market, News, Social Agents โ”‚ โ”‚ +โ”‚ โ”‚ - Tools: ReasoningTools, PlanMemoryTool, โ”‚ โ”‚ +โ”‚ โ”‚ CryptoSymbolsTools โ”‚ โ”‚ +โ”‚ โ”‚ - Model: Configurabile (team_leader_model) โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ–ผ โ–ผ โ–ผ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ MARKET โ”‚ โ”‚ NEWS โ”‚ โ”‚ SOCIAL โ”‚ โ”‚ +โ”‚ โ”‚ AGENT โ”‚ โ”‚ AGENT โ”‚ โ”‚ AGENT โ”‚ โ”‚ +โ”‚ โ”‚ (Agno) โ”‚ โ”‚ (Agno) โ”‚ โ”‚ (Agno) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Tool: โ”‚ โ”‚ Tool: โ”‚ โ”‚ Tool: โ”‚ โ”‚ +โ”‚ โ”‚ MarketAPIs โ”‚ โ”‚ NewsAPIs โ”‚ โ”‚ SocialAPIs โ”‚ โ”‚ +โ”‚ โ”‚ Tool โ”‚ โ”‚ Tool โ”‚ โ”‚ Tool โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๏ฟฝ QUERY CHECK AGENT (Agno Agent) โ”‚ โ”‚ +โ”‚ โ”‚ - Valida se la query รจ relativa a crypto โ”‚ โ”‚ +โ”‚ โ”‚ - Output Schema: QueryOutputs (is_crypto: bool) โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿ“‹ REPORT GENERATOR AGENT (Agno Agent) โ”‚ โ”‚ +โ”‚ โ”‚ - Genera report finale basato su dati raccolti โ”‚ โ”‚ +โ”‚ โ”‚ - Applica strategia (Conservative/Aggressive) โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` @@ -45,211 +90,548 @@ โ”‚ โ”‚ "Analizza Bitcoin con strategia aggressiva" โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ”ง TOOL AGENT โ”‚ -โ”‚ โ”‚ -โ”‚ def interact(query, provider, style): โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“Š market_data = market_agent.analyze(query) โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ฐ news_sentiment = news_agent.analyze(query) โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿฆ social_sentiment = social_agent.analyze(query) โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿค– prediction = predictor_agent.predict(...) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -๐Ÿ“Š MARKET AGENT - Parallel Data Collection -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ โ”‚ -โ”‚ ๐Ÿ” Auto-detect Available Providers: โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ Coinbase โ”‚ โ”‚ CryptoComp โ”‚ โ”‚ Binance โ”‚ โ”‚ -โ”‚ โ”‚ REST โ”‚ โ”‚ API โ”‚ โ”‚ Mock โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โœ… Active โ”‚ โ”‚ โœ… Active โ”‚ โ”‚ โœ… Active โ”‚ โ”‚ -โ”‚ โ”‚ $63,500 BTC โ”‚ โ”‚ $63,450 BTC โ”‚ โ”‚ $63,600 BTC โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿ“ˆ Aggregated Result: โ”‚ -โ”‚ { โ”‚ -โ”‚ "aggregated_data": { โ”‚ -โ”‚ "BTC_USD": { โ”‚ -โ”‚ "price": 63516.67, โ”‚ -โ”‚ "confidence": 0.94, โ”‚ -โ”‚ "sources_count": 3 โ”‚ -โ”‚ } โ”‚ -โ”‚ }, โ”‚ -โ”‚ "individual_sources": {...}, โ”‚ -โ”‚ "market_signals": {...} โ”‚ -โ”‚ } โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -๐Ÿ“ฐ NEWS AGENT + ๐Ÿฆ SOCIAL AGENT -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ โ”‚ -โ”‚ ๐Ÿ“ฐ News Sentiment: "Positive momentum, institutional โ”‚ -โ”‚ adoption increasing..." โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿฆ Social Sentiment: "Bullish sentiment on Reddit, โ”‚ -โ”‚ Twitter mentions up 15%..." โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -๐Ÿค– PREDICTOR AGENT -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ โ”‚ -โ”‚ Input: โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“Š Market Data (aggregated + confidence) โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ฐ๐Ÿฆ Combined Sentiment โ”‚ -โ”‚ โ”œโ”€โ”€ ๐ŸŽฏ Style: "aggressive" โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿค– Provider: "openai/anthropic/google..." โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿง  LLM Processing: โ”‚ -โ”‚ "Based on high confidence market data (0.94) showing โ”‚ -โ”‚ $63,516 BTC with positive sentiment across news and โ”‚ -โ”‚ social channels, aggressive strategy recommendation..." โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -๐Ÿ“‹ FINAL OUTPUT -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ“Š Market Data Summary โ”‚ -โ”‚ ๐Ÿ“ฐ๐Ÿฆ Sentiment Analysis โ”‚ -โ”‚ ๐Ÿ“ˆ Final Recommendation: โ”‚ -โ”‚ "Strong BUY signal with 85% confidence..." โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - -## ๐Ÿ›๏ธ Architettura dei Provider (Market Agent) - -``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ“Š MARKET AGENT โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿ” Provider Detection Logic: โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚ -โ”‚ โ”‚ def _setup_providers(): โ”‚โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ”‘ Check CDP_API_KEY_NAME + CDP_API_PRIVATE_KEY โ”‚โ”‚ -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ โœ… Setup Coinbase Advanced Trade โ”‚โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ”‘ Check CRYPTOCOMPARE_API_KEY โ”‚โ”‚ -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ โœ… Setup CryptoCompare โ”‚โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ”‘ Check BINANCE_API_KEY (future) โ”‚โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€ โœ… Setup Binance API โ”‚โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿ“ก Data Flow: โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ Provider 1 โ”‚โ”€โ”€โ”€โ–ถโ”‚ โ”‚โ—€โ”€โ”€โ”€โ”‚ Provider 2 โ”‚ โ”‚ -โ”‚ โ”‚ Coinbase โ”‚ โ”‚ AGGREGATOR โ”‚ โ”‚ CryptoComp โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Real-time โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ Real-time โ”‚ โ”‚ -โ”‚ โ”‚ Market Data โ”‚ โ”‚ โ”‚Confidenceโ”‚ โ”‚ โ”‚ Market Data โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚Scoring โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ Spread โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ Provider 3 โ”‚โ”€โ”€โ”€โ–ถโ”‚ โ”‚Analysis โ”‚ โ”‚โ—€โ”€โ”€โ”€โ”‚ Provider N โ”‚ โ”‚ -โ”‚ โ”‚ Binance โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Future โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Mock Data โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ ๏ฟฝ CHAT MANAGER โ”‚ +โ”‚ โ”‚ +โ”‚ - Riceve messaggio utente โ”‚ +โ”‚ - Gestisce history della conversazione โ”‚ +โ”‚ - Prepara PipelineInputs con: โ”‚ +โ”‚ * user_query: "Analizza Bitcoin..." โ”‚ +โ”‚ * strategy: "aggressive" โ”‚ +โ”‚ * models: team_leader_model, team_model, etc. โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ + โ–ผ +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿ”„ AGNO WORKFLOW PIPELINE โ”‚ +โ”‚ โ”‚ +โ”‚ Run ID: [3845] Pipeline query: "Analizza Bitcoin..." โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ STEP 1: ๐Ÿ” QUERY CHECK (Query Check Agent) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Input: QueryInputs(user_query, strategy) โ”‚ โ”‚ +โ”‚ โ”‚ Agent: query_analyzer_model (Agno Agent) โ”‚ โ”‚ +โ”‚ โ”‚ Output: QueryOutputs(response, is_crypto: bool) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Result: {"is_crypto": true, "response": "..."} โ”‚ โ”‚ +โ”‚ โ”‚ Event: QUERY_CHECK completed โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ + โ”‚ + โ–ผ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ STEP 2: ๐Ÿค” CONDITION CHECK โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Valida: previous_step_content.is_crypto โ”‚ โ”‚ +โ”‚ โ”‚ If False โ†’ StopOutput(stop=True) โ”‚ โ”‚ +โ”‚ โ”‚ If True โ†’ Continua al prossimo step โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ + โ”‚ + โ–ผ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ STEP 3: ๐Ÿ“Š INFO RECOVERY (Team) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ ๐Ÿ‘” Team Leader coordina: โ”‚ โ”‚ +โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ˆ Market Agent โ†’ MarketAPIsTool โ”‚ โ”‚ +โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ฐ News Agent โ†’ NewsAPIsTool โ”‚ โ”‚ +โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿฆ Social Agent โ†’ SocialAPIsTool โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Tools disponibili al Team Leader: โ”‚ โ”‚ +โ”‚ โ”‚ - ReasoningTools (ragionamento) โ”‚ โ”‚ +โ”‚ โ”‚ - PlanMemoryTool (memoria del piano) โ”‚ โ”‚ +โ”‚ โ”‚ - CryptoSymbolsTools (simboli crypto) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Events: TOOL_USED per ogni chiamata tool โ”‚ โ”‚ +โ”‚ โ”‚ Event: INFO_RECOVERY completed โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ + โ”‚ + โ–ผ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ STEP 4: ๐Ÿ“ REPORT GENERATION (Report Generator Agent) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Input: Tutti i dati raccolti da Info Recovery โ”‚ โ”‚ +โ”‚ โ”‚ Agent: report_generation_model (Agno Agent) โ”‚ โ”‚ +โ”‚ โ”‚ Strategia: Applicata dal prompt (aggressive) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Output: Report finale con raccomandazioni โ”‚ โ”‚ +โ”‚ โ”‚ Event: REPORT_GENERATION completed โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ + โ”‚ + โ–ผ +โ”‚ Event: RUN_FINISHED โ”‚ +โ”‚ Return: Final report string (rimozione tag ) โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ + โ–ผ +๐Ÿ“‹ FINAL OUTPUT TO USER +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿ“Š Analisi Bitcoin (BTC) โ”‚ +โ”‚ โ”‚ +โ”‚ ๏ฟฝ Dati di Mercato: โ”‚ +โ”‚ - Prezzo: $63,516 (aggregato da 4 fonti) โ”‚ +โ”‚ - Volume 24h: $2.1M โ”‚ +โ”‚ - Confidence: 94% โ”‚ +โ”‚ โ”‚ +โ”‚ ๐Ÿ“ฐ Sentiment News: Positivo (istituzionale in crescita) โ”‚ +โ”‚ ๐Ÿฆ Sentiment Social: Bullish (Reddit/Twitter +15%) โ”‚ +โ”‚ โ”‚ +โ”‚ ๐ŸŽฏ Raccomandazione (Strategia Aggressiva): โ”‚ +โ”‚ STRONG BUY - Allocazione 15-20% del portfolio โ”‚ +โ”‚ โ”‚ +โ”‚ ๐Ÿ’ญ Ragionamento: [dettagli dell'analisi...] โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` -## ๐Ÿ”ง Signers Architecture +## ๐Ÿ›๏ธ Architettura API e Tools ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ” SIGNERS ECOSYSTEM โ”‚ +โ”‚ ๏ฟฝ API TOOLS ARCHITECTURE โ”‚ +โ”‚ (Agno Toolkit Integration) โ”‚ โ”‚ โ”‚ -โ”‚ ๐Ÿ“ src/app/signers/market_signers/ โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿฆ coinbase_rest_signer.py โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ”‘ Uses: CDP_API_KEY_NAME + CDP_API_PRIVATE_KEY โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ก RESTClient from coinbase.rest โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“Š get_asset_info() โ†’ Real Coinbase data โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“ˆ get_multiple_assets() โ†’ Bulk data โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“Š cryptocompare_signer.py โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ”‘ Uses: CRYPTOCOMPARE_API_KEY โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ก Direct HTTP requests โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ’ฐ get_crypto_prices() โ†’ Multi-currency โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ† get_top_cryptocurrencies() โ†’ Market cap โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€ ๐ŸŸก binance_signer.py โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ”‘ Uses: BINANCE_API_KEY (future) โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ก Mock implementation โ”‚ -โ”‚ โ”œโ”€โ”€ ๐ŸŽญ Simulated market data โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿ“ˆ Compatible interface โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿ“Š MarketAPIsTool (Agno Toolkit) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Tools disponibili: โ”‚ โ”‚ +โ”‚ โ”‚ - get_product(asset_id) โ”‚ โ”‚ +โ”‚ โ”‚ - get_products(asset_ids) โ”‚ โ”‚ +โ”‚ โ”‚ - get_historical_prices(asset_id, limit) โ”‚ โ”‚ +โ”‚ โ”‚ - get_products_aggregated(asset_ids) โ”‚ โ”‚ +โ”‚ โ”‚ - get_historical_prices_aggregated(asset_id, limit) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ ๐Ÿ”„ WrapperHandler gestisce: โ”‚ โ”‚ +โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ Binance โ”‚ โ”‚ YFinance โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ Wrapper โ”‚ โ”‚ Wrapper โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ +โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ CoinBase โ”‚ โ”‚CryptoCompare โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ Wrapper โ”‚ โ”‚ Wrapper โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Retry Logic: 3 tentativi per wrapper, 2s delay โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿ“ฐ NewsAPIsTool (Agno Toolkit) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ ๐Ÿ”„ WrapperHandler gestisce: โ”‚ โ”‚ +โ”‚ โ”‚ - NewsAPI Wrapper โ”‚ โ”‚ +โ”‚ โ”‚ - GoogleNews Wrapper โ”‚ โ”‚ +โ”‚ โ”‚ - DuckDuckGo Wrapper โ”‚ โ”‚ +โ”‚ โ”‚ - CryptoPanic Wrapper โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿฆ SocialAPIsTool (Agno Toolkit) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ ๐Ÿ”„ WrapperHandler gestisce: โ”‚ โ”‚ +โ”‚ โ”‚ - Reddit Wrapper โ”‚ โ”‚ +โ”‚ โ”‚ - X (Twitter) Wrapper โ”‚ โ”‚ +โ”‚ โ”‚ - 4chan Wrapper โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ ๐Ÿ”ฃ CryptoSymbolsTools (Agno Toolkit) โ”‚ โ”‚ +โ”‚ โ”‚ - Gestisce simboli e nomi delle criptovalute โ”‚ โ”‚ +โ”‚ โ”‚ - Carica da resources/cryptos.csv โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` -## ๐Ÿš€ Future Enhancement: Async Flow +## ๏ฟฝ WrapperHandler Pattern ``` - ๐Ÿ“ฑ USER REQUEST - โ”‚ - โ–ผ - ๐Ÿ”ง TOOL AGENT (async) - โ”‚ - โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” - โ”‚ โ”‚ โ”‚ - โ–ผ โ–ผ โ–ผ - ๐Ÿ“Š Market ๐Ÿ“ฐ News ๐Ÿฆ Social - Agent (async) Agent (async) Agent (async) - โ”‚ โ”‚ โ”‚ - โ”Œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ - โ–ผ โ–ผ โ–ผ โ”‚ โ”‚ - Coinbase โ”‚ Binance โ”‚ โ”‚ - CC โ”‚ โ”‚ โ”‚ - โ–ผโ–ผโ–ผ โ–ผ โ–ผ - ๐Ÿ”„ Parallel ๐Ÿ“ฐ Sentiment ๐Ÿฆ Sentiment - Aggregation Analysis Analysis - โ”‚ โ”‚ โ”‚ - โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ–ผ - ๐Ÿค– PREDICTOR AGENT - (LLM Analysis) - โ”‚ - โ–ผ - ๐Ÿ“‹ FINAL RESULT - (JSON + Confidence) +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๏ฟฝ WRAPPER HANDLER โ”‚ +โ”‚ (Resilient API Call Management) โ”‚ +โ”‚ โ”‚ +โ”‚ Input: List[WrapperType] โ”‚ +โ”‚ try_per_wrapper: int = 3 โ”‚ +โ”‚ retry_delay: int = 2 โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ def try_call(func: Callable) -> OutputType: โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ for wrapper in wrappers: โ”‚ โ”‚ +โ”‚ โ”‚ for attempt in range(try_per_wrapper): โ”‚ โ”‚ +โ”‚ โ”‚ try: โ”‚ โ”‚ +โ”‚ โ”‚ result = func(wrapper) โ”‚ โ”‚ +โ”‚ โ”‚ return result # โœ… Success โ”‚ โ”‚ +โ”‚ โ”‚ except Exception as e: โ”‚ โ”‚ +โ”‚ โ”‚ log_error(e) โ”‚ โ”‚ +โ”‚ โ”‚ sleep(retry_delay) โ”‚ โ”‚ +โ”‚ โ”‚ continue # ๏ฟฝ Retry โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ # Switch to next wrapper โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ raise Exception("All wrappers failed") # โŒ All fail โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ Esempio Flusso: โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” Fail โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” Fail โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚Binance โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚YFinance โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚CoinBase โ”‚ โœ… โ”‚ +โ”‚ โ”‚(3 tries)โ”‚ โ”‚(3 tries)โ”‚ โ”‚(Success)โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ Features: โ”‚ +โ”‚ โœ… Automatic failover tra providers โ”‚ +โ”‚ โœ… Retry logic configurabile โ”‚ +โ”‚ โœ… Logging dettagliato degli errori โ”‚ +โ”‚ โœ… Type-safe con Generics โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` -## ๐Ÿ“Š Data Flow Example +## ๏ฟฝ Data Aggregation Architecture ``` -Input: "Analyze Bitcoin aggressive strategy" -โ”‚ -โ”œโ”€โ”€ ๐Ÿ“Š Market Agent Output: -โ”‚ { -โ”‚ "aggregated_data": { -โ”‚ "BTC_USD": {"price": 63516.67, "confidence": 0.94} -โ”‚ }, -โ”‚ "individual_sources": { -โ”‚ "coinbase": {"price": 63500, "volume": "1.2M"}, -โ”‚ "cryptocompare": {"price": 63450, "volume": "N/A"}, -โ”‚ "binance": {"price": 63600, "volume": "2.1M"} -โ”‚ }, -โ”‚ "market_signals": { -โ”‚ "spread_analysis": "Low spread (0.24%) - healthy liquidity", -โ”‚ "price_divergence": "Max deviation: 0.24% - Normal range" -โ”‚ } -โ”‚ } -โ”‚ -โ”œโ”€โ”€ ๐Ÿ“ฐ News Sentiment: "Positive institutional adoption news..." -โ”œโ”€โ”€ ๐Ÿฆ Social Sentiment: "Bullish Reddit sentiment, +15% mentions" -โ”‚ -โ””โ”€โ”€ ๐Ÿค– Predictor Output: - "๐Ÿ“ˆ Strong BUY recommendation based on: - - High confidence market data (94%) - - Positive news sentiment - - Bullish social indicators - - Low spread indicates healthy liquidity - - Aggressive Strategy: Consider 15-20% portfolio allocation" +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿ“Š PRODUCT INFO AGGREGATION โ”‚ +โ”‚ โ”‚ +โ”‚ Input: dict[provider_name, list[ProductInfo]] โ”‚ +โ”‚ โ”‚ +โ”‚ Provider A: BTC โ†’ {price: 63500, volume: 1.2M} โ”‚ +โ”‚ Provider B: BTC โ†’ {price: 63450, volume: N/A} โ”‚ +โ”‚ Provider C: BTC โ†’ {price: 63600, volume: 2.1M} โ”‚ +โ”‚ Provider D: BTC โ†’ {price: 63550, volume: 1.8M} โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ Aggregation Logic: โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ 1. Group by symbol (BTC, ETH, etc.) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ 2. Aggregate Volume: โ”‚ โ”‚ +โ”‚ โ”‚ avg_volume = sum(volumes) / count(providers) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ 3. Aggregate Price (weighted by volume): โ”‚ โ”‚ +โ”‚ โ”‚ weighted_price = sum(price * volume) / sum(volume) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ 4. Calculate Confidence: โ”‚ โ”‚ +โ”‚ โ”‚ - Based on price spread โ”‚ โ”‚ +โ”‚ โ”‚ - Number of sources โ”‚ โ”‚ +โ”‚ โ”‚ - Volume consistency โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ Output: list[ProductInfo] โ”‚ +โ”‚ { โ”‚ +โ”‚ "id": "BTC_AGGREGATED", โ”‚ +โ”‚ "symbol": "BTC", โ”‚ +โ”‚ "price": 63516.67, # Weighted average โ”‚ +โ”‚ "volume_24h": 1.7M, # Average volume โ”‚ +โ”‚ "currency": "USD", โ”‚ +โ”‚ "confidence": 0.94 # High confidence (low spread) โ”‚ +โ”‚ } โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿ“ˆ HISTORICAL PRICE AGGREGATION โ”‚ +โ”‚ โ”‚ +โ”‚ Input: dict[provider_name, list[Price]] โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ Aggregation Logic: โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ 1. Align by timestamp (YYYY-MM-DD HH:MM) โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ 2. For each timestamp, calculate mean of: โ”‚ โ”‚ +โ”‚ โ”‚ - high โ”‚ โ”‚ +โ”‚ โ”‚ - low โ”‚ โ”‚ +โ”‚ โ”‚ - open โ”‚ โ”‚ +โ”‚ โ”‚ - close โ”‚ โ”‚ +โ”‚ โ”‚ - volume โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ 3. Handle missing data gracefully โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ Output: list[Price] (aggregated by timestamp) โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` +## ๐ŸŽฏ Configuration Architecture + +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ โš™๏ธ APP CONFIG (configs.yaml) โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ port: 7860 # Gradio server port โ”‚ โ”‚ +โ”‚ โ”‚ gradio_share: false # Public sharing โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ models: # LLM Models Configuration โ”‚ โ”‚ +โ”‚ โ”‚ - label: "Qwen 3 (4B)" โ”‚ โ”‚ +โ”‚ โ”‚ provider: "ollama" โ”‚ โ”‚ +โ”‚ โ”‚ model_id: "qwen3:4b" โ”‚ โ”‚ +โ”‚ โ”‚ - label: "Qwen 3 (1.7B)" โ”‚ โ”‚ +โ”‚ โ”‚ provider: "ollama" โ”‚ โ”‚ +โ”‚ โ”‚ model_id: "qwen3:1.7b" โ”‚ โ”‚ +โ”‚ โ”‚ - label: "GPT-4 Turbo" โ”‚ โ”‚ +โ”‚ โ”‚ provider: "openai" โ”‚ โ”‚ +โ”‚ โ”‚ model_id: "gpt-4-turbo" โ”‚ โ”‚ +โ”‚ โ”‚ api_key_env: "OPENAI_API_KEY" โ”‚ โ”‚ +โ”‚ โ”‚ # ... altri modelli (Anthropic, Google, etc.) โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ strategies: # Investment Strategies โ”‚ โ”‚ +โ”‚ โ”‚ - label: "Conservative" โ”‚ โ”‚ +โ”‚ โ”‚ description: "Low risk, stable returns..." โ”‚ โ”‚ +โ”‚ โ”‚ - label: "Aggressive" โ”‚ โ”‚ +โ”‚ โ”‚ description: "High risk, high potential..." โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ agents: # Agent-specific configurations โ”‚ โ”‚ +โ”‚ โ”‚ team_model: "qwen3:4b" โ”‚ โ”‚ +โ”‚ โ”‚ team_leader_model: "qwen3:4b" โ”‚ โ”‚ +โ”‚ โ”‚ query_analyzer_model: "qwen3:1.7b" โ”‚ โ”‚ +โ”‚ โ”‚ report_generation_model: "qwen3:4b" โ”‚ โ”‚ +โ”‚ โ”‚ strategy: "Conservative" โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ api: # API Configuration โ”‚ โ”‚ +โ”‚ โ”‚ retry_attempts: 3 โ”‚ โ”‚ +โ”‚ โ”‚ retry_delay_seconds: 2 โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿ” ENVIRONMENT VARIABLES (.env) โ”‚ +โ”‚ โ”‚ +โ”‚ # Market APIs โ”‚ +โ”‚ CDP_API_KEY_NAME=... # Coinbase โ”‚ +โ”‚ CDP_API_PRIVATE_KEY=... # Coinbase โ”‚ +โ”‚ CRYPTOCOMPARE_API_KEY=... # CryptoCompare โ”‚ +โ”‚ BINANCE_API_KEY=... # Binance (future) โ”‚ +โ”‚ โ”‚ +โ”‚ # News APIs โ”‚ +โ”‚ NEWS_API_KEY=... # NewsAPI โ”‚ +โ”‚ CRYPTOPANIC_API_KEY=... # CryptoPanic โ”‚ +โ”‚ โ”‚ +โ”‚ # Social APIs โ”‚ +โ”‚ REDDIT_CLIENT_ID=... # Reddit โ”‚ +โ”‚ REDDIT_CLIENT_SECRET=... # Reddit โ”‚ +โ”‚ X_BEARER_TOKEN=... # Twitter/X โ”‚ +โ”‚ โ”‚ +โ”‚ # LLM Providers โ”‚ +โ”‚ OPENAI_API_KEY=... # OpenAI โ”‚ +โ”‚ ANTHROPIC_API_KEY=... # Anthropic โ”‚ +โ”‚ GOOGLE_API_KEY=... # Google โ”‚ +โ”‚ โ”‚ +โ”‚ # Telegram Bot โ”‚ +โ”‚ TELEGRAM_BOT_TOKEN=... # Telegram Bot โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +## ๐Ÿ—‚๏ธ Struttura del Progetto + +``` +upo-appAI/ +โ”‚ +โ”œโ”€โ”€ ๐Ÿ“ src/app/ # Codice principale +โ”‚ โ”œโ”€โ”€ __main__.py # Entry point (Gradio + Telegram) +โ”‚ โ”œโ”€โ”€ configs.py # Gestione configurazioni +โ”‚ โ”‚ +โ”‚ โ”œโ”€โ”€ ๐Ÿ“ agents/ # Sistema di agenti Agno +โ”‚ โ”‚ โ”œโ”€โ”€ core.py # PipelineInputs, QueryInputs/Outputs +โ”‚ โ”‚ โ”œโ”€โ”€ pipeline.py # Workflow Pipeline con Agno +โ”‚ โ”‚ โ”œโ”€โ”€ plan_memory_tool.py # Tool per memoria del piano +โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“ prompts/ # Prompt per gli agenti +โ”‚ โ”‚ โ”œโ”€โ”€ query_check.txt # Prompt Query Checker +โ”‚ โ”‚ โ”œโ”€โ”€ team_leader.txt # Prompt Team Leader +โ”‚ โ”‚ โ”œโ”€โ”€ team_market.txt # Prompt Market Agent +โ”‚ โ”‚ โ”œโ”€โ”€ team_news.txt # Prompt News Agent +โ”‚ โ”‚ โ”œโ”€โ”€ team_social.txt # Prompt Social Agent +โ”‚ โ”‚ โ””โ”€โ”€ report_generation.txt # Prompt Report Generator +โ”‚ โ”‚ +โ”‚ โ”œโ”€โ”€ ๐Ÿ“ api/ # Layer API e Wrappers +โ”‚ โ”‚ โ”œโ”€โ”€ wrapper_handler.py # Pattern WrapperHandler generico +โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ core/ # Interfacce base e modelli +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ markets.py # MarketWrapper, ProductInfo, Price +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ news.py # NewsWrapper, NewsItem +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ social.py # SocialWrapper, SocialPost +โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ markets/ # Implementazioni Market API +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ binance.py # BinanceWrapper +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ coinbase.py # CoinBaseWrapper +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ cryptocompare.py # CryptoCompareWrapper +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ yfinance.py # YFinanceWrapper +โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ news/ # Implementazioni News API +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ newsapi.py # NewsAPIWrapper +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ googlenews.py # GoogleNewsWrapper +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ duckduckgo.py # DuckDuckGoWrapper +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ cryptopanic_api.py # CryptoPanicWrapper +โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ social/ # Implementazioni Social API +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ reddit.py # RedditWrapper +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ x.py # XWrapper (Twitter) +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ chan.py # 4ChanWrapper +โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“ tools/ # Agno Toolkits +โ”‚ โ”‚ โ”œโ”€โ”€ market_tool.py # MarketAPIsTool (Agno Toolkit) +โ”‚ โ”‚ โ”œโ”€โ”€ news_tool.py # NewsAPIsTool (Agno Toolkit) +โ”‚ โ”‚ โ”œโ”€โ”€ social_tool.py # SocialAPIsTool (Agno Toolkit) +โ”‚ โ”‚ โ””โ”€โ”€ symbols_tool.py # CryptoSymbolsTools (Agno Toolkit) +โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€ ๐Ÿ“ interface/ # Interfacce utente +โ”‚ โ”œโ”€โ”€ chat.py # ChatManager (Gradio) +โ”‚ โ””โ”€โ”€ telegram_app.py # TelegramApp (Bot) +โ”‚ +โ”œโ”€โ”€ ๐Ÿ“ tests/ # Test suite completa +โ”‚ โ”œโ”€โ”€ conftest.py # Configurazione pytest +โ”‚ โ”œโ”€โ”€ ๐Ÿ“ agents/ # Test agenti +โ”‚ โ”œโ”€โ”€ ๐Ÿ“ api/ # Test API wrappers +โ”‚ โ”œโ”€โ”€ ๐Ÿ“ tools/ # Test tools +โ”‚ โ””โ”€โ”€ ๐Ÿ“ utils/ # Test utilities +โ”‚ +โ”œโ”€โ”€ ๐Ÿ“ demos/ # Script di esempio +โ”‚ โ”œโ”€โ”€ agno_agent.py # Demo Agno Agent +โ”‚ โ”œโ”€โ”€ agno_workflow.py # Demo Agno Workflow +โ”‚ โ”œโ”€โ”€ coinbase_demo.py # Demo Coinbase API +โ”‚ โ”œโ”€โ”€ cryptocompare_demo.py # Demo CryptoCompare API +โ”‚ โ””โ”€โ”€ market_providers_api_demo.py # Demo aggregazione provider +โ”‚ +โ”œโ”€โ”€ ๐Ÿ“ resources/ # Risorse statiche +โ”‚ โ””โ”€โ”€ cryptos.csv # Database simboli crypto +โ”‚ +โ”œโ”€โ”€ ๐Ÿ“ docs/ # Documentazione +โ”‚ โ”œโ”€โ”€ App_Architecture_Diagrams.md # Questo file +โ”‚ โ””โ”€โ”€ Progetto Esame.md # Specifiche progetto +โ”‚ +โ”œโ”€โ”€ configs.yaml # Configurazione app (modelli, strategie) +โ”œโ”€โ”€ .env # Variabili d'ambiente (API keys) +โ”œโ”€โ”€ .env.example # Template per .env +โ”œโ”€โ”€ pyproject.toml # Dipendenze Python (uv/pip) +โ”œโ”€โ”€ Dockerfile # Container Docker +โ”œโ”€โ”€ docker-compose.yaml # Orchestrazione Docker +โ””โ”€โ”€ README.md # Documentazione principale +``` + +## ๐Ÿ”‘ Componenti Chiave + +### 1. **Agno Framework Integration** +L'applicazione utilizza il framework **Agno** per gestire: +- **Agent**: Singoli agenti con modelli LLM specifici +- **Team**: Coordinazione di piรน agenti sotto un Team Leader +- **Workflow**: Pipeline asincrone con step condizionali +- **Toolkit**: Integrazione tools con retry logic +- **RunEvent**: Sistema di eventi per monitoraggio + +### 2. **WrapperHandler Pattern** +Pattern generico per gestire multiple implementazioni API con: +- Failover automatico tra provider +- Retry logic configurabile +- Type safety con Generics +- Logging dettagliato + +### 3. **Data Aggregation** +Sistema sofisticato di aggregazione che: +- Combina dati da multiple fonti +- Calcola confidence score +- Gestisce dati mancanti/inconsistenti +- Fornisce weighted averages + +### 4. **Multi-Interface Support** +Due interfacce integrate: +- **Gradio Web UI**: Chat interface con dropdown per modelli/strategie +- **Telegram Bot**: Bot con Mini App integrato + +### 5. **Configuration Management** +Sistema a due livelli: +- **configs.yaml**: Configurazioni applicazione (modelli, strategie, agenti) +- **.env**: Secrets e API keys (caricato con dotenv) + +## ๐Ÿš€ Deployment Flow + +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿณ DOCKER DEPLOYMENT โ”‚ +โ”‚ โ”‚ +โ”‚ 1. Load .env variables โ”‚ +โ”‚ 2. Build Docker image (Python 3.11) โ”‚ +โ”‚ 3. Install dependencies (pyproject.toml) โ”‚ +โ”‚ 4. Copy src/, configs.yaml, resources/ โ”‚ +โ”‚ 5. Expose port 7860 (Gradio) โ”‚ +โ”‚ 6. Run: python -m src.app โ”‚ +โ”‚ โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ docker-compose up --build -d โ”‚ โ”‚ +โ”‚ โ”‚ โ”‚ โ”‚ +โ”‚ โ”‚ Services: โ”‚ โ”‚ +โ”‚ โ”‚ - app: Main application (Gradio + Telegram) โ”‚ โ”‚ +โ”‚ โ”‚ - Networks: Bridge mode โ”‚ โ”‚ +โ”‚ โ”‚ - Volumes: .env mounted โ”‚ โ”‚ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ ๐Ÿ’ป LOCAL DEVELOPMENT (UV) โ”‚ +โ”‚ โ”‚ +โ”‚ 1. Install uv package manager โ”‚ +โ”‚ 2. uv venv (create virtual environment) โ”‚ +โ”‚ 3. uv pip install -e . (editable install) โ”‚ +โ”‚ 4. uv run src/app (run application) โ”‚ +โ”‚ โ”‚ +โ”‚ Benefits: โ”‚ +โ”‚ โœ… Fast dependency resolution โ”‚ +โ”‚ โœ… Automatic PYTHONPATH setup โ”‚ +โ”‚ โœ… Editable mode for development โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +## ๐ŸŽฏ Workflow Execution Model + +L'applicazione utilizza un modello di esecuzione **Asincrono** basato su Agno Workflow: + +```python +# Pipeline di esecuzione +async def interact_async(): + workflow = Workflow(steps=[ + query_check, # Step 1: Verifica query + condition_query_ok, # Step 2: Condizione + info_recovery, # Step 3: Team di raccolta + report_generation # Step 4: Report finale + ]) + + # Esecuzione con streaming + iterator = await workflow.arun( + query, + stream=True, + stream_intermediate_steps=True + ) + + # Event handling + async for event in iterator: + if event.event == PipelineEvent.TOOL_USED: + log(f"Tool: {event.tool.tool_name}") + elif event.event == WorkflowRunEvent.step_completed: + log(f"Step: {event.step_name} completed") +``` + +**Vantaggi:** +- โšก Esecuzione asincrona per migliori performance +- ๐Ÿ“Š Streaming di eventi intermedi +- ๐ŸŽฏ Gestione condizionale del flusso +- ๐Ÿ”„ Retry automatico sui tools + +## ๐Ÿ“ˆ Future Enhancements + +Possibili miglioramenti architetturali: + +1. **Parallel Tool Execution**: Esecuzione parallela di Market/News/Social agents +2. **Caching Layer**: Redis/Memcached per ridurre chiamate API +3. **Database Integration**: PostgreSQL per storico analisi +4. **Real-time WebSocket**: Aggiornamenti live prezzi +5. **ML Model Integration**: Modelli predittivi custom (LSTM, Transformer) +6. **Advanced Aggregation**: Confidence scoring migliorato con ML +7. **User Profiles**: Personalizzazione strategie per utente +8. **Backtesting Module**: Validazione strategie su dati storici + --- -*Diagrammi creati: 2025-09-23* -*Sistema: upo-appAI Market Analysis Platform* \ No newline at end of file +*Documento aggiornato: 2025-10-22* +*Sistema: upo-appAI Crypto Analysis Platform* +*Framework: Agno (Agentic AI) + Gradio + Telegram* \ No newline at end of file -- 2.49.1 From 7015bdfdd06fc4e9a9e9987d62f7b53060fe0ffd Mon Sep 17 00:00:00 2001 From: Berack96 Date: Wed, 22 Oct 2025 09:37:36 +0200 Subject: [PATCH 4/6] Aggiunti nuovi script demo per i provider di mercato e rimosso codice obsoleto --- demos/api_market_providers.py | 12 + demos/api_news_providers.py | 16 ++ demos/api_socials_providers.py | 17 ++ demos/coinbase_demo.py | 36 --- demos/cryptocompare_demo.py | 36 --- demos/market_providers_api_demo.py | 348 ----------------------------- demos/news_api.py | 18 -- demos/ollama_demo.py | 32 +-- 8 files changed, 53 insertions(+), 462 deletions(-) create mode 100644 demos/api_market_providers.py create mode 100644 demos/api_news_providers.py create mode 100644 demos/api_socials_providers.py delete mode 100644 demos/coinbase_demo.py delete mode 100644 demos/cryptocompare_demo.py delete mode 100644 demos/market_providers_api_demo.py delete mode 100644 demos/news_api.py diff --git a/demos/api_market_providers.py b/demos/api_market_providers.py new file mode 100644 index 0000000..a9ba754 --- /dev/null +++ b/demos/api_market_providers.py @@ -0,0 +1,12 @@ +from dotenv import load_dotenv +from app.api.tools import MarketAPIsTool + +def main(): + api = MarketAPIsTool() + prices_aggregated = api.get_historical_prices_aggregated("BTC", limit=5) + for price in prices_aggregated: + print(f"== [{price.timestamp}] {price.low:.2f} - {price.high:.2f} ==") + +if __name__ == "__main__": + load_dotenv() + main() diff --git a/demos/api_news_providers.py b/demos/api_news_providers.py new file mode 100644 index 0000000..4ac2f01 --- /dev/null +++ b/demos/api_news_providers.py @@ -0,0 +1,16 @@ +from dotenv import load_dotenv +from app.api.tools import NewsAPIsTool + +def main(): + api = NewsAPIsTool() + articles_aggregated = api.get_latest_news_aggregated(query="bitcoin", limit=2) + for provider, articles in articles_aggregated.items(): + print("===================================") + print(f"Provider: {provider}") + for article in articles: + print(f"== [{article.time}] {article.title} ==") + print(f" {article.description}") + +if __name__ == "__main__": + load_dotenv() + main() diff --git a/demos/api_socials_providers.py b/demos/api_socials_providers.py new file mode 100644 index 0000000..fb9da6e --- /dev/null +++ b/demos/api_socials_providers.py @@ -0,0 +1,17 @@ +from dotenv import load_dotenv +from app.api.tools import SocialAPIsTool + +def main(): + api = SocialAPIsTool() + articles_aggregated = api.get_top_crypto_posts_aggregated(limit_per_wrapper=2) + for provider, posts in articles_aggregated.items(): + print("===================================") + print(f"Provider: {provider}") + for post in posts: + print(f"== [{post.time}] - {post.title} ==") + print(f" {post.description}") + print(f" {len(post.comments)}") + +if __name__ == "__main__": + load_dotenv() + main() diff --git a/demos/coinbase_demo.py b/demos/coinbase_demo.py deleted file mode 100644 index 8b6bd41..0000000 --- a/demos/coinbase_demo.py +++ /dev/null @@ -1,36 +0,0 @@ -#### FOR ALL FILES OUTSIDE src/ FOLDER #### -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) -########################################### - -from dotenv import load_dotenv -from app.markets import CoinBaseWrapper - -def main(): - print("Demo Coinbase CDP") - - print("=== Chiavi API ===") - print(f" COINBASE_API_KEY: {os.getenv('COINBASE_API_KEY') is not None}") - print(f" COINBASE_API_SECRET: {os.getenv('COINBASE_API_SECRET') is not None}") - - # Inizializza le API - coinbase = CoinBaseWrapper() - - # ottenimento prezzo attuale - print("=== Demo prezzo attuale ===") - test_symbols = ["BTC", "ETH", "ADA"] - for symbol in test_symbols: - info = coinbase.get_product(symbol) - print(f" {symbol}: ${info.price:,.2f}") - - # ottenimento prezzi storici - print("\n=== Demo prezzi storici ===") - test_symbols = ["BTC", "ETH"] - for symbol in test_symbols: - prices = coinbase.get_historical_prices(symbol) - print(f" {symbol}: {" ".join([f'${entry["price"]:,.2f}' for entry in prices[:5]])}") # mostra solo i primi 5 - -if __name__ == "__main__": - load_dotenv() - main() diff --git a/demos/cryptocompare_demo.py b/demos/cryptocompare_demo.py deleted file mode 100644 index f929b87..0000000 --- a/demos/cryptocompare_demo.py +++ /dev/null @@ -1,36 +0,0 @@ -#### FOR ALL FILES OUTSIDE src/ FOLDER #### -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) -########################################### - -from dotenv import load_dotenv -from app.markets.cryptocompare import CryptoCompareWrapper - -def main(): - print("Demo CryptoCompare") - - print("=== Chiavi API ===") - print(f" CRYPTOCOMPARE_API_KEY: {os.getenv('CRYPTOCOMPARE_API_KEY') is not None}") - - # Inizializza le API - cryptocompare = CryptoCompareWrapper() - - # ottenimento prezzo attuale - print("=== Demo prezzo attuale ===") - test_symbols = ["BTC", "ETH", "ADA"] - for symbol in test_symbols: - info = cryptocompare.get_product(symbol) - print(f" {symbol}: ${info.price:,.2f}") - - # ottenimento prezzi storici - print("=== Demo prezzi storici ===") - test_symbols = ["BTC", "ETH"] - for symbol in test_symbols: - prices = cryptocompare.get_historical_prices(symbol) - prices = [f'[${entry.high:,.2f}-${entry.low:,.2f}]' for entry in prices] - print(f" {symbol}: {" ".join(prices[:5])}") # mostra solo i primi 5 - -if __name__ == "__main__": - load_dotenv() - main() \ No newline at end of file diff --git a/demos/market_providers_api_demo.py b/demos/market_providers_api_demo.py deleted file mode 100644 index c9ab116..0000000 --- a/demos/market_providers_api_demo.py +++ /dev/null @@ -1,348 +0,0 @@ -#!/usr/bin/env python3 -""" -Demo Completo per Market Data Providers -======================================== - -Questo script dimostra l'utilizzo di tutti i wrapper che implementano BaseWrapper: -- CoinBaseWrapper (richiede credenziali) -- CryptoCompareWrapper (richiede API key) -- BinanceWrapper (richiede credenziali) -- PublicBinanceAgent (accesso pubblico) -- YFinanceWrapper (accesso gratuito a dati azionari e crypto) - -Lo script effettua chiamate GET a diversi provider e visualizza i dati -in modo strutturato con informazioni dettagliate su timestamp, stato -delle richieste e formattazione tabellare. -""" - -import sys -import os -from pathlib import Path -from datetime import datetime -from typing import Dict, List, Optional, Any -import traceback - -# Aggiungi il path src al PYTHONPATH -project_root = Path(__file__).parent.parent -sys.path.insert(0, str(project_root / "src")) - -from dotenv import load_dotenv -from app.api.core.markets import MarketWrapper -from app.api.markets import * - -# Carica variabili d'ambiente -load_dotenv() - -class DemoFormatter: - """Classe per formattare l'output del demo in modo strutturato.""" - - @staticmethod - def print_header(title: str, char: str = "=", width: int = 80): - """Stampa un'intestazione formattata.""" - print(f"\n{char * width}") - print(f"{title:^{width}}") - print(f"{char * width}") - - @staticmethod - def print_subheader(title: str, char: str = "-", width: int = 60): - """Stampa una sotto-intestazione formattata.""" - print(f"\n{char * width}") - print(f" {title}") - print(f"{char * width}") - - @staticmethod - def print_request_info(provider_name: str, method: str, timestamp: datetime, - status: str, error: Optional[str] = None): - """Stampa informazioni sulla richiesta.""" - print(f"๐Ÿ•’ Timestamp: {timestamp.strftime('%Y-%m-%d %H:%M:%S')}") - print(f"๐Ÿท๏ธ Provider: {provider_name}") - print(f"๐Ÿ”ง Method: {method}") - print(f"๐Ÿ“Š Status: {status}") - if error: - print(f"โŒ Error: {error}") - print() - - @staticmethod - def print_product_table(products: List[Any], title: str = "Products"): - """Stampa una tabella di prodotti.""" - if not products: - print(f"๐Ÿ“‹ {title}: Nessun prodotto trovato") - return - - print(f"๐Ÿ“‹ {title} ({len(products)} items):") - print(f"{'Symbol':<15} {'ID':<20} {'Price':<12} {'Quote':<10} {'Status':<10}") - print("-" * 67) - - for product in products[:10]: # Mostra solo i primi 10 - symbol = getattr(product, 'symbol', 'N/A') - product_id = getattr(product, 'id', 'N/A') - price = getattr(product, 'price', 0.0) - quote = getattr(product, 'quote_currency', 'N/A') - status = getattr(product, 'status', 'N/A') - - # Tronca l'ID se troppo lungo - if len(product_id) > 18: - product_id = product_id[:15] + "..." - - price_str = f"${price:.2f}" if price > 0 else "N/A" - - print(f"{symbol:<15} {product_id:<20} {price_str:<12} {quote:<10} {status:<10}") - - if len(products) > 10: - print(f"... e altri {len(products) - 10} prodotti") - print() - - @staticmethod - def print_prices_table(prices: List[Any], title: str = "Historical Prices"): - """Stampa una tabella di prezzi storici.""" - if not prices: - print(f"๐Ÿ’ฐ {title}: Nessun prezzo trovato") - return - - print(f"๐Ÿ’ฐ {title} ({len(prices)} entries):") - print(f"{'Time':<12} {'Open':<12} {'High':<12} {'Low':<12} {'Close':<12} {'Volume':<15}") - print("-" * 75) - - for price in prices[:5]: # Mostra solo i primi 5 - time_str = getattr(price, 'time', 'N/A') - # Il time รจ giร  una stringa, non serve strftime - if len(time_str) > 10: - time_str = time_str[:10] # Tronca se troppo lungo - - open_price = f"${getattr(price, 'open', 0):.2f}" - high_price = f"${getattr(price, 'high', 0):.2f}" - low_price = f"${getattr(price, 'low', 0):.2f}" - close_price = f"${getattr(price, 'close', 0):.2f}" - volume = f"{getattr(price, 'volume', 0):,.0f}" - - print(f"{time_str:<12} {open_price:<12} {high_price:<12} {low_price:<12} {close_price:<12} {volume:<15}") - - if len(prices) > 5: - print(f"... e altri {len(prices) - 5} prezzi") - print() - -class ProviderTester: - """Classe per testare i provider di market data.""" - - def __init__(self): - self.formatter = DemoFormatter() - self.test_symbols = ["BTC", "ETH", "ADA"] - - def test_provider(self, wrapper: MarketWrapper, provider_name: str) -> Dict[str, Any]: - """Testa un provider specifico con tutti i metodi disponibili.""" - results: Dict[str, Any] = { - "provider_name": provider_name, - "tests": {}, - "overall_status": "SUCCESS" - } - - self.formatter.print_subheader(f"๐Ÿ” Testing {provider_name}") - - # Test get_product - for symbol in self.test_symbols: - timestamp = datetime.now() - try: - product = wrapper.get_product(symbol) - self.formatter.print_request_info( - provider_name, f"get_product({symbol})", timestamp, "โœ… SUCCESS" - ) - if product: - print(f"๐Ÿ“ฆ Product: {product.symbol} (ID: {product.id})") - print(f" Price: ${product.price:.2f}, Quote: {product.currency}") - print(f" Volume 24h: {product.volume_24h:,.2f}") - else: - print(f"๐Ÿ“ฆ Product: Nessun prodotto trovato per {symbol}") - - results["tests"][f"get_product_{symbol}"] = "SUCCESS" - - except Exception as e: - error_msg = str(e) - self.formatter.print_request_info( - provider_name, f"get_product({symbol})", timestamp, "โŒ ERROR", error_msg - ) - results["tests"][f"get_product_{symbol}"] = f"ERROR: {error_msg}" - results["overall_status"] = "PARTIAL" - - # Test get_products - timestamp = datetime.now() - try: - products = wrapper.get_products(self.test_symbols) - self.formatter.print_request_info( - provider_name, f"get_products({self.test_symbols})", timestamp, "โœ… SUCCESS" - ) - self.formatter.print_product_table(products, f"{provider_name} Products") - results["tests"]["get_products"] = "SUCCESS" - - except Exception as e: - error_msg = str(e) - self.formatter.print_request_info( - provider_name, f"get_products({self.test_symbols})", timestamp, "โŒ ERROR", error_msg - ) - results["tests"]["get_products"] = f"ERROR: {error_msg}" - results["overall_status"] = "PARTIAL" - - # Test get_historical_prices - timestamp = datetime.now() - try: - prices = wrapper.get_historical_prices("BTC") - self.formatter.print_request_info( - provider_name, "get_historical_prices(BTC)", timestamp, "โœ… SUCCESS" - ) - self.formatter.print_prices_table(prices, f"{provider_name} BTC Historical Prices") - results["tests"]["get_historical_prices"] = "SUCCESS" - - except Exception as e: - error_msg = str(e) - self.formatter.print_request_info( - provider_name, "get_historical_prices(BTC)", timestamp, "โŒ ERROR", error_msg - ) - results["tests"]["get_historical_prices"] = f"ERROR: {error_msg}" - results["overall_status"] = "PARTIAL" - - return results - -def check_environment_variables() -> Dict[str, bool]: - """Verifica la presenza delle variabili d'ambiente necessarie.""" - env_vars = { - "COINBASE_API_KEY": bool(os.getenv("COINBASE_API_KEY")), - "COINBASE_API_SECRET": bool(os.getenv("COINBASE_API_SECRET")), - "CRYPTOCOMPARE_API_KEY": bool(os.getenv("CRYPTOCOMPARE_API_KEY")), - "BINANCE_API_KEY": bool(os.getenv("BINANCE_API_KEY")), - "BINANCE_API_SECRET": bool(os.getenv("BINANCE_API_SECRET")), - } - return env_vars - -def initialize_providers() -> Dict[str, MarketWrapper]: - """Inizializza tutti i provider disponibili.""" - providers: Dict[str, MarketWrapper] = {} - env_vars = check_environment_variables() - - # CryptoCompareWrapper - if env_vars["CRYPTOCOMPARE_API_KEY"]: - try: - providers["CryptoCompare"] = CryptoCompareWrapper() - print("โœ… CryptoCompareWrapper inizializzato con successo") - except Exception as e: - print(f"โŒ Errore nell'inizializzazione di CryptoCompareWrapper: {e}") - else: - print("โš ๏ธ CryptoCompareWrapper saltato: CRYPTOCOMPARE_API_KEY non trovata") - - # CoinBaseWrapper - if env_vars["COINBASE_API_KEY"] and env_vars["COINBASE_API_SECRET"]: - try: - providers["CoinBase"] = CoinBaseWrapper() - print("โœ… CoinBaseWrapper inizializzato con successo") - except Exception as e: - print(f"โŒ Errore nell'inizializzazione di CoinBaseWrapper: {e}") - else: - print("โš ๏ธ CoinBaseWrapper saltato: credenziali Coinbase non complete") - - # BinanceWrapper - try: - providers["Binance"] = BinanceWrapper() - print("โœ… BinanceWrapper inizializzato con successo") - except Exception as e: - print(f"โŒ Errore nell'inizializzazione di BinanceWrapper: {e}") - - # YFinanceWrapper (sempre disponibile - dati azionari e crypto gratuiti) - try: - providers["YFinance"] = YFinanceWrapper() - print("โœ… YFinanceWrapper inizializzato con successo") - except Exception as e: - print(f"โŒ Errore nell'inizializzazione di YFinanceWrapper: {e}") - return providers - -def print_summary(results: List[Dict[str, Any]]): - """Stampa un riassunto finale dei risultati.""" - formatter = DemoFormatter() - formatter.print_header("๐Ÿ“Š RIASSUNTO FINALE", "=", 80) - - total_providers = len(results) - successful_providers = sum(1 for r in results if r["overall_status"] == "SUCCESS") - partial_providers = sum(1 for r in results if r["overall_status"] == "PARTIAL") - - print(f"๐Ÿ”ข Provider testati: {total_providers}") - print(f"โœ… Provider completamente funzionanti: {successful_providers}") - print(f"โš ๏ธ Provider parzialmente funzionanti: {partial_providers}") - print(f"โŒ Provider non funzionanti: {total_providers - successful_providers - partial_providers}") - - print("\n๐Ÿ“‹ Dettaglio per provider:") - for result in results: - provider_name = result["provider_name"] - status = result["overall_status"] - status_icon = "โœ…" if status == "SUCCESS" else "โš ๏ธ" if status == "PARTIAL" else "โŒ" - - print(f"\n{status_icon} {provider_name}:") - for test_name, test_result in result["tests"].items(): - test_icon = "โœ…" if test_result == "SUCCESS" else "โŒ" - print(f" {test_icon} {test_name}: {test_result}") - -def main(): - """Funzione principale del demo.""" - formatter = DemoFormatter() - - # Intestazione principale - formatter.print_header("๐Ÿš€ DEMO COMPLETO MARKET DATA PROVIDERS", "=", 80) - - print(f"๐Ÿ•’ Avvio demo: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") - print("๐Ÿ“ Questo demo testa tutti i wrapper BaseWrapper disponibili") - print("๐Ÿ” Ogni test include timestamp, stato della richiesta e dati formattati") - - # Verifica variabili d'ambiente - formatter.print_subheader("๐Ÿ” Verifica Configurazione") - env_vars = check_environment_variables() - - print("Variabili d'ambiente:") - for var_name, is_present in env_vars.items(): - status = "โœ… Presente" if is_present else "โŒ Mancante" - print(f" {var_name}: {status}") - - # Inizializza provider - formatter.print_subheader("๐Ÿ—๏ธ Inizializzazione Provider") - providers = initialize_providers() - - if not providers: - print("โŒ Nessun provider disponibile. Verifica la configurazione.") - return - - print(f"\n๐ŸŽฏ Provider disponibili per il test: {list(providers.keys())}") - - # Testa ogni provider - formatter.print_header("๐Ÿงช ESECUZIONE TEST PROVIDER", "=", 80) - - tester = ProviderTester() - all_results: List[Dict[str, Any]] = [] - - for provider_name, wrapper in providers.items(): - try: - result = tester.test_provider(wrapper, provider_name) - all_results.append(result) - except Exception as e: - print(f"โŒ Errore critico nel test di {provider_name}: {e}") - traceback.print_exc() - all_results.append({ - "provider_name": provider_name, - "tests": {}, - "overall_status": "CRITICAL_ERROR", - "error": str(e) - }) - - # Stampa riassunto finale - print_summary(all_results) - - # Informazioni aggiuntive - formatter.print_header("โ„น๏ธ INFORMAZIONI AGGIUNTIVE", "=", 80) - print("๐Ÿ“š Documentazione:") - print(" - BaseWrapper: src/app/markets/base.py") - print(" - Test completi: tests/agents/test_market.py") - print(" - Configurazione: .env") - - print("\n๐Ÿ”ง Per abilitare tutti i provider:") - print(" 1. Configura le credenziali nel file .env") - print(" 2. Segui la documentazione di ogni provider") - print(" 3. Riavvia il demo") - - print(f"\n๐Ÿ Demo completato: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/demos/news_api.py b/demos/news_api.py deleted file mode 100644 index ef71974..0000000 --- a/demos/news_api.py +++ /dev/null @@ -1,18 +0,0 @@ -#### FOR ALL FILES OUTSIDE src/ FOLDER #### -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) -########################################### - -from dotenv import load_dotenv -from app.api.news import NewsApiWrapper - -def main(): - api = NewsApiWrapper() - articles = api.get_latest_news(query="bitcoin", limit=5) - assert len(articles) > 0 - print("ok") - -if __name__ == "__main__": - load_dotenv() - main() \ No newline at end of file diff --git a/demos/ollama_demo.py b/demos/ollama_demo.py index 1e52f5f..8a327a6 100644 --- a/demos/ollama_demo.py +++ b/demos/ollama_demo.py @@ -1,20 +1,4 @@ -#!/usr/bin/env python3 -""" -Demo di Ollama (Python) โ€“ mostra: - 1. Elenco dei modelli disponibili - 2. Generazione di testo semplice - 3. Chat con streaming - 4. Calcolo di embeddings - 5. Esempio (opzionale) di function calling / tools - -Uso: - python ollama_demo.py - -Requisiti: - pip install ollama - Avviare il server Ollama (es. 'ollama serve' o l'app desktop) e avere i modelli giร  pullati. -""" - +from typing import Any import ollama # Configurazione modelli @@ -33,8 +17,8 @@ def list_models(): print(" (Nessun modello trovato)") return for m in models: - name = getattr(m, 'model', None) or (m.get('model') if isinstance(m, dict) else 'sconosciuto') - details = getattr(m, 'details', None) + name = getattr(m, 'model', None) or (m.get('model') if isinstance(m, dict) else 'sconosciuto') # type: ignore + details = getattr(m, 'details', None) # type: ignore fmt = getattr(details, 'format', None) if details else 'unknown' print(f" โ€ข {name} โ€“ {fmt}") except Exception as e: @@ -46,7 +30,7 @@ def list_models(): def generate_text(model: str, prompt: str, max_tokens: int = 200) -> str: """Genera testo dal modello indicato.""" print(f"\n[2] Generazione testo con '{model}'") - response = ollama.chat( + response = ollama.chat( # type: ignore model=model, messages=[{"role": "user", "content": prompt}] ) @@ -57,10 +41,10 @@ def generate_text(model: str, prompt: str, max_tokens: int = 200) -> str: # 3. Chat con streaming -------------------------------------------------------- -def chat_streaming(model: str, messages: list) -> str: +def chat_streaming(model: str, messages: list[dict[str, str]]) -> str: """Esegue una chat mostrando progressivamente la risposta.""" print(f"\n[3] Chat (streaming) con '{model}'") - stream = ollama.chat(model=model, messages=messages, stream=True) + stream = ollama.chat(model=model, messages=messages, stream=True) # type: ignore full = "" for chunk in stream: if 'message' in chunk and 'content' in chunk['message']: @@ -91,7 +75,7 @@ def get_embedding(model: str, text: str): def try_tools(model: str): """Esempio di function calling; se non supportato mostra messaggio informativo.""" print(f"\n[5] Function calling / tools con '{model}'") - tools = [ + tools: list[dict[str, Any]] = [ { "type": "function", "function": { @@ -109,7 +93,7 @@ def try_tools(model: str): } ] try: - response = ollama.chat( + response = ollama.chat( # type: ignore model=model, messages=[{"role": "user", "content": "Che tempo fa a Milano?"}], tools=tools -- 2.49.1 From 71a984a6190db0c21b8d27d1b88561d08f88a089 Mon Sep 17 00:00:00 2001 From: Berack96 Date: Wed, 22 Oct 2025 09:44:49 +0200 Subject: [PATCH 5/6] Aggiornata la documentazione dell'architettura dell'app --- docs/App_Architecture_Diagrams.md | 743 ++++++------------------------ 1 file changed, 133 insertions(+), 610 deletions(-) diff --git a/docs/App_Architecture_Diagrams.md b/docs/App_Architecture_Diagrams.md index 792d05c..6eb4308 100644 --- a/docs/App_Architecture_Diagrams.md +++ b/docs/App_Architecture_Diagrams.md @@ -1,637 +1,160 @@ -# ๐Ÿ“Š Architettura e Flussi dell'App upo-appAI +# ๐Ÿ“Š Architettura upo-appAI -## ๐Ÿ—๏ธ Diagramma Architettura Generale +## ๐Ÿ—๏ธ Architettura Generale ``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐ŸŒ INTERFACCE UTENTE โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿ’ฌ Gradio Web Interface โ”‚ โ”‚ -โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ Chat โ”‚ โ”‚ Model โ”‚ โ”‚ Strategy (Strategy) โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ History โ”‚ โ”‚Dropdown โ”‚ โ”‚ - Conservative โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ - Aggressive โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿ“ฑ Telegram Bot Interface โ”‚ โ”‚ -โ”‚ โ”‚ (Mini App con integrazione Gradio) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐ŸŽฏ CHAT MANAGER โ”‚ -โ”‚ (Gestione Conversazioni) โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ - Mantiene storico messaggi (history) โ”‚ โ”‚ -โ”‚ โ”‚ - Gestisce input Pipeline (PipelineInputs) โ”‚ โ”‚ -โ”‚ โ”‚ - Salva/Carica chat (JSON) โ”‚ โ”‚ -โ”‚ โ”‚ - Interfaccia Gradio (gradio_build_interface) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ”„ AGNO WORKFLOW PIPELINE โ”‚ -โ”‚ (Orchestrazione Asincrona) โ”‚ -โ”‚ โ”‚ -โ”‚ Step 1: ๐Ÿ” Query Check โ†’ Verifica query crypto โ”‚ -โ”‚ Step 2: ๐Ÿค” Condition Check โ†’ Valida se procedere โ”‚ -โ”‚ Step 3: ๐Ÿ“Š Info Recovery โ†’ Team di raccolta dati โ”‚ -โ”‚ Step 4: ๐Ÿ“ Report Generation โ†’ Genera report finale โ”‚ -โ”‚ โ”‚ -โ”‚ Pipeline Events: QUERY_CHECK | QUERY_ANALYZER | โ”‚ -โ”‚ INFO_RECOVERY | REPORT_GENERATION | โ”‚ -โ”‚ TOOL_USED | RUN_FINISHED โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿค– AGNO AGENT ECOSYSTEM โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿ‘” TEAM LEADER (Agno Team) โ”‚ โ”‚ -โ”‚ โ”‚ - Coordina Market, News, Social Agents โ”‚ โ”‚ -โ”‚ โ”‚ - Tools: ReasoningTools, PlanMemoryTool, โ”‚ โ”‚ -โ”‚ โ”‚ CryptoSymbolsTools โ”‚ โ”‚ -โ”‚ โ”‚ - Model: Configurabile (team_leader_model) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ–ผ โ–ผ โ–ผ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ MARKET โ”‚ โ”‚ NEWS โ”‚ โ”‚ SOCIAL โ”‚ โ”‚ -โ”‚ โ”‚ AGENT โ”‚ โ”‚ AGENT โ”‚ โ”‚ AGENT โ”‚ โ”‚ -โ”‚ โ”‚ (Agno) โ”‚ โ”‚ (Agno) โ”‚ โ”‚ (Agno) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Tool: โ”‚ โ”‚ Tool: โ”‚ โ”‚ Tool: โ”‚ โ”‚ -โ”‚ โ”‚ MarketAPIs โ”‚ โ”‚ NewsAPIs โ”‚ โ”‚ SocialAPIs โ”‚ โ”‚ -โ”‚ โ”‚ Tool โ”‚ โ”‚ Tool โ”‚ โ”‚ Tool โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๏ฟฝ QUERY CHECK AGENT (Agno Agent) โ”‚ โ”‚ -โ”‚ โ”‚ - Valida se la query รจ relativa a crypto โ”‚ โ”‚ -โ”‚ โ”‚ - Output Schema: QueryOutputs (is_crypto: bool) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿ“‹ REPORT GENERATOR AGENT (Agno Agent) โ”‚ โ”‚ -โ”‚ โ”‚ - Genera report finale basato su dati raccolti โ”‚ โ”‚ -โ”‚ โ”‚ - Applica strategia (Conservative/Aggressive) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +INTERFACCE UTENTE +โ”œโ”€โ”€ ๐Ÿ’ฌ Gradio Web (Chat + Dropdown modelli/strategie) +โ””โ”€โ”€ ๐Ÿ“ฑ Telegram Bot (Mini App) + โ”‚ + โ–ผ +CHAT MANAGER +โ”œโ”€โ”€ Storico messaggi +โ”œโ”€โ”€ Gestione PipelineInputs +โ””โ”€โ”€ Salva/Carica chat + โ”‚ + โ–ผ +AGNO WORKFLOW PIPELINE (4 Steps) +โ”œโ”€โ”€ 1. Query Check โ†’ Verifica crypto +โ”œโ”€โ”€ 2. Condition โ†’ Valida procedere +โ”œโ”€โ”€ 3. Info Recovery โ†’ Team raccolta dati +โ””โ”€โ”€ 4. Report Generation โ†’ Report finale + โ”‚ + โ–ผ +AGNO AGENT ECOSYSTEM +โ”œโ”€โ”€ ๐Ÿ‘” TEAM LEADER (coordina Market, News, Social) +โ”‚ Tools: ReasoningTools, PlanMemoryTool, CryptoSymbolsTools +โ”œโ”€โ”€ ๐Ÿ“ˆ MARKET AGENT โ†’ MarketAPIsTool +โ”œโ”€โ”€ ๐Ÿ“ฐ NEWS AGENT โ†’ NewsAPIsTool +โ”œโ”€โ”€ ๐Ÿฆ SOCIAL AGENT โ†’ SocialAPIsTool +โ”œโ”€โ”€ ๐Ÿ” QUERY CHECK AGENT โ†’ QueryOutputs (is_crypto: bool) +โ””โ”€โ”€ ๐Ÿ“‹ REPORT GENERATOR AGENT โ†’ Strategia applicata ``` -## ๐Ÿ”„ Flusso di Esecuzione Dettagliato +## ๐Ÿ”„ Flusso Esecuzione -``` -๐Ÿ‘ค USER REQUEST - โ”‚ - โ”‚ "Analizza Bitcoin con strategia aggressiva" - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๏ฟฝ CHAT MANAGER โ”‚ -โ”‚ โ”‚ -โ”‚ - Riceve messaggio utente โ”‚ -โ”‚ - Gestisce history della conversazione โ”‚ -โ”‚ - Prepara PipelineInputs con: โ”‚ -โ”‚ * user_query: "Analizza Bitcoin..." โ”‚ -โ”‚ * strategy: "aggressive" โ”‚ -โ”‚ * models: team_leader_model, team_model, etc. โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ”„ AGNO WORKFLOW PIPELINE โ”‚ -โ”‚ โ”‚ -โ”‚ Run ID: [3845] Pipeline query: "Analizza Bitcoin..." โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ STEP 1: ๐Ÿ” QUERY CHECK (Query Check Agent) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Input: QueryInputs(user_query, strategy) โ”‚ โ”‚ -โ”‚ โ”‚ Agent: query_analyzer_model (Agno Agent) โ”‚ โ”‚ -โ”‚ โ”‚ Output: QueryOutputs(response, is_crypto: bool) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Result: {"is_crypto": true, "response": "..."} โ”‚ โ”‚ -โ”‚ โ”‚ Event: QUERY_CHECK completed โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ - โ”‚ - โ–ผ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ STEP 2: ๐Ÿค” CONDITION CHECK โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Valida: previous_step_content.is_crypto โ”‚ โ”‚ -โ”‚ โ”‚ If False โ†’ StopOutput(stop=True) โ”‚ โ”‚ -โ”‚ โ”‚ If True โ†’ Continua al prossimo step โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ - โ”‚ - โ–ผ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ STEP 3: ๐Ÿ“Š INFO RECOVERY (Team) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ‘” Team Leader coordina: โ”‚ โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ˆ Market Agent โ†’ MarketAPIsTool โ”‚ โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ฐ News Agent โ†’ NewsAPIsTool โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿฆ Social Agent โ†’ SocialAPIsTool โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Tools disponibili al Team Leader: โ”‚ โ”‚ -โ”‚ โ”‚ - ReasoningTools (ragionamento) โ”‚ โ”‚ -โ”‚ โ”‚ - PlanMemoryTool (memoria del piano) โ”‚ โ”‚ -โ”‚ โ”‚ - CryptoSymbolsTools (simboli crypto) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Events: TOOL_USED per ogni chiamata tool โ”‚ โ”‚ -โ”‚ โ”‚ Event: INFO_RECOVERY completed โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ - โ”‚ - โ–ผ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ STEP 4: ๐Ÿ“ REPORT GENERATION (Report Generator Agent) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Input: Tutti i dati raccolti da Info Recovery โ”‚ โ”‚ -โ”‚ โ”‚ Agent: report_generation_model (Agno Agent) โ”‚ โ”‚ -โ”‚ โ”‚ Strategia: Applicata dal prompt (aggressive) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Output: Report finale con raccomandazioni โ”‚ โ”‚ -โ”‚ โ”‚ Event: REPORT_GENERATION completed โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ - โ”‚ - โ–ผ -โ”‚ Event: RUN_FINISHED โ”‚ -โ”‚ Return: Final report string (rimozione tag ) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ -๐Ÿ“‹ FINAL OUTPUT TO USER -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ“Š Analisi Bitcoin (BTC) โ”‚ -โ”‚ โ”‚ -โ”‚ ๏ฟฝ Dati di Mercato: โ”‚ -โ”‚ - Prezzo: $63,516 (aggregato da 4 fonti) โ”‚ -โ”‚ - Volume 24h: $2.1M โ”‚ -โ”‚ - Confidence: 94% โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿ“ฐ Sentiment News: Positivo (istituzionale in crescita) โ”‚ -โ”‚ ๐Ÿฆ Sentiment Social: Bullish (Reddit/Twitter +15%) โ”‚ -โ”‚ โ”‚ -โ”‚ ๐ŸŽฏ Raccomandazione (Strategia Aggressiva): โ”‚ -โ”‚ STRONG BUY - Allocazione 15-20% del portfolio โ”‚ -โ”‚ โ”‚ -โ”‚ ๐Ÿ’ญ Ragionamento: [dettagli dell'analisi...] โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +**Input:** "Analizza Bitcoin con strategia aggressiva" + +1. CHAT MANAGER riceve e prepara PipelineInputs +2. WORKFLOW PIPELINE esegue 4 step: + - Query Check: valida `is_crypto: true` + - Condition: se false, termina + - Info Recovery: Team raccoglie dati + - Report Generation: genera report +3. OUTPUT: Report con analisi + raccomandazioni + +## ๐Ÿ›๏ธ Architettura API + +**Tools (Agno Toolkit):** +- MarketAPIsTool: Binance, YFinance, CoinBase, CryptoCompare +- NewsAPIsTool: NewsAPI, GoogleNews, DuckDuckGo, CryptoPanic +- SocialAPIsTool: Reddit, X, 4chan +- CryptoSymbolsTools: `resources/cryptos.csv` + +**WrapperHandler:** Failover automatico (3 tentativi/wrapper, 2s delay) + +## ๐Ÿ“Š Data Aggregation + +**ProductInfo:** +- Volume: media tra sources +- Price: weighted average (price ร— volume) +- Confidence: spread + numero sources + +**Historical Price:** +- Align per timestamp +- Media: high, low, open, close, volume + +## ๐ŸŽฏ Configuration + +**configs.yaml:** +```yaml +port: 8000 +models: [Ollama, OpenAI, Anthropic, Google] +strategies: [Conservative, Aggressive] +agents: {team_model, team_leader_model, ...} +api: {retry_attempts: 3, retry_delay_seconds: 2} ``` -## ๐Ÿ›๏ธ Architettura API e Tools +**.env (API Keys):** +- Market: CDP_API_KEY, CRYPTOCOMPARE_API_KEY, ... +- News: NEWS_API_KEY, CRYPTOPANIC_API_KEY, ... +- Social: REDDIT_CLIENT_ID, X_API_KEY, ... +- LLM: OPENAI_API_KEY, ANTHROPIC_API_KEY, ... +- Bot: TELEGRAM_BOT_TOKEN + +## ๐Ÿ—‚๏ธ Struttura Progetto ``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๏ฟฝ API TOOLS ARCHITECTURE โ”‚ -โ”‚ (Agno Toolkit Integration) โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿ“Š MarketAPIsTool (Agno Toolkit) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Tools disponibili: โ”‚ โ”‚ -โ”‚ โ”‚ - get_product(asset_id) โ”‚ โ”‚ -โ”‚ โ”‚ - get_products(asset_ids) โ”‚ โ”‚ -โ”‚ โ”‚ - get_historical_prices(asset_id, limit) โ”‚ โ”‚ -โ”‚ โ”‚ - get_products_aggregated(asset_ids) โ”‚ โ”‚ -โ”‚ โ”‚ - get_historical_prices_aggregated(asset_id, limit) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ”„ WrapperHandler gestisce: โ”‚ โ”‚ -โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ Binance โ”‚ โ”‚ YFinance โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ Wrapper โ”‚ โ”‚ Wrapper โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ -โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ CoinBase โ”‚ โ”‚CryptoCompare โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ Wrapper โ”‚ โ”‚ Wrapper โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Retry Logic: 3 tentativi per wrapper, 2s delay โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿ“ฐ NewsAPIsTool (Agno Toolkit) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ”„ WrapperHandler gestisce: โ”‚ โ”‚ -โ”‚ โ”‚ - NewsAPI Wrapper โ”‚ โ”‚ -โ”‚ โ”‚ - GoogleNews Wrapper โ”‚ โ”‚ -โ”‚ โ”‚ - DuckDuckGo Wrapper โ”‚ โ”‚ -โ”‚ โ”‚ - CryptoPanic Wrapper โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿฆ SocialAPIsTool (Agno Toolkit) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ ๐Ÿ”„ WrapperHandler gestisce: โ”‚ โ”‚ -โ”‚ โ”‚ - Reddit Wrapper โ”‚ โ”‚ -โ”‚ โ”‚ - X (Twitter) Wrapper โ”‚ โ”‚ -โ”‚ โ”‚ - 4chan Wrapper โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ ๐Ÿ”ฃ CryptoSymbolsTools (Agno Toolkit) โ”‚ โ”‚ -โ”‚ โ”‚ - Gestisce simboli e nomi delle criptovalute โ”‚ โ”‚ -โ”‚ โ”‚ - Carica da resources/cryptos.csv โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` +src/app/ +โ”œโ”€โ”€ __main__.py +โ”œโ”€โ”€ configs.py +โ”œโ”€โ”€ agents/ +โ”‚ โ”œโ”€โ”€ core.py +โ”‚ โ”œโ”€โ”€ pipeline.py +โ”‚ โ”œโ”€โ”€ plan_memory_tool.py +โ”‚ โ””โ”€โ”€ prompts/ +โ”œโ”€โ”€ api/ +โ”‚ โ”œโ”€โ”€ wrapper_handler.py +โ”‚ โ”œโ”€โ”€ core/ (markets, news, social) +โ”‚ โ”œโ”€โ”€ markets/ (Binance, CoinBase, CryptoCompare, YFinance) +โ”‚ โ”œโ”€โ”€ news/ (NewsAPI, GoogleNews, DuckDuckGo, CryptoPanic) +โ”‚ โ”œโ”€โ”€ social/ (Reddit, X, 4chan) +โ”‚ โ””โ”€โ”€ tools/ (Agno Toolkits) +โ””โ”€โ”€ interface/ (chat.py, telegram_app.py) -## ๏ฟฝ WrapperHandler Pattern - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๏ฟฝ WRAPPER HANDLER โ”‚ -โ”‚ (Resilient API Call Management) โ”‚ -โ”‚ โ”‚ -โ”‚ Input: List[WrapperType] โ”‚ -โ”‚ try_per_wrapper: int = 3 โ”‚ -โ”‚ retry_delay: int = 2 โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ def try_call(func: Callable) -> OutputType: โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ for wrapper in wrappers: โ”‚ โ”‚ -โ”‚ โ”‚ for attempt in range(try_per_wrapper): โ”‚ โ”‚ -โ”‚ โ”‚ try: โ”‚ โ”‚ -โ”‚ โ”‚ result = func(wrapper) โ”‚ โ”‚ -โ”‚ โ”‚ return result # โœ… Success โ”‚ โ”‚ -โ”‚ โ”‚ except Exception as e: โ”‚ โ”‚ -โ”‚ โ”‚ log_error(e) โ”‚ โ”‚ -โ”‚ โ”‚ sleep(retry_delay) โ”‚ โ”‚ -โ”‚ โ”‚ continue # ๏ฟฝ Retry โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ # Switch to next wrapper โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ raise Exception("All wrappers failed") # โŒ All fail โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ Esempio Flusso: โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” Fail โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” Fail โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚Binance โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚YFinance โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚CoinBase โ”‚ โœ… โ”‚ -โ”‚ โ”‚(3 tries)โ”‚ โ”‚(3 tries)โ”‚ โ”‚(Success)โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ Features: โ”‚ -โ”‚ โœ… Automatic failover tra providers โ”‚ -โ”‚ โœ… Retry logic configurabile โ”‚ -โ”‚ โœ… Logging dettagliato degli errori โ”‚ -โ”‚ โœ… Type-safe con Generics โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - -## ๏ฟฝ Data Aggregation Architecture - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ“Š PRODUCT INFO AGGREGATION โ”‚ -โ”‚ โ”‚ -โ”‚ Input: dict[provider_name, list[ProductInfo]] โ”‚ -โ”‚ โ”‚ -โ”‚ Provider A: BTC โ†’ {price: 63500, volume: 1.2M} โ”‚ -โ”‚ Provider B: BTC โ†’ {price: 63450, volume: N/A} โ”‚ -โ”‚ Provider C: BTC โ†’ {price: 63600, volume: 2.1M} โ”‚ -โ”‚ Provider D: BTC โ†’ {price: 63550, volume: 1.8M} โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ Aggregation Logic: โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ 1. Group by symbol (BTC, ETH, etc.) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ 2. Aggregate Volume: โ”‚ โ”‚ -โ”‚ โ”‚ avg_volume = sum(volumes) / count(providers) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ 3. Aggregate Price (weighted by volume): โ”‚ โ”‚ -โ”‚ โ”‚ weighted_price = sum(price * volume) / sum(volume) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ 4. Calculate Confidence: โ”‚ โ”‚ -โ”‚ โ”‚ - Based on price spread โ”‚ โ”‚ -โ”‚ โ”‚ - Number of sources โ”‚ โ”‚ -โ”‚ โ”‚ - Volume consistency โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ Output: list[ProductInfo] โ”‚ -โ”‚ { โ”‚ -โ”‚ "id": "BTC_AGGREGATED", โ”‚ -โ”‚ "symbol": "BTC", โ”‚ -โ”‚ "price": 63516.67, # Weighted average โ”‚ -โ”‚ "volume_24h": 1.7M, # Average volume โ”‚ -โ”‚ "currency": "USD", โ”‚ -โ”‚ "confidence": 0.94 # High confidence (low spread) โ”‚ -โ”‚ } โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ“ˆ HISTORICAL PRICE AGGREGATION โ”‚ -โ”‚ โ”‚ -โ”‚ Input: dict[provider_name, list[Price]] โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ Aggregation Logic: โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ 1. Align by timestamp (YYYY-MM-DD HH:MM) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ 2. For each timestamp, calculate mean of: โ”‚ โ”‚ -โ”‚ โ”‚ - high โ”‚ โ”‚ -โ”‚ โ”‚ - low โ”‚ โ”‚ -โ”‚ โ”‚ - open โ”‚ โ”‚ -โ”‚ โ”‚ - close โ”‚ โ”‚ -โ”‚ โ”‚ - volume โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ 3. Handle missing data gracefully โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ Output: list[Price] (aggregated by timestamp) โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - -## ๐ŸŽฏ Configuration Architecture - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ โš™๏ธ APP CONFIG (configs.yaml) โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ port: 7860 # Gradio server port โ”‚ โ”‚ -โ”‚ โ”‚ gradio_share: false # Public sharing โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ models: # LLM Models Configuration โ”‚ โ”‚ -โ”‚ โ”‚ - label: "Qwen 3 (4B)" โ”‚ โ”‚ -โ”‚ โ”‚ provider: "ollama" โ”‚ โ”‚ -โ”‚ โ”‚ model_id: "qwen3:4b" โ”‚ โ”‚ -โ”‚ โ”‚ - label: "Qwen 3 (1.7B)" โ”‚ โ”‚ -โ”‚ โ”‚ provider: "ollama" โ”‚ โ”‚ -โ”‚ โ”‚ model_id: "qwen3:1.7b" โ”‚ โ”‚ -โ”‚ โ”‚ - label: "GPT-4 Turbo" โ”‚ โ”‚ -โ”‚ โ”‚ provider: "openai" โ”‚ โ”‚ -โ”‚ โ”‚ model_id: "gpt-4-turbo" โ”‚ โ”‚ -โ”‚ โ”‚ api_key_env: "OPENAI_API_KEY" โ”‚ โ”‚ -โ”‚ โ”‚ # ... altri modelli (Anthropic, Google, etc.) โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ strategies: # Investment Strategies โ”‚ โ”‚ -โ”‚ โ”‚ - label: "Conservative" โ”‚ โ”‚ -โ”‚ โ”‚ description: "Low risk, stable returns..." โ”‚ โ”‚ -โ”‚ โ”‚ - label: "Aggressive" โ”‚ โ”‚ -โ”‚ โ”‚ description: "High risk, high potential..." โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ agents: # Agent-specific configurations โ”‚ โ”‚ -โ”‚ โ”‚ team_model: "qwen3:4b" โ”‚ โ”‚ -โ”‚ โ”‚ team_leader_model: "qwen3:4b" โ”‚ โ”‚ -โ”‚ โ”‚ query_analyzer_model: "qwen3:1.7b" โ”‚ โ”‚ -โ”‚ โ”‚ report_generation_model: "qwen3:4b" โ”‚ โ”‚ -โ”‚ โ”‚ strategy: "Conservative" โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ api: # API Configuration โ”‚ โ”‚ -โ”‚ โ”‚ retry_attempts: 3 โ”‚ โ”‚ -โ”‚ โ”‚ retry_delay_seconds: 2 โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ” ENVIRONMENT VARIABLES (.env) โ”‚ -โ”‚ โ”‚ -โ”‚ # Market APIs โ”‚ -โ”‚ CDP_API_KEY_NAME=... # Coinbase โ”‚ -โ”‚ CDP_API_PRIVATE_KEY=... # Coinbase โ”‚ -โ”‚ CRYPTOCOMPARE_API_KEY=... # CryptoCompare โ”‚ -โ”‚ BINANCE_API_KEY=... # Binance (future) โ”‚ -โ”‚ โ”‚ -โ”‚ # News APIs โ”‚ -โ”‚ NEWS_API_KEY=... # NewsAPI โ”‚ -โ”‚ CRYPTOPANIC_API_KEY=... # CryptoPanic โ”‚ -โ”‚ โ”‚ -โ”‚ # Social APIs โ”‚ -โ”‚ REDDIT_CLIENT_ID=... # Reddit โ”‚ -โ”‚ REDDIT_CLIENT_SECRET=... # Reddit โ”‚ -โ”‚ X_BEARER_TOKEN=... # Twitter/X โ”‚ -โ”‚ โ”‚ -โ”‚ # LLM Providers โ”‚ -โ”‚ OPENAI_API_KEY=... # OpenAI โ”‚ -โ”‚ ANTHROPIC_API_KEY=... # Anthropic โ”‚ -โ”‚ GOOGLE_API_KEY=... # Google โ”‚ -โ”‚ โ”‚ -โ”‚ # Telegram Bot โ”‚ -โ”‚ TELEGRAM_BOT_TOKEN=... # Telegram Bot โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - -## ๐Ÿ—‚๏ธ Struttura del Progetto - -``` -upo-appAI/ -โ”‚ -โ”œโ”€โ”€ ๐Ÿ“ src/app/ # Codice principale -โ”‚ โ”œโ”€โ”€ __main__.py # Entry point (Gradio + Telegram) -โ”‚ โ”œโ”€โ”€ configs.py # Gestione configurazioni -โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ agents/ # Sistema di agenti Agno -โ”‚ โ”‚ โ”œโ”€โ”€ core.py # PipelineInputs, QueryInputs/Outputs -โ”‚ โ”‚ โ”œโ”€โ”€ pipeline.py # Workflow Pipeline con Agno -โ”‚ โ”‚ โ”œโ”€โ”€ plan_memory_tool.py # Tool per memoria del piano -โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“ prompts/ # Prompt per gli agenti -โ”‚ โ”‚ โ”œโ”€โ”€ query_check.txt # Prompt Query Checker -โ”‚ โ”‚ โ”œโ”€โ”€ team_leader.txt # Prompt Team Leader -โ”‚ โ”‚ โ”œโ”€โ”€ team_market.txt # Prompt Market Agent -โ”‚ โ”‚ โ”œโ”€โ”€ team_news.txt # Prompt News Agent -โ”‚ โ”‚ โ”œโ”€โ”€ team_social.txt # Prompt Social Agent -โ”‚ โ”‚ โ””โ”€โ”€ report_generation.txt # Prompt Report Generator -โ”‚ โ”‚ -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ api/ # Layer API e Wrappers -โ”‚ โ”‚ โ”œโ”€โ”€ wrapper_handler.py # Pattern WrapperHandler generico -โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ core/ # Interfacce base e modelli -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ markets.py # MarketWrapper, ProductInfo, Price -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ news.py # NewsWrapper, NewsItem -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ social.py # SocialWrapper, SocialPost -โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ markets/ # Implementazioni Market API -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ binance.py # BinanceWrapper -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ coinbase.py # CoinBaseWrapper -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ cryptocompare.py # CryptoCompareWrapper -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ yfinance.py # YFinanceWrapper -โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ news/ # Implementazioni News API -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ newsapi.py # NewsAPIWrapper -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ googlenews.py # GoogleNewsWrapper -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ duckduckgo.py # DuckDuckGoWrapper -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ cryptopanic_api.py # CryptoPanicWrapper -โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ social/ # Implementazioni Social API -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ reddit.py # RedditWrapper -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ x.py # XWrapper (Twitter) -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ chan.py # 4ChanWrapper -โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“ tools/ # Agno Toolkits -โ”‚ โ”‚ โ”œโ”€โ”€ market_tool.py # MarketAPIsTool (Agno Toolkit) -โ”‚ โ”‚ โ”œโ”€โ”€ news_tool.py # NewsAPIsTool (Agno Toolkit) -โ”‚ โ”‚ โ”œโ”€โ”€ social_tool.py # SocialAPIsTool (Agno Toolkit) -โ”‚ โ”‚ โ””โ”€โ”€ symbols_tool.py # CryptoSymbolsTools (Agno Toolkit) -โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€ ๐Ÿ“ interface/ # Interfacce utente -โ”‚ โ”œโ”€โ”€ chat.py # ChatManager (Gradio) -โ”‚ โ””โ”€โ”€ telegram_app.py # TelegramApp (Bot) -โ”‚ -โ”œโ”€โ”€ ๐Ÿ“ tests/ # Test suite completa -โ”‚ โ”œโ”€โ”€ conftest.py # Configurazione pytest -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ agents/ # Test agenti -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ api/ # Test API wrappers -โ”‚ โ”œโ”€โ”€ ๐Ÿ“ tools/ # Test tools -โ”‚ โ””โ”€โ”€ ๐Ÿ“ utils/ # Test utilities -โ”‚ -โ”œโ”€โ”€ ๐Ÿ“ demos/ # Script di esempio -โ”‚ โ”œโ”€โ”€ agno_agent.py # Demo Agno Agent -โ”‚ โ”œโ”€โ”€ agno_workflow.py # Demo Agno Workflow -โ”‚ โ”œโ”€โ”€ coinbase_demo.py # Demo Coinbase API -โ”‚ โ”œโ”€โ”€ cryptocompare_demo.py # Demo CryptoCompare API -โ”‚ โ””โ”€โ”€ market_providers_api_demo.py # Demo aggregazione provider -โ”‚ -โ”œโ”€โ”€ ๐Ÿ“ resources/ # Risorse statiche -โ”‚ โ””โ”€โ”€ cryptos.csv # Database simboli crypto -โ”‚ -โ”œโ”€โ”€ ๐Ÿ“ docs/ # Documentazione -โ”‚ โ”œโ”€โ”€ App_Architecture_Diagrams.md # Questo file -โ”‚ โ””โ”€โ”€ Progetto Esame.md # Specifiche progetto -โ”‚ -โ”œโ”€โ”€ configs.yaml # Configurazione app (modelli, strategie) -โ”œโ”€โ”€ .env # Variabili d'ambiente (API keys) -โ”œโ”€โ”€ .env.example # Template per .env -โ”œโ”€โ”€ pyproject.toml # Dipendenze Python (uv/pip) -โ”œโ”€โ”€ Dockerfile # Container Docker -โ”œโ”€โ”€ docker-compose.yaml # Orchestrazione Docker -โ””โ”€โ”€ README.md # Documentazione principale +tests/ +demos/ +resources/cryptos.csv +docs/ +configs.yaml +.env ``` ## ๐Ÿ”‘ Componenti Chiave -### 1. **Agno Framework Integration** -L'applicazione utilizza il framework **Agno** per gestire: -- **Agent**: Singoli agenti con modelli LLM specifici -- **Team**: Coordinazione di piรน agenti sotto un Team Leader -- **Workflow**: Pipeline asincrone con step condizionali -- **Toolkit**: Integrazione tools con retry logic -- **RunEvent**: Sistema di eventi per monitoraggio +1. **Agno Framework**: Agent, Team, Workflow, Toolkit, RunEvent +2. **WrapperHandler**: Failover, Retry logic, Type safety +3. **Data Aggregation**: Multiple sources, Confidence score +4. **Multi-Interface**: Gradio + Telegram +5. **Configuration**: configs.yaml + .env -### 2. **WrapperHandler Pattern** -Pattern generico per gestire multiple implementazioni API con: -- Failover automatico tra provider -- Retry logic configurabile -- Type safety con Generics -- Logging dettagliato +## ๐Ÿš€ Deployment -### 3. **Data Aggregation** -Sistema sofisticato di aggregazione che: -- Combina dati da multiple fonti -- Calcola confidence score -- Gestisce dati mancanti/inconsistenti -- Fornisce weighted averages - -### 4. **Multi-Interface Support** -Due interfacce integrate: -- **Gradio Web UI**: Chat interface con dropdown per modelli/strategie -- **Telegram Bot**: Bot con Mini App integrato - -### 5. **Configuration Management** -Sistema a due livelli: -- **configs.yaml**: Configurazioni applicazione (modelli, strategie, agenti) -- **.env**: Secrets e API keys (caricato con dotenv) - -## ๐Ÿš€ Deployment Flow - -``` -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿณ DOCKER DEPLOYMENT โ”‚ -โ”‚ โ”‚ -โ”‚ 1. Load .env variables โ”‚ -โ”‚ 2. Build Docker image (Python 3.11) โ”‚ -โ”‚ 3. Install dependencies (pyproject.toml) โ”‚ -โ”‚ 4. Copy src/, configs.yaml, resources/ โ”‚ -โ”‚ 5. Expose port 7860 (Gradio) โ”‚ -โ”‚ 6. Run: python -m src.app โ”‚ -โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ docker-compose up --build -d โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ Services: โ”‚ โ”‚ -โ”‚ โ”‚ - app: Main application (Gradio + Telegram) โ”‚ โ”‚ -โ”‚ โ”‚ - Networks: Bridge mode โ”‚ โ”‚ -โ”‚ โ”‚ - Volumes: .env mounted โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ๐Ÿ’ป LOCAL DEVELOPMENT (UV) โ”‚ -โ”‚ โ”‚ -โ”‚ 1. Install uv package manager โ”‚ -โ”‚ 2. uv venv (create virtual environment) โ”‚ -โ”‚ 3. uv pip install -e . (editable install) โ”‚ -โ”‚ 4. uv run src/app (run application) โ”‚ -โ”‚ โ”‚ -โ”‚ Benefits: โ”‚ -โ”‚ โœ… Fast dependency resolution โ”‚ -โ”‚ โœ… Automatic PYTHONPATH setup โ”‚ -โ”‚ โœ… Editable mode for development โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +**Docker:** +```bash +docker-compose up --build -d ``` -## ๐ŸŽฏ Workflow Execution Model +**Local (UV):** +```bash +uv venv +uv pip install -e . +uv run src/app +``` -L'applicazione utilizza un modello di esecuzione **Asincrono** basato su Agno Workflow: +## ๐ŸŽฏ Workflow Asincrono ```python -# Pipeline di esecuzione -async def interact_async(): - workflow = Workflow(steps=[ - query_check, # Step 1: Verifica query - condition_query_ok, # Step 2: Condizione - info_recovery, # Step 3: Team di raccolta - report_generation # Step 4: Report finale - ]) - - # Esecuzione con streaming - iterator = await workflow.arun( - query, - stream=True, - stream_intermediate_steps=True - ) - - # Event handling - async for event in iterator: - if event.event == PipelineEvent.TOOL_USED: - log(f"Tool: {event.tool.tool_name}") - elif event.event == WorkflowRunEvent.step_completed: - log(f"Step: {event.step_name} completed") +workflow = Workflow(steps=[ + query_check, condition, + info_recovery, report_generation +]) + +iterator = await workflow.arun(query, stream=True) + +async for event in iterator: + if event.event == PipelineEvent.TOOL_USED: + log(f"Tool: {event.tool.tool_name}") ``` -**Vantaggi:** -- โšก Esecuzione asincrona per migliori performance -- ๐Ÿ“Š Streaming di eventi intermedi -- ๐ŸŽฏ Gestione condizionale del flusso -- ๐Ÿ”„ Retry automatico sui tools +**Vantaggi:** Asincrono, Streaming, Condizionale, Retry ## ๐Ÿ“ˆ Future Enhancements -Possibili miglioramenti architetturali: - -1. **Parallel Tool Execution**: Esecuzione parallela di Market/News/Social agents -2. **Caching Layer**: Redis/Memcached per ridurre chiamate API -3. **Database Integration**: PostgreSQL per storico analisi -4. **Real-time WebSocket**: Aggiornamenti live prezzi -5. **ML Model Integration**: Modelli predittivi custom (LSTM, Transformer) -6. **Advanced Aggregation**: Confidence scoring migliorato con ML -7. **User Profiles**: Personalizzazione strategie per utente -8. **Backtesting Module**: Validazione strategie su dati storici - ---- -*Documento aggiornato: 2025-10-22* -*Sistema: upo-appAI Crypto Analysis Platform* -*Framework: Agno (Agentic AI) + Gradio + Telegram* \ No newline at end of file +- Parallel Tool Execution +- Caching (Redis) +- Database (PostgreSQL) +- Real-time WebSocket +- ML Models +- User Profiles +- Backtesting -- 2.49.1 From 6ff2fcc2a7c61fd3768c4f0392dd5f71a4c87ffc Mon Sep 17 00:00:00 2001 From: Nunzi99 <115243475+Nunzi99@users.noreply.github.com> Date: Sun, 26 Oct 2025 14:07:44 +0100 Subject: [PATCH 6/6] Aggiungere LLM Providers (#48) * Refactor configs dei modelli * Aggiunti Providers --- .env.example | 9 ++- configs.yaml | 12 ++++ pyproject.toml | 4 ++ src/app/configs.py | 121 +++++++++++++++++++++----------------- src/app/interface/chat.py | 6 +- 5 files changed, 96 insertions(+), 56 deletions(-) diff --git a/.env.example b/.env.example index 694300e..b999e0e 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,14 @@ # https://makersuite.google.com/app/apikey GOOGLE_API_KEY= - +# https://platform.openai.com/settings/organization/api-keys +OPENAI_API_KEY= +# https://admin.mistral.ai/organization/api-keys +MISTRAL_API_KEY= +# https://platform.deepseek.com/api_keys +DEEPSEEK_API_KEY= +# https://console.x.ai/team/%TEAM_ID%/api-keys +XAI_API_KEY= ############################################################################### # Configurazioni per gli agenti di mercato ############################################################################### diff --git a/configs.yaml b/configs.yaml index f83ae9e..615fcf8 100644 --- a/configs.yaml +++ b/configs.yaml @@ -19,6 +19,18 @@ models: label: Gemini # - name: gemini-2.0-pro # TODO Non funziona, ha un nome diverso # label: Gemini Pro + gpt: + - name: gpt-4o + label: OpenAIChat + deepseek: + - name: deepseek-chat + label: DeepSeek + xai: + - name: grok-3 + label: xAI + mistral: + - name: mistral-large-latest + label: Mistral ollama: - name: gpt-oss:latest label: Ollama GPT diff --git a/pyproject.toml b/pyproject.toml index e7b2209..5e3bdb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,10 @@ dependencies = [ # Modelli supportati e installati (aggiungere qui sotto quelli che si vogliono usare) "google-genai", "ollama", + "openai", + "mistralai", + "deepseek", + "xai", # API di exchange di criptovalute "coinbase-advanced-py", diff --git a/src/app/configs.py b/src/app/configs.py index 45b5b01..edd3e39 100644 --- a/src/app/configs.py +++ b/src/app/configs.py @@ -10,6 +10,10 @@ from agno.tools import Toolkit from agno.models.base import Model from agno.models.google import Gemini from agno.models.ollama import Ollama +from agno.models.openai import OpenAIChat +from agno.models.mistral import MistralChat +from agno.models.deepseek import DeepSeek +from agno.models.xai import xAI log = logging.getLogger(__name__) @@ -19,7 +23,6 @@ class AppModel(BaseModel): name: str = "gemini-2.0-flash" label: str = "Gemini" model: type[Model] | None = None - def get_model(self, instructions: str) -> Model: """ Restituisce un'istanza del modello specificato. @@ -54,22 +57,84 @@ class AppModel(BaseModel): output_schema=output_schema ) + + class APIConfig(BaseModel): retry_attempts: int = 3 retry_delay_seconds: int = 2 + + class Strategy(BaseModel): name: str = "Conservative" label: str = "Conservative" description: str = "Focus on low-risk investments with steady returns." + + class ModelsConfig(BaseModel): gemini: list[AppModel] = [AppModel()] + gpt: list[AppModel] = [AppModel(name="gpt-4o", label="OpenAIChat")] + mistral: list[AppModel] = [AppModel(name="mistral-large-latest", label="Mistral")] + deepseek: list[AppModel] = [AppModel(name="deepseek-chat", label="DeepSeek")] + xai: list[AppModel] = [AppModel(name="grok-3", label="xAI")] ollama: list[AppModel] = [] @property def all_models(self) -> list[AppModel]: - return self.gemini + self.ollama + return self.gemini + self.ollama + self.gpt + self.mistral + self.deepseek + self.xai + + def validate_models(self) -> None: + """ + Validate the configured models for each provider. + """ + self.__validate_online_models(self.gemini, clazz=Gemini, key="GOOGLE_API_KEY") + self.__validate_online_models(self.gpt, clazz=OpenAIChat, key="OPENAI_API_KEY") + self.__validate_online_models(self.mistral, clazz=MistralChat, key="MISTRAL_API_KEY") + self.__validate_online_models(self.deepseek, clazz=DeepSeek, key="DEEPSEEK_API_KEY") + self.__validate_online_models(self.xai, clazz=xAI, key="XAI_API_KEY") + + self.__validate_ollama_models() + + def __validate_online_models(self, models: list[AppModel], clazz: type[Model], key: str | None = None) -> None: + """ + Validate models for online providers like Gemini. + Args: + models: list of AppModel instances to validate + clazz: class of the model (e.g. Gemini) + key: API key required for the provider (optional) + """ + if key and os.getenv(key) is None: + log.warning(f"No {key} set in environment variables for provider.") + models.clear() + return + + for model in models: + model.model = clazz + + def __validate_ollama_models(self) -> None: + """ + Validate models for the Ollama provider. + """ + try: + models_list = ollama.list() + availables = {model['model'] for model in models_list['models']} + not_availables: list[str] = [] + + for model in self.ollama: + if model.name in availables: + model.model = Ollama + else: + not_availables.append(model.name) + if not_availables: + log.warning(f"Ollama models not available: {not_availables}") + + self.ollama = [model for model in self.ollama if model.model] + + except Exception as e: + log.warning(f"Ollama is not running or not reachable: {e}") + + class AgentsConfigs(BaseModel): strategy: str = "Conservative" @@ -118,7 +183,7 @@ class AppConfig(BaseModel): super().__init__(*args, **kwargs) self.set_logging_level() - self.validate_models() + self.models.validate_models() self._initialized = True def get_model_by_name(self, name: str) -> AppModel: @@ -186,53 +251,3 @@ class AppConfig(BaseModel): logger = logging.getLogger(logger_name) logger.handlers.clear() logger.propagate = True - - def validate_models(self) -> None: - """ - Validate the configured models for each provider. - """ - self.__validate_online_models("gemini", clazz=Gemini, key="GOOGLE_API_KEY") - self.__validate_ollama_models() - - def __validate_online_models(self, provider: str, clazz: type[Model], key: str | None = None) -> None: - """ - Validate models for online providers like Gemini. - Args: - provider: name of the provider (e.g. "gemini") - clazz: class of the model (e.g. Gemini) - key: API key required for the provider (optional) - """ - if getattr(self.models, provider) is None: - log.warning(f"No models configured for provider '{provider}'.") - - models: list[AppModel] = getattr(self.models, provider) - if key and os.getenv(key) is None: - log.warning(f"No {key} set in environment variables for {provider}.") - models.clear() - return - - for model in models: - model.model = clazz - - def __validate_ollama_models(self) -> None: - """ - Validate models for the Ollama provider. - """ - try: - models_list = ollama.list() - availables = {model['model'] for model in models_list['models']} - not_availables: list[str] = [] - - for model in self.models.ollama: - if model.name in availables: - model.model = Ollama - else: - not_availables.append(model.name) - if not_availables: - log.warning(f"Ollama models not available: {not_availables}") - - self.models.ollama = [model for model in self.models.ollama if model.model] - - except Exception as e: - log.warning(f"Ollama is not running or not reachable: {e}") - diff --git a/src/app/interface/chat.py b/src/app/interface/chat.py index 150197b..37529f4 100644 --- a/src/app/interface/chat.py +++ b/src/app/interface/chat.py @@ -83,13 +83,15 @@ class ChatManager: label="Modello da usare" ) provider.change(fn=self.inputs.choose_team_leader, inputs=provider, outputs=None) + provider.value = self.inputs.team_leader_model.label - style = gr.Dropdown( + strategy = gr.Dropdown( choices=self.inputs.list_strategies_names(), type="index", label="Stile di investimento" ) - style.change(fn=self.inputs.choose_strategy, inputs=style, outputs=None) + strategy.change(fn=self.inputs.choose_strategy, inputs=strategy, outputs=None) + strategy.value = self.inputs.strategy.label chat = gr.ChatInterface( fn=self.gradio_respond -- 2.49.1