Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pykis/api/stock/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class KisStockInfoResponse(KisStockInfo, KisResponseProtocol, Protocol):
"market",
"symbol",
"name",
"eng_name",
"name_eng",
lines="single",
)
class KisStockInfoRepr:
Expand Down
8 changes: 4 additions & 4 deletions pykis/api/stock/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class KisQuote(KisProductProtocol, Protocol):
"""한국투자증권 상품 시세"""

@property
def sector_name(self) -> str:
def sector_name(self) -> str | None:
"""업종명"""
raise NotImplementedError

Expand Down Expand Up @@ -301,7 +301,7 @@ class KisQuoteBase(KisQuoteRepr, KisProductBase):
market: MARKET_TYPE
"""상품유형타입"""

sector_name: str
sector_name: str | None
"""업종명"""
price: Decimal
"""현재가"""
Expand Down Expand Up @@ -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"]
"""현재가"""
Expand Down Expand Up @@ -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"]
"""현재가"""
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_product_quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down