Skip to content

get_market_ticker_list() 조회 오류 #230

@yourbest

Description

@yourbest

get_market_ticker_list() 함수 조회 결과가 0 입니다.
방금(2025-08-01) 현재 수행한 결과와 코드입니다.

Testing get_market_ticker_list...
Testing for date: 20250801
Number of tickers in KOSPI: 0
Number of tickers in KOSDAQ: 0
Number of tickers in KONEX: 0
get_market_ticker_list test PASSED

Testing get_market_ohlcv_by_date...

Samsung Electronics (005930) OHLCV data from 20230101 to 20250801:
날짜 시가 고가 저가 종가 거래량 등락률

2023-01-02 55500 56100 55200 55500 10031448 0.361664
2023-01-03 55400 56000 54500 55400 13547030 -0.180180
2023-01-04 55700 58000 55600 57800 20188071 4.332130
2023-01-05 58200 58800 57600 58200 15682826 0.692042
2023-01-06 58300 59400 57900 59000 17334989 1.374570
get_market_ohlcv_by_date test PASSED

from pykrx import stock
import datetime

def test_get_market_ticker_list():
    """
    get_market_ticker_list() 함수를 테스트합니다.
    KOSPI, KOSDAQ, KONEX 시장의 티커 목록을 가져와서 각 시장별 티커 수를 출력합니다.
    """
    print("Testing get_market_ticker_list...")
    today = datetime.date.today().strftime("%Y%m%d")
    print(f"Testing for date: {today}")
    try:
        tickers_kospi = stock.get_market_ticker_list(date=today, market="KOSPI")
        print(f"Number of tickers in KOSPI: {len(tickers_kospi)}")
        if tickers_kospi:
            print(f"Sample tickers (KOSPI): {tickers_kospi[:5]}")

        tickers_kosdaq = stock.get_market_ticker_list(date=today, market="KOSDAQ")
        print(f"Number of tickers in KOSDAQ: {len(tickers_kosdaq)}")
        if tickers_kosdaq:
            print(f"Sample tickers (KOSDAQ): {tickers_kosdaq[:5]}")

        tickers_konex = stock.get_market_ticker_list(date=today, market="KONEX")
        print(f"Number of tickers in KONEX: {len(tickers_konex)}")
        if tickers_konex:
            print(f"Sample tickers (KONEX): {tickers_konex[:5]}")
        print("get_market_ticker_list test PASSED")
    except Exception as e:
        print(f"get_market_ticker_list test FAILED: {e}")

def test_get_market_ohlcv_by_date():
    """
    get_market_ohlcv_by_date() 함수를 테스트합니다.
    특정 기간 동안의 KOSPI 및 KOSDAQ 시장 전체의 OHLCV 데이터를 가져와서 출력합니다.
    """
    print("\nTesting get_market_ohlcv_by_date...")
    start_date = "20230101"
    end_date = datetime.date.today().strftime("%Y%m%d")

    try:
        # 개별 종목 데이터 (삼성전자 티커로 테스트)
        samsung_ticker = "005930" # Samsung Electronics
        df_samsung = stock.get_market_ohlcv_by_date(fromdate=start_date, todate=end_date, ticker=samsung_ticker)
        print(f"\nSamsung Electronics (005930) OHLCV data from {start_date} to {end_date}:")
        print(df_samsung.head())

        print("get_market_ohlcv_by_date test PASSED")
    except Exception as e:
        print(f"get_market_ohlcv_by_date test FAILED: {e}")

if __name__ == "__main__":
    test_get_market_ticker_list()
    test_get_market_ohlcv_by_date()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions