Live RSI Tracking
Uses Bybit’s public WebSocket feed for kline.240 (4-hour candles) — intrabar updates (no need to wait for candle close).
Updates RSI instantly whenever the 4h candle’s close changes.
REST Backfill for Accuracy
At startup (and on reconnect), fetches the last 300 historical candles via Bybit’s REST API.
Ensures RSI calculations match Bybit’s candle boundaries.
RSI Calculation
Uses Wilder’s RSI(14) formula (same as TradingView “RSI” default).
Works on live forming candle, so alerts are early.
Smart Alerting
Cross-up detection: Alerts only when RSI moves from below → above the threshold.
One alert per candle per symbol — no spam from wiggles above the level.
Threshold configurable in .env (RSI_THRESHOLD).
Telegram Alerts
Sends formatted Telegram messages directly to your chat.
Retries sending up to 4 times if network is unstable.
Honors optional HTTP/SOCKS proxy if HTTPS_PROXY is set.
Performance & Efficiency
One WebSocket handles multiple symbols at once.
No REST polling during live run — only backfill on start/reconnect.
Uses deque for in-memory candle storage (fast, low memory).
Reliability
Auto-reconnects to WebSocket after disconnect.
Prints heartbeat logs every few updates for monitoring.
Forces IPv4 for Telegram calls to avoid IPv6 issues.
Easy Config
All settings in .env:
TELEGRAM_BOT_TOKEN
TELEGRAM_CHAT_ID
SYMBOLS (e.g., BTCUSDT,ETHUSDT)
RSI_THRESHOLD
Supports both spot and perpetual markets — just change WS_URL & REST_BACKFILL_CATEGORY.
تتبع مؤشر RSI بشكل مباشر
يستخدم تدفق WebSocket العام لمنصة Bybit لبيانات kline.240 (شموع 4 ساعات) — تحديثات أثناء تكوّن الشمعة (لا حاجة لانتظار إغلاقها).
يقوم بتحديث مؤشر RSI فور تغيّر سعر الإغلاق في الشمعة الحالية.
جلب بيانات تاريخية عبر REST للدقة
عند بدء التشغيل (أو إعادة الاتصال) يقوم بجلب آخر 300 شمعة تاريخية من خلال واجهة Bybit REST API.
يضمن أن حسابات RSI متطابقة مع حدود الشموع الرسمية لمنصة Bybit.
حساب مؤشر RSI
يستخدم صيغة Wilder لمؤشر RSI (14) (مطابقة للإعداد الافتراضي في TradingView).
يعمل على الشمعة الحية قيد التكوّن، لتكون التنبيهات مبكرة.
تنبيهات ذكية
كشف الاختراق الصعودي: يرسل التنبيه فقط عند انتقال RSI من أقل من العتبة → إلى مساوي أو أكبر منها.
تنبيه واحد لكل شمعة ولكل رمز — لا يوجد إزعاج من الحركات المتذبذبة فوق العتبة.
يمكن ضبط العتبة من ملف .env (RSI_THRESHOLD).
تنبيهات على تيليجرام
يرسل رسائل منسّقة مباشرة إلى محادثة تيليجرام الخاصة بك.
يعيد المحاولة حتى 4 مرات إذا كان الاتصال بالشبكة غير مستقر.
يدعم بروكسي HTTP/SOCKS إذا تم تحديد HTTPS_PROXY.
الأداء والكفاءة
اتصال WebSocket واحد يتعامل مع عدة أزواج عملات في نفس الوقت.
لا يقوم بطلبات REST أثناء التشغيل المباشر — فقط عند البدء أو إعادة الاتصال.
يستخدم deque لتخزين الشموع في الذاكرة (سريع وموفر للذاكرة).
الاعتمادية
إعادة الاتصال تلقائياً بـ WebSocket عند انقطاعه.
طباعة رسائل حالة كل عدة تحديثات للمراقبة.
يجبر تيليجرام على استخدام IPv4 لتجنب مشاكل IPv6.
إعداد سهل
جميع الإعدادات في ملف .env:
TELEGRAM_BOT_TOKEN
TELEGRAM_CHAT_ID
SYMBOLS (مثال: BTCUSDT,ETHUSDT)
RSI_THRESHOLD
يدعم الأسواق الفورية (Spot) والعقود الدائمة (Perpetual) — فقط غيّر WS_URL وREST_BACKFILL_CATEGORY.