diff --git a/pykis/api/stock/info.py b/pykis/api/stock/info.py index 7321e291..7b2d7433 100644 --- a/pykis/api/stock/info.py +++ b/pykis/api/stock/info.py @@ -181,7 +181,7 @@ class KisStockInfoResponse(KisStockInfo, KisResponseProtocol, Protocol): "market", "symbol", "name", - "eng_name", + "name_eng", lines="single", ) class KisStockInfoRepr: diff --git a/pykis/api/stock/quote.py b/pykis/api/stock/quote.py index 3ad40fbb..b0d98941 100644 --- a/pykis/api/stock/quote.py +++ b/pykis/api/stock/quote.py @@ -75,7 +75,7 @@ class KisQuote(KisProductProtocol, Protocol): """한국투자증권 상품 시세""" @property - def sector_name(self) -> str: + def sector_name(self) -> str | None: """업종명""" raise NotImplementedError @@ -301,7 +301,7 @@ class KisQuoteBase(KisQuoteRepr, KisProductBase): market: MARKET_TYPE """상품유형타입""" - sector_name: str + sector_name: str | None """업종명""" price: Decimal """현재가""" @@ -402,7 +402,7 @@ class KisDomesticQuote(KisQuoteBase, KisAPIResponse): market: MARKET_TYPE """상품유형타입""" - sector_name: str = KisString["bstp_kor_isnm"] + sector_name: str | None = KisString["bstp_kor_isnm", None] """업종명""" price: Decimal = KisDecimal["stck_prpr"] """현재가""" @@ -516,7 +516,7 @@ class KisForeignQuote(KisQuoteBase, KisAPIResponse): market: MARKET_TYPE """상품유형타입""" - sector_name: str = KisString["e_icod"] + sector_name: str | None = KisString["e_icod"] """업종명""" price: Decimal = KisDecimal["last"] """현재가""" diff --git a/tests/unit/test_product_quote.py b/tests/unit/test_product_quote.py index bec37080..f8a1abaa 100644 --- a/tests/unit/test_product_quote.py +++ b/tests/unit/test_product_quote.py @@ -25,6 +25,9 @@ def test_quotable(self): def test_krx_quote(self): self.assertTrue(isinstance(self.pykis.stock("005930").quote(), KisQuote)) + # https://github.com/Soju06/python-kis/issues/48 + # bstp_kor_isnm 필드 누락 대응 + self.assertTrue(isinstance(self.pykis.stock("002170").quote(), KisQuote)) def test_nasd_quote(self): self.assertTrue(isinstance(self.pykis.stock("NVDA").quote(), KisQuote))