Text Python
Text Python
import requests
import time
import numpy as np
from telegram import Bot
bot = Bot(token=TELEGRAM_TOKEN)
# === Get historical candle data from a dummy API (Replace with real source) ===
def get_candles(pair):
# Fake example - replace with your own API or dummy CSV if needed
url = f'https://api.example.com/candles/{pair}?timeframe=1m&limit=15'
response = requests.get(url)
data = response.json()
df = pd.DataFrame(data)
return df
latest = df.iloc[-1]
prev = df.iloc[-2]
except Exception as e:
print(f"Error with {pair}: {e}")