TickAtlas
Bot ~20 min setup

Telegram Bot Integration

Build a Telegram bot that delivers real-time market data, AI analysis, and automated alerts to your phone. Slash commands, inline queries, and scheduled notifications.

What You Get

/rsi EURUSD

Instant RSI reading with signal interpretation

/summary XAUUSD

AI market analysis with bias and confidence

/screener RSI_14 30

Find oversold or overbought instruments

Automated Alerts

Get notified when RSI crosses thresholds

Prerequisites

bash
pip install python-telegram-bot requests
  1. Create a bot via @BotFather on Telegram and get your bot token
  2. Get your TickAtlas API key from the dashboard
  3. Set environment variables: TELEGRAM_BOT_TOKEN and CLAW_API_KEY

Bot Implementation

python
import os
import requests
from telegram import Update, InlineQueryResultArticle, InputTextMessageContent
from telegram.ext import (
    Application, CommandHandler, InlineQueryHandler, ContextTypes
)

CLAW_API_KEY = os.environ["CLAW_API_KEY"]
TELEGRAM_TOKEN = os.environ["TELEGRAM_BOT_TOKEN"]
CLAW_BASE = "https://tickatlas.com/v1"

def claw_request(endpoint: str, params: dict) -> dict:
    resp = requests.get(
        f"{CLAW_BASE}/{endpoint}",
        headers={"X-API-Key": CLAW_API_KEY},
        params=params,
        timeout=10,
    )
    resp.raise_for_status()
    return resp.json()

async def rsi_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
    args = context.args
    if not args:
        await update.message.reply_text("Usage: /rsi EURUSD [H1]")
        return

    symbol = args[0].upper()
    timeframe = args[1].upper() if len(args) > 1 else "H1"

    try:
        data = claw_request("indicator", {
            "symbol": symbol, "indicator": "RSI_14", "timeframe": timeframe,
        })
        await update.message.reply_text(
            f"*{symbol}* RSI(14) on {timeframe}\n\n"
            f"Value: *{data['value']:.2f}*\n"
            f"Signal: {data['signal']}\n"
            f"Price: {data['ohlc']['close']}",
            parse_mode="Markdown",
        )
    except Exception as e:
        await update.message.reply_text(f"Error: {e}")

async def summary_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
    args = context.args
    if not args:
        await update.message.reply_text("Usage: /summary EURUSD [H1]")
        return

    symbol = args[0].upper()
    timeframe = args[1].upper() if len(args) > 1 else "H1"

    try:
        data = claw_request("summary", {"symbol": symbol, "timeframe": timeframe})
        await update.message.reply_text(
            f"*{symbol}* AI Summary ({timeframe})\n\n"
            f"Bias: *{data['bias'].upper()}*\n"
            f"Confidence: *{data['confidence']}%*\n\n"
            f"_{data['narrative']}_",
            parse_mode="Markdown",
        )
    except Exception as e:
        await update.message.reply_text(f"Error: {e}")

def main():
    app = Application.builder().token(TELEGRAM_TOKEN).build()
    app.add_handler(CommandHandler("rsi", rsi_command))
    app.add_handler(CommandHandler("summary", summary_command))
    print("Bot is running...")
    app.run_polling()

if __name__ == "__main__":
    main()

Automated RSI Alerts

Get push notifications when RSI crosses extreme levels:

python
import asyncio
from telegram import Bot

bot = Bot(token=TELEGRAM_TOKEN)
ALERT_CHAT_ID = "YOUR_CHAT_ID"

async def check_rsi_alerts():
    """Check for RSI extremes and send Telegram alerts."""
    symbols = ["EURUSD", "GBPUSD", "USDJPY", "XAUUSD", "BTCUSD",
               "AUDUSD", "USDCAD", "EURGBP", "EURJPY", "GBPJPY"]

    for symbol in symbols:
        try:
            data = claw_request("indicator", {
                "symbol": symbol, "indicator": "RSI_14", "timeframe": "H1",
            })
            rsi = data["value"]

            if rsi < 25:
                await bot.send_message(
                    chat_id=ALERT_CHAT_ID,
                    text=f"OVERSOLD ALERT: *{symbol}* RSI = *{rsi:.2f}*",
                    parse_mode="Markdown",
                )
            elif rsi > 75:
                await bot.send_message(
                    chat_id=ALERT_CHAT_ID,
                    text=f"OVERBOUGHT ALERT: *{symbol}* RSI = *{rsi:.2f}*",
                    parse_mode="Markdown",
                )
        except Exception as e:
            print(f"Error checking {symbol}: {e}")

async def alert_loop():
    while True:
        await check_rsi_alerts()
        await asyncio.sleep(300)