From 2ab5984ecdad309d3e137149b758cceb46e35beb Mon Sep 17 00:00:00 2001 From: Soju06 Date: Tue, 29 Oct 2024 14:37:13 +0900 Subject: [PATCH 1/2] =?UTF-8?q?KisStockInfoRepr=20=EC=9E=98=EB=AA=BB?= =?UTF-8?q?=EB=90=9C=20=ED=95=84=EB=93=9C=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pykis/api/stock/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 4386133bfe8fab438fcdf8b7a22ce3120aa64f78 Mon Sep 17 00:00:00 2001 From: Soju06 Date: Wed, 30 Oct 2024 10:18:32 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EA=B5=AD=EB=82=B4=EC=A3=BC=EC=8B=9D=20?= =?UTF-8?q?=EC=8B=9C=EC=84=B8=EC=A1=B0=ED=9A=8C=20=EC=97=85=EC=A2=85?= =?UTF-8?q?=EB=AA=85=20=ED=95=84=EB=93=9C=20=EA=B8=B0=EB=B3=B8=EA=B0=92=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pykis/api/stock/quote.py | 8 ++++---- tests/unit/test_product_quote.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) 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))