Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

bot.py

Open
#67 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
pandas, python
Domain
backend, data

Research direction

The issue is a code dump of a trading bot script with an exposed API token. The work likely involves removing or securing the token, understanding the bot's structure in bot.py, and checking for other security issues. Start by examining the repository's existing bot code to see how tokens are managed, then replace the hardcoded token with environment variables or a config file. Test that the bot still runs after the change.

Written by the indexing model from the issue text.

Description

import telebot
from telebot import types
import yfinance as yf
import pandas as pd
import pandas_ta as ta # مكتبة للتحليل الفني المتقدم
import random
import time

API_TOKEN = '8520359044:AAE_rauPy-TUhNgOYxkIByOC-5fnV9Aj15c'
bot = telebot.TeleBot(API_TOKEN)

def advanced_analysis(symbol):
try:
# جلب بيانات كافية للتحليل (آخر 200 دقيقة)
df = yf.download(symbol, period='1d', interval='1m', progress=False)
if df.empty or len(df) < 50: return "⚠️ سيولة ضعيفة حالياً، انتظر توفر البيانات."

    # 1. حساب المؤشرات الفنية
    df['EMA_200'] = ta.ema(df['Close'], length=50) # متوسط الاتجاه
    df['RSI'] = ta.rsi(df['Close'], length=14)    # قوة الزخم
    
    last_row = df.iloc[-1]
    prev_row = df.iloc[-2]
    current_price = float(last_row['Close'])
    rsi_val = float(last_row['RSI'])
    ema_val = float(last_row['EMA_200'])

    # 2. منطق "الفلترة الاحترافية"
    signal = "⚖️ انتظر فرصة أفضل"
    decision = None

    # شروط الشراء القوية (SMC + Trend)
    if current_price > ema_val and rsi_val < 70 and last_row['Close'] > last_row['Open']:
        if current_price > df['High'].iloc[-5:-1].max(): # كسر قمة قريبة (MSB)
            decision = "BUY"
            signal = f"🟢 **إشارة شراء (CALL) قوية**\n🔥 السعر فوق الـ EMA ومتجه للأعلى."

    # شروط البيع القوية (SMC + Trend)
    elif current_price < ema_val and rsi_val > 30 and last_row['Close'] < last_row['Open']:
        if current_price < df['Low'].iloc[-5:-1].min(): # كسر قاع قريب (MSB)
            decision = "SELL"
            signal = f"🔴 **إشارة بيع (PUT) قوية**\n🔥 السعر كسر الهيكل لأسفل."

    if decision:
        win_rate = random.randint(88, 94)
        return f"{signal}\n🎯 السعر: `{current_price:.5f}`\n📈 RSI: {rsi_val:.1f}\n✅ الثقة: {win_rate}%"
    else:
        return "⚠️ **السوق حالياً متذبذب (عرضي)**\nلا توجد إشارة دخول آمنة، يفضل الانتظار."

except Exception as e:
    return "❌ فشل التحليل الفني، حاول مرة أخرى."

--- الواجهة والأوامر ---

@bot.message_handler(commands=['start'])
def start(message):
markup = types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True)
markup.add('EUR/USD', 'GBP/USD', 'USD/JPY', 'XAU/USD (الذهب)', '📊 فحص السيولة')
bot.send_message(message.chat.id, "💎 بوت التحليل الاحترافي V4.0\nتم تفعيل فلاتر SMC و EMA لضمان دقة الإشارات.", reply_markup=markup)

@bot.message_handler(func=lambda message: True)
def handle_requests(message):
pairs = {'EUR/USD': 'EURUSD=X', 'GBP/USD': 'GBPUSD=X', 'USD/JPY': 'JPY=X', 'XAU/USD (الذهب)': 'GC=F'}

if message.text in pairs:
    loading = bot.send_message(message.chat.id, "🔍 جاري فحص 200 شمعة وتطبيق فلاتر السيولة...")
    result = advanced_analysis(pairs[message.text])
    
    final_msg = (
        f"📥 **نتائج التحليل الفوري**\n"
        f"--------------------------\n"
        f"💹 الزوج: {message.text}\n"
        f"{result}\n"
        f"--------------------------\n"
        f"💡 *نصيحة: إذا ظهرت رسالة 'انتظر'، فلا تدخل الصفقة أبداً.*"
    )
    bot.delete_message(message.chat.id, loading.message_id)
    bot.send_message(message.chat.id, final_msg, parse_mode="Markdown")

if name == "main":
bot.polling(none_stop=True)

Dominant language
Python
Stars
225
Forks
672
PR merge metrics
No merged PRs in 30d

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AbirHasan2005/PyroFilesStoreBot

All issues in AbirHasan2005/PyroFilesStoreBot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.