Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KRX StockListing 오류 문의. #236

Open
YchJuju opened this issue Nov 23, 2024 · 2 comments
Open

KRX StockListing 오류 문의. #236

YchJuju opened this issue Nov 23, 2024 · 2 comments

Comments

@YchJuju
Copy link

YchJuju commented Nov 23, 2024

안녕하세요? 어제까지만 해도 잘 사용하다가, KRX와 관련된 종목을 조회할 때 오류가 발생합니다. 사용중인 버전은 finance-datareader-0.9.94 입니다.

image

@YchJuju
Copy link
Author

YchJuju commented Nov 23, 2024

오류전문은 아래와 같습니다.


JSONDecodeError Traceback (most recent call last)
Cell In[10], line 1
----> 1 stocks = fdr.StockListing('KRX') # KRX: 2,663 종목(=코스피+코스닥+코넥스)
2 stocks.head()

File ~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/FinanceDataReader/data.py:158, in StockListing(market, start, end)
156 market = market.upper()
157 if market in ['KRX', 'KOSPI', 'KOSDAQ', 'KONEX', 'KRX-MARCAP']:
--> 158 return KrxMarcapListing(market).read()
159 elif market in ['KRX-DESC', 'KOSPI-DESC', 'KOSDAQ-DESC', 'KONEX-DESC']:
160 return KrxStockListing(market).read()

File ~/.pyenv/versions/3.11.9/lib/python3.11/site-packages/FinanceDataReader/krx/listing.py:20, in KrxMarcapListing.read(self)
18 def read(self):
19 url = 'http://data.krx.co.kr/comm/bldAttendant/executeForResourceBundle.cmd?baseName=krx.mdc.i18n.component&key=B128.bld'
---> 20 j = json.loads(requests.get(url, headers=self.headers).text)
21 date_str = j['result']['output'][0]['max_work_dt']
23 mkt_map = {'KRX-MARCAP':'ALL', 'KRX':'ALL', 'KOSPI':'STK', 'KOSDAQ':'KSQ', 'KONEX':'KNX'}

File ~/.pyenv/versions/3.11.9/lib/python3.11/json/init.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
341 s = s.decode(detect_encoding(s), 'surrogatepass')
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
348 cls = JSONDecoder

File ~/.pyenv/versions/3.11.9/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
332 def decode(self, s, _w=WHITESPACE.match):
333 """Return the Python representation of s (a str instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):

File ~/.pyenv/versions/3.11.9/lib/python3.11/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@YchJuju YchJuju changed the title KRX 서버 문의 KRX StockListing 오류 문의. Nov 23, 2024
@YchJuju
Copy link
Author

YchJuju commented Nov 23, 2024

홀리, KRX 서버 점검중이네요.
혹시 같은 유형의 오류로 여길 찾으신 분들은 참고하세요!
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant