This commit is contained in:
dsyoon
2025-04-26 19:54:45 +09:00
parent d469df8759
commit 1fdbb8c783
2 changed files with 25 additions and 3 deletions

View File

@@ -111,4 +111,4 @@ KR_COINS = {
# 볼린저 밴드 설정 # 볼린저 밴드 설정
BOLLINGER_PERIOD = 20 # 볼린저 밴드 기간 BOLLINGER_PERIOD = 20 # 볼린저 밴드 기간
BOLLINGER_STD = 2 # 표준편차 승수 BOLLINGER_STD = 2 # 표준편차 승수
ALERT_THRESHOLD = 0.15 # 하단 밴드 대비 10% 근접 시 알림 ALERT_THRESHOLD = 0.20 # 하단 밴드 대비 10% 근접 시 알림

View File

@@ -7,6 +7,7 @@ import requests
import json import json
import asyncio import asyncio
from multiprocessing import Pool from multiprocessing import Pool
import schedule
from config import * from config import *
def send(text): def send(text):
@@ -117,7 +118,7 @@ def sendAlertMsg(info, market="US"):
print(f"Error sending Telegram message: {str(e)}") print(f"Error sending Telegram message: {str(e)}")
return return
def monitor_stocks(): def monitor_us_stocks():
# 미국 주식 모니터링 # 미국 주식 모니터링
print("Monitoring US stocks...") print("Monitoring US stocks...")
for symbol in US_STOCKS: for symbol in US_STOCKS:
@@ -138,6 +139,9 @@ def monitor_stocks():
print(f"Data for {symbol} is empty or None.") print(f"Data for {symbol} is empty or None.")
time.sleep(0.5) time.sleep(0.5)
return
def monitor_kr_stocks():
# 한국 ETF 모니터링 # 한국 ETF 모니터링
print("\nMonitoring Korean ETFs...") print("\nMonitoring Korean ETFs...")
for symbol in KR_ETFS: for symbol in KR_ETFS:
@@ -183,7 +187,25 @@ def monitor_coins():
return return
def run_schedule():
while True:
schedule.run_pending()
time.sleep(1)
if __name__ == "__main__": if __name__ == "__main__":
print("Starting monitoring system...")
# 스케줄 설정
schedule.every().hour.at(":01").do(monitor_coins) # 매시 1분에 실행
schedule.every().day.at("17:20").do(monitor_us_stocks) # 매일 저녁 5시 20분에 실행
schedule.every().day.at("08:00").do(monitor_kr_stocks) # 매일 오전 8시에 실행
# 초기 실행
print("Running initial checks...")
monitor_coins() monitor_coins()
monitor_stocks() monitor_us_stocks()
monitor_kr_stocks()
# 스케줄러 실행
print("Starting scheduler...")
run_schedule()