주식자동매매 AI 프로그램 초기 모델

This commit is contained in:
2026-02-04 23:29:06 +09:00
parent 41df1a38d3
commit 7d5f62f844
20 changed files with 2987 additions and 0 deletions

22
modules/services/news.py Normal file
View File

@@ -0,0 +1,22 @@
import requests
import xml.etree.ElementTree as ET
class NewsCollector:
"""
NAS에서 뉴스를 받지 못할 경우, Windows 서버에서 직접 뉴스를 수집하는 모듈
(Google News RSS 활용)
"""
@staticmethod
def get_market_news(query="주식 시장"):
url = f"https://news.google.com/rss/search?q={query}&hl=ko&gl=KR&ceid=KR:ko"
try:
resp = requests.get(url, timeout=5)
root = ET.fromstring(resp.content)
items = []
for item in root.findall(".//item")[:5]:
title = item.find("title").text
items.append({"title": title, "source": "Google News"})
return items
except Exception as e:
print(f"❌ 뉴스 수집 실패: {e}")
return []