End-to-end crypto analytics, forecasting, and automation
Time-series ML (ARIMA, SARIMAX, LSTM), Binance spot & futures bots, Discord message relay, and Telegram tools — all in one repo.
Overview • Features • Structure • Tech Stack • Getting Started • Usage • Security
This repository is a unified toolkit for cryptocurrency analysis, time-series forecasting, and messaging automation. It combines:
| Pillar | Description |
|---|---|
| Crypto Task | Time-series forecasting on Binance OHLCV data (e.g. ADA) with bottom-up segmentation, ARIMA, Auto ARIMA, SARIMAX, and LSTM — train/test on 2018–2019 vs 2020, with RMSE/MAE evaluation. |
| Discord Bot | Listens to selected Discord channels via WebSocket and forwards messages (including image URLs) to another channel using the Discord HTTP API. |
| Telegram | Chat Bot (tkinter UI for multi-group/channel links and per-user messages with delay) and Add Members (Telethon-based invite flow and session handling). |
| Trading Bots | Spot and Futures bots on Binance using Heikin Ashi candles, trend detection (isUP), and market buy/sell (with optional leverage for futures). |
Ideal for quant research, automated trading experiments, and community/messaging automation — all in Python with Jupyter notebooks and minimal config.
- Bottom-up segmentation — Line-fitting and piecewise approximation of price series (
segment.py,fit.py,wrappers.py). - Classical models — ARIMA, Auto ARIMA, SARIMAX with seasonal decomposition and ADF tests.
- Deep learning — LSTM (TensorFlow/Keras) for next-step and multi-step forecasting.
- Evaluation — Train on 2018–2019, test on 2020; RMSE, MAE, and visualizations.
- Multi-asset — Datasets for ADA, LINK, LTC, TRX, XRP (Binance USDT pairs, hourly and daily).
- Real-time listening — WebSocket connection to Discord Gateway; heartbeat and event handling.
- Channel routing — Forward messages from specific channels (e.g. trades, active futures) to a target channel.
- Rich content — Forwards text and attachment URLs (e.g. images).
- Labeling — Optional prefixes like "This is from trades channel" / "This is from active futures channel".
- Chat Bot (
Telegram_Chat_Bot.ipynb) — Tkinter UI to configure up to 5 group/channel links, per-user messages (e.g. Zeeshan, Chris, Reddit_Promoter, Simon), and a send delay. - Add Members (
TelegramAddMembers/) — Telethon client, string sessions, and invite-to-channel flow with rate limiting and error handling.
- Spot (
SpotTradeSheikhBot.ipynb) — Heikin Ashi candles, trend detection, market buy/sell on Binance Spot. - Futures (
TradeBotFuturesUpdate.ipynb) — Same logic with leverage, futures klines, and long/short (UP_BUY/UP_SELL, DOWN_BUY/DOWN_SELL). - Heikin Ashi (
Heiken Ashi.ipynb) — Binance client setup, balance/price checks, and HA candle utilities (e.g. BETAUSDT).
.
├── Crypto Task/
│ ├── Computational Task.ipynb # Full pipeline: segmentation, ARIMA, SARIMAX, LSTM
│ ├── segment.py # Bottom-up segmentation
│ ├── fit.py # Regression / interpolate segments
│ ├── wrappers.py # Least-squares line fit
│ ├── homestatic.html # Static landing template
│ ├── Binance_ADAUSDT_*.csv # Sample ADA data
│ └── Datasets/
│ ├── ADA/, LINK/, LTC/, TRX/, XRP/
│ └── Binance_*USDT_1h.csv, Binance_*USDT_d.csv
├── Discord Messaging API Bot/
│ ├── discord.py # WebSocket + HTTP relay bot
│ └── README.md # Bot-specific setup
├── TelegramAddMembers/
│ ├── TelegramAddMembers.ipynb # Telethon add-members flow
│ └── daud.py # Alternate Discord relay (reference)
├── SpotTradeSheikhBot.ipynb # Binance spot + Heikin Ashi
├── TradeBotFuturesUpdate.ipynb # Binance futures + Heikin Ashi
├── Heiken Ashi.ipynb # Binance API + Heikin Ashi helpers
├── Telegram_Chat_Bot.ipynb # Telegram multi-group UI (tkinter)
├── requirements.txt # Python dependencies
└── README.md # This file
| Category | Technologies |
|---|---|
| Language | Python 3.7+ |
| Notebooks | Jupyter |
| Data & ML | pandas, numpy, scipy, scikit-learn, statsmodels (ARIMA, SARIMAX, seasonal_decompose, adfuller), pmdarima (auto_arima), TensorFlow/Keras (LSTM) |
| Visualization | matplotlib, seaborn |
| APIs | Binance (python-binance: spot + futures, klines, orders), Discord (WebSocket gateway + REST), Telegram (Telethon) |
| Other | requests, websocket-client, tkinter, PIL, nest_asyncio |
- Python 3.7 or higher
- Jupyter (for notebooks)
- Binance API keys (for trading and optional data)
- Discord bot/user token and channel IDs (for Discord bot)
- Telegram API credentials (for Telegram tools)
- Clone the repository
git clone https://github.com/your-username/Time-Series-Forecasting-and-Crypto-Analysis-Bots-and-Telegram-Discord-Bots.git
cd Time-Series-Forecasting-and-Crypto-Analysis-Bots-and-Telegram-Discord-Bots- Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txtTip: For a minimal setup (e.g. only the Discord relay), run:
pip install requests websocket-client
Time-series segmentation (Crypto Task):
import segment
import fit
# Bottom-up segmentation with linear regression and max_error threshold
segments = segment.bottomupsegment(
sequence=close_prices,
create_segment=fit.regression,
compute_error=fit.sumsquared_error,
max_error=1e-4
)Discord relay (conceptual): Run python discord.py in Discord Messaging API Bot/ after setting your token and channel IDs — the script connects via WebSocket and forwards selected channel messages to a target channel.
Binance + Heikin Ashi (Spot bot): In SpotTradeSheikhBot.ipynb, instantiate TradeBot(user_key, secret_key, symbol), then use bot.isUP(interval='1h') for trend and bot.UP_BUY(quantity) / bot.UP_SELL(quantity) for market orders.
Open Crypto Task/Computational Task.ipynb and run the cells in order. The notebook:
- Loads Binance-style OHLCV CSV (e.g.
Binance_ADAUSDT_d.csv). - Runs bottom-up segmentation and classical + LSTM forecasting.
- Uses 2018–2019 for training and 2020 for testing; reports RMSE/MAE.
Data: Place CSVs in Crypto Task/ or Crypto Task/Datasets/<SYMBOL>/. Schema: unix, date, symbol, open, high, low, close, Volume {ASSET}, Volume USDT, tradecount.
Quick run from project root:
cd "Crypto Task"
jupyter notebook "Computational Task.ipynb"- Set your Discord tokens and channel IDs in
Discord Messaging API Bot/discord.py(replace placeholders). - Run:
cd "Discord Messaging API Bot"
python discord.pyThe bot keeps a WebSocket connection, listens for messages in the configured channels, and posts them (with optional labels and image URLs) to the target channel via the Discord API.
- Open
Telegram_Chat_Bot.ipynbin Jupyter. - Run all cells to launch the tkinter window.
- Enter up to 5 group/channel links and per-user messages (e.g. Zeeshan, Chris, etc.) and set the time delay.
- Use the UI to send messages to the configured groups.
- Open
TelegramAddMembers/TelegramAddMembers.ipynb. - Configure API id, API hash, and phone (and optionally string session).
- Run the cells to connect via Telethon and use the invite-to-channel flow (respect Telegram rate limits).
- Open
SpotTradeSheikhBot.ipynb. - Set your Binance API key and secret in the notebook.
- Choose a symbol (e.g.
BTCUSDT). - Run the notebook; the bot uses Heikin Ashi to determine trend (
isUP) and places market buy/sell on Binance Spot.
- Open
TradeBotFuturesUpdate.ipynb. - Set Binance API key, secret, symbol, and leverage.
- Run the notebook; the bot uses Heikin Ashi and places futures market orders (long/short).
Use Heiken Ashi.ipynb to:
- Connect to Binance with your API keys.
- Check balance (e.g. USDT) and symbol prices.
- Build and inspect Heikin Ashi candles for any pair (e.g. BETAUSDT).
- Never commit real API keys, secrets, or tokens. Use environment variables or a local config file listed in
.gitignore. - Replace all placeholders in code (e.g.
token of the user...,channel id) before running. - Discord and Telegram credentials grant access to your accounts; keep them private and rotate if exposed.
- Binance keys can move funds; use restricted keys (e.g. trading-only, no withdrawals) for bots.
This project is provided as-is. If you use or adapt it, please attribute the source and comply with any applicable terms for third-party APIs (Binance, Discord, Telegram).
Contributions are welcome. Please open an issue first to discuss changes, then submit a pull request. Ensure code style and tests (if any) are consistent with the project.
⭐ If this repo helps you, consider giving it a star.
Built with Python · Jupyter · Binance · Discord · Telegram