상장소식을 보고 바로 긁는 봇을 만들면
정수리 여드름에 매수하는 상황이 오는경우가 많아서
최대한 빠르게 캔들과 거래량을보고 .. 매수/매도하기위한.. 봇
따라하는사람은 없겠지만 그냥 그렇다구요
api_id = '텔래그램 API'
api_hash = 'Hash'
client = TelegramClient('session_name', api_id, api_hash)
channel_id = 스크랩할 채널
직접 크롤링해서 채널만들어도 되고 기존에 있는 채널 사용해도 됩니다
여러가지 상황을 고려하면 그냥 기존에 유명한채널 스크랩해오는게 좋을듯
def play_alarm():
duration = 1000 # 1초
freq = 1000 # 1000Hz
winsound.Beep(freq, duration) # 한 번만 울림
윈도우 알림인데 컴퓨터 앞에 상주해 있다면 쓸 필요는 없음
def show_notification(title, message):
notification.notify(
title=title,
message=message,
timeout=5
)
def open_exchange_links(ticker: str):
binance_url = f"https://www.binance.com/en/futures/{ticker.lower()}usdt"
bybit_url = f"https://www.bybit.com/trade/usdt/{ticker.upper()}USDT"
webbrowser.open(binance_url)
webbrowser.open(bybit_url)
상장한 코인 티커 추출해서 바로 선물거래소 오픈
바이빗과 바이낸스를 실행하게 만들었는데 해당 티커가 없을수도 있음
뭐 알아서 합시다
def run_alarm(ticker: str):
open_exchange_links(ticker) # 거래소 페이지 먼저 열기
show_notification("📢 업비트 상장 감지", f"상장 티커: {ticker}")
play_alarm() # 알람 마지막에 울리기
티커 추출 함수
def extract_ticker(text: str) -> str:
"""
메시지에서 괄호 안에 있는 영어 대문자 티커를 추출 (예: (SAHARA))
"""
match = re.search(r'(([A-Z]{2,10}))', text)
if match:
return match.group(1)
return "UNKNOWN"
감지
@client.on(events.NewMessage(chats=channel_id))
async def handle_new_message(event):
text = event.message.text
if "업비트" in text and "신규 거래지원" in text:
print(f"[ALERT] 감지된 메시지:\n{text}")
ticker = extract_ticker(text)
run_alarm(ticker)
업비트 + 신규 거래지원이라는 키워드가 없으면 감지되지 않는다
실행
async def main():
try:
await client.start()
print(f"[START] 업비트 상장 감지 시작: {channel_id}")
await client.run_until_disconnected()
except KeyboardInterrupt:
print("[STOP] 프로그램 종료됨")
await client.disconnect()
if name == "main":
asyncio.run(main())