Spaces:
Runtime error
Runtime error
File size: 1,114 Bytes
2638527 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 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."
|