A Telegram-based Investment Coach & Market Commentary Assistant built with FastAPI and Groq (OpenAI-compatible).
The assistant helps users:
- Learn investing concepts (Beginner β Intermediate)
- Get neutral, news-style market commentary
π« Crucial constraint: The bot never provides buy/sell recommendations, stock tips, intraday calls, or personalized investment advice. It acts strictly as a coach/commentator, not an advisor.
- Explains concepts like ETFs, SIPs, risk, diversification
- Uses simple language and analogies
- Educational only, no product or stock recommendations
- Answers questions like:
- βWhy is the market down today?β
- βSummarize todayβs market newsβ
- Neutral, journalist-style summaries
- Focus on macro, rates, earnings, global cues
- Refuses:
- Stock picks
- Buy/sell advice
- Intraday tips
- Guaranteed returns
- Always redirects users to educational frameworks
- Clear disclaimer included in relevant responses
User (Telegram)
β
Telegram Webhook
β
FastAPI (Render)
β
Mode Router (Coach / Commentary / Guardrail)
β
Groq LLM
β
Safe, compliant response
- Python
- FastAPI (API + service layer)
- Groq API
- Model:
llama-3.3-70b-versatile - Chosen for:
- Low cost / free-tier friendliness
- Fast inference
- Open-source model support
- Telegram Bot (Webhook mode)
- Mock market news data
- Render
project-root/
β
βββ app/
β βββ main.py # FastAPI entry point
β βββ telegram_webhook.py # Telegram webhook handler
β βββ llm.py # Groq client
β βββ router.py # Intent / mode detection
β βββ prompts.py # System prompts
β βββ news.py # Mock market news
β βββ safety.py # Output safety enforcement
β
βββ requirements.txt
βββ .env.example
βββ README.md
- Python 3.11+
- A Groq API key
- A Telegram Bot Token (via @BotFather)
git clone https://github.com/SAKIB0004/Market_Assistant_Bot.git
cd Market_Assistant_Botpython -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
GROQ_API_KEY="groq_api_key"
GROQ_MODEL=llama-3.3-70b-versatile
TELEGRAM_BOT_TOKEN="telegram_bot_token"uvicorn app.main:app --reload- Environment: Python
- Build Command:
pip install -r requirements.txt
- Start Command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
https://market-assistant-bot.onrender.com
The bot is deployed and available on Telegram.
- Open Telegram
- Search for the bot by username:
Market_Commentary_Assistant_Bot
or
π Live Telegram Bot: https://t.me/Market_Commentary_Assistant_Bot
- Open the chat
- Click Start
- Send a message (no commands required)
- Explain ETFs
- What is SIP?
- How does diversification reduce risk?
- Why is the market down today?
- Summarize todayβs market news
- Which stock should I buy today?
- Give me intraday tips
(Expected: refusal + educational redirection)
- No stock recommendations
- No buy/sell language
- No personalized advice
- Explicit refusal + redirection logic
This ensures the assistant remains a coach/commentator, not an investment advisor.
This project is for educational purposes only and does not constitute financial or investment advice. Investing involves risk, and users should perform their own research or consult a qualified professional before making financial decisions.
Built as part of an Investment Coach + Market Commentary Assistant take-home assignment, with a focus on safe, compliant GenAI system design.