init
This commit is contained in:
@@ -111,4 +111,4 @@ KR_COINS = {
|
||||
# 볼린저 밴드 설정
|
||||
BOLLINGER_PERIOD = 20 # 볼린저 밴드 기간
|
||||
BOLLINGER_STD = 2 # 표준편차 승수
|
||||
ALERT_THRESHOLD = 0.15 # 하단 밴드 대비 10% 근접 시 알림
|
||||
ALERT_THRESHOLD = 0.20 # 하단 밴드 대비 10% 근접 시 알림
|
||||
@@ -7,6 +7,7 @@ import requests
|
||||
import json
|
||||
import asyncio
|
||||
from multiprocessing import Pool
|
||||
import schedule
|
||||
from config import *
|
||||
|
||||
def send(text):
|
||||
@@ -117,7 +118,7 @@ def sendAlertMsg(info, market="US"):
|
||||
print(f"Error sending Telegram message: {str(e)}")
|
||||
return
|
||||
|
||||
def monitor_stocks():
|
||||
def monitor_us_stocks():
|
||||
# 미국 주식 모니터링
|
||||
print("Monitoring US stocks...")
|
||||
for symbol in US_STOCKS:
|
||||
@@ -138,6 +139,9 @@ def monitor_stocks():
|
||||
print(f"Data for {symbol} is empty or None.")
|
||||
time.sleep(0.5)
|
||||
|
||||
return
|
||||
|
||||
def monitor_kr_stocks():
|
||||
# 한국 ETF 모니터링
|
||||
print("\nMonitoring Korean ETFs...")
|
||||
for symbol in KR_ETFS:
|
||||
@@ -183,7 +187,25 @@ def monitor_coins():
|
||||
|
||||
return
|
||||
|
||||
def run_schedule():
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
time.sleep(1)
|
||||
|
||||
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_stocks()
|
||||
monitor_us_stocks()
|
||||
monitor_kr_stocks()
|
||||
|
||||
# 스케줄러 실행
|
||||
print("Starting scheduler...")
|
||||
run_schedule()
|
||||
|
||||
Reference in New Issue
Block a user