chore: 장 마감일 파싱 수정

This commit is contained in:
Ayuriel 2025-04-09 22:19:06 +09:00
parent b8453f1825
commit 26e77a23fb
3 changed files with 14 additions and 2 deletions

View File

@ -3,6 +3,7 @@ attrs==25.3.0
bcrypt==4.3.0
beautifulsoup4==4.13.3
blinker==1.9.0
bt==1.1.0
cachetools==5.5.2
captcha==0.7.1
certifi==2025.1.31
@ -30,6 +31,7 @@ joblib==1.4.2
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
keyring==25.6.0
keyrings.alt==5.0.2
kiwisolver==1.4.8
lxml==5.3.1
MarkupSafe==3.0.2

View File

@ -26,6 +26,15 @@ def get_latest_biz_day():
return biz_day
def get_latest_biz_day2():
url = 'https://finance.naver.com/sise/sise_index.naver?code=KOSPI'
data = rq.post(url)
data_html = BeautifulSoup(data.content, 'lxml')
parse_day = data_html.select_one('div.group_heading > div.ly_realtime > span#time').text
biz_day = re.findall('[0-9]+', parse_day)
biz_day = ''.join(biz_day)
return biz_day
# 업종 분류 현황 가져옴
def get_stock_data(biz_day, mkt_id):
# logging.basicConfig(level=logging.DEBUG)
@ -188,6 +197,7 @@ def save_sector(sector):
if __name__ == '__main__':
# sector와 ticker 갱신
latest_biz_day = get_latest_biz_day()
latest_biz_day = get_latest_biz_day2()
# latest_biz_day='20250331'
process_for_total_stock(latest_biz_day)
process_for_wics(latest_biz_day)

View File

@ -16,7 +16,7 @@ def render_data_page():
with st.spinner('주식 데이터 수집중...'):
try:
# Call the krx data collection function
biz_day = krx.get_latest_biz_day()
biz_day = krx.get_latest_biz_day2()
krx.process_for_total_stock(biz_day)
krx.process_for_wics(biz_day)
# Show success message