initial commit

This commit is contained in:
2026-01-31 22:34:57 +09:00
commit f1301de543
875 changed files with 196598 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
"""
Created on 20250601
"""
import sys
import logging
import pandas as pd
sys.path.extend(['../..', '.'])
import kis_auth as ka
from market_time import market_time
# 로깅 설정
logging.basicConfig(level=logging.INFO)
##############################################################################################
# [국내주식] 업종/기타 > 국내선물 영업일조회 [국내주식-160]
##############################################################################################
COLUMN_MAPPING = {
'date1': '영업일1',
'date2': '영업일2',
'date3': '영업일3',
'date4': '영업일4',
'date5': '영업일5',
'today': '오늘일자',
'time': '현재시간',
's_time': '장시작시간',
'e_time': '장마감시간'
}
NUMERIC_COLUMNS = []
def main():
"""
국내선물 영업일조회 테스트 함수
이 함수는 국내선물 영업일조회 API를 호출하여 결과를 출력합니다.
Returns:
None
"""
# pandas 출력 옵션 설정
pd.set_option('display.max_columns', None) # 모든 컬럼 표시
pd.set_option('display.width', None) # 출력 너비 제한 해제
pd.set_option('display.max_rows', None) # 모든 행 표시
# 인증 토큰 발급
ka.auth()
# case1 조회
logging.info("=== case1 조회 ===")
try:
result = market_time()
except ValueError as e:
logging.error("에러 발생: %s" % str(e))
return
logging.info("사용 가능한 컬럼: %s", result.columns.tolist())
# 컬럼명 한글 변환 및 데이터 출력
result = result.rename(columns=COLUMN_MAPPING)
# 숫자형 컬럼 소수점 둘째자리까지 표시
for col in NUMERIC_COLUMNS:
if col in result.columns:
result[col] = pd.to_numeric(result[col], errors='coerce').round(2)
logging.info("결과:")
print(result)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,48 @@
"""
Created on 20250601
"""
import sys
import logging
import pandas as pd
sys.path.extend(['../..', '.'])
import kis_auth as ka
# 로깅 설정
logging.basicConfig(level=logging.INFO)
##############################################################################################
# [국내주식] 업종/기타 > 국내선물 영업일조회 [국내주식-160]
##############################################################################################
# 상수 정의
API_URL = "/uapi/domestic-stock/v1/quotations/market-time"
def market_time() -> pd.DataFrame:
"""
국내선물 영업일조회 API입니다.
API호출 시 body 혹은 params로 입력하는 사항이 없습니다.
Returns:
pd.DataFrame: 국내선물 영업일조회 데이터
Example:
>>> df = market_time()
>>> print(df)
"""
tr_id = "HHMCM000002C0" # 국내선물 영업일조회
params = {}
res = ka._url_fetch(API_URL, tr_id, "", params)
if res.isOK():
result = pd.DataFrame([res.getBody().output1])
return result
else:
res.printError(url=API_URL)
return pd.DataFrame()