""" Example usage of the Ticker Scanner module This script demonstrates how to use the ticker scanner to find fast-growing stocks and send notifications to Telegram. """ import asyncio from src.core.ticker_scanner import TickerAnalyzer, Scheduler async def example_one_time_analysis(): """Run a single analysis of top growing tickers""" print("Running one-time ticker analysis...") # Create analyzer for NASDAQ analyzer = TickerAnalyzer( exchange="NASDAQ", limit=100 # Analyze top 100 tickers ) # Run analysis top_tickers = await analyzer.run_analysis() print(f"\nFound {len(top_tickers)} top tickers!") for i, ticker_data in enumerate(top_tickers[:5], 1): ticker = ticker_data['ticker'] metrics = ticker_data['metrics'] print(f"{i}. {ticker}: Score={metrics.growth_velocity_score:.1f}, CAGR={metrics.cagr:.1f}%") async def example_scheduled_analysis(): """Run scheduled hourly analysis""" print("Starting scheduled ticker scanner...") # Create scheduler for hourly analysis scheduler = Scheduler( exchange="NASDAQ", interval_hours=1, telegram_bot_service=None # Replace with your TelegramBotService instance ) # Start scheduler (runs until interrupted) await scheduler.start() async def example_with_telegram(): """Example with Telegram integration""" from src.telegram_bot.telegram_bot_service import TelegramBotService # Initialize Telegram service telegram_service = TelegramBotService() await telegram_service.initialize() # Create analyzer with Telegram integration analyzer = TickerAnalyzer( exchange="NASDAQ", telegram_bot_service=telegram_service, limit=200 ) # Run analysis and send to Telegram await analyzer.run_analysis() # Cleanup await telegram_service.cleanup() def main(): """Main entry point""" print("=" * 80) print("Ticker Scanner Examples") print("=" * 80) print() print("Choose an example:") print("1. One-time analysis") print("2. Scheduled hourly analysis") print("3. With Telegram integration") print() choice = input("Enter choice (1-3): ") if choice == "1": asyncio.run(example_one_time_analysis()) elif choice == "2": asyncio.run(example_scheduled_analysis()) elif choice == "3": asyncio.run(example_with_telegram()) else: print("Invalid choice") if __name__ == "__main__": main()