import datetime from geometry import extract_candles from utils import get_asset_from_image def analyze_image(image_path): candles = extract_candles(image_path) if len(candles) < 2: return "❌ Not enough candles detected." last = candles[-1] prev = candles[-2] now = datetime.datetime.now() signal_time = now.strftime("%H:%M") asset = get_asset_from_image(image_path) if last['type'] == 'red' and prev['type'] == 'green' and last['body'] > prev['body']: return f""" 1. {asset} 🕒 Time: {signal_time} 📢 Signal: PUT (Very High) 🧠 Pattern: Bearish Engulfing 📊 Details: Red candle fully engulfs previous green 💰 Price: {last['price']} 🎯 Entry: At current close """ elif last['type'] == 'green' and prev['type'] == 'red' and last['body'] > prev['body']: return f""" 1. {asset} 🕒 Time: {signal_time} 📢 Signal: CALL (Very High) 🧠 Pattern: Bullish Engulfing 📊 Details: Green candle fully engulfs previous red 💰 Price: {last['price']} 🎯 Entry: At current close """ else: return "⚠️ No strong signal found."