Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KRX Data Pipeline DAGs

개요

데이터를 수집하여 데이터베이스에 적재하는 Airflow DAG 모음입니다.

DAG 목록

1. KRX to PostgreSQL (krx_to_postgresql.py)

KRX 주식 데이터를 수집하여 PostgreSQL에 적재하는 메인 DAG

기능

  • 종목 메타데이터 수집: KOSPI/KOSDAQ 상장 종목의 기본 정보 (종목코드, 종목명, 상장일 등)
  • 일별 시세 데이터: OHLCV (시가, 고가, 저가, 종가, 거래량) 및 거래대금
  • 펀더멘털 데이터: PER, PBR, EPS, BPS, DPS, 배당수익률
  • 투자자별 매매동향: 개인, 외국인, 기관, 기타법인별 매매금액

데이터베이스 스키마

-- 종목 메타데이터
stock_meta (ticker, market, name, sector, list_date, delist_date)

-- 일별 시세
stock_price_daily (date, ticker, market, open_price, high_price, low_price, close_price, volume, traded_value)

-- 펀더멘털
stock_fundamental (date, ticker, market, per, pbr, eps, bps, dps, div)

-- 투자자별 매매동향
stock_investor_trading (date, ticker, market, individual, foreigner, institution, etc, total)

수정 로그

  • 2025-08-31: 초기 버전 생성
    • KRX 주식 데이터 수집 기능 구현
    • PostgreSQL 테이블 자동 생성
    • 월별 구간 분할을 통한 대용량 데이터 처리
    • Upsert 기능으로 중복 데이터 방지

추가 예정 DAG

2. KRX Bond Data Pipeline (예정)

  • 파일명: krx_bond_to_postgresql.py
  • 기능: 채권 데이터 수집 및 적재
  • 상태: 개발 예정

3. KRX ETF Data Pipeline (예정)

  • 파일명: krx_etf_to_postgresql.py
  • 기능: ETF 데이터 수집 및 적재
  • 상태: 개발 예정

4. KRX Options/Futures Pipeline (예정)

  • 파일명: krx_derivatives_to_postgresql.py
  • 기능: 파생상품 데이터 수집 및 적재
  • 상태: 개발 예정

공통 설정

의존성

pip install pykrx pandas sqlalchemy psycopg2-binary python-dateutil

환경 변수

데이터베이스 연결을 위해 다음 환경변수가 필요합니다:

DB_HOST=your_postgres_host
DB_PORT=Your_postgres_port
DB_NAME=your_database_name
DB_USER=your_username
DB_PASSWORD=your_password

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages