FinanceData / FinanceDataReader

Financial data reader
1.18k stars 366 forks source link

fdr.DataReader('KRX-DELISTING')에서 오류 발생하고 있습니다. #226

Open dybaek9 opened 3 months ago

dybaek9 commented 3 months ago

df = fdr.DataReader('KRX-DELISTING') 실행시 오류 발생하고 있습니다. 확인 요청드립니다. 감사합니다.

JSONDecodeError Traceback (most recent call last) Cell In[1], line 3 1 import pandas as pd 2 import FinanceDataReader as fdr ----> 3 df = fdr.StockListing('KRX-DELISTING')

File C:\ProgramData\anaconda3\Lib\site-packages\FinanceDataReader\data.py:160, in StockListing(market) 158 return NaverStockListing(market).read() 159 elif market in ['KRX-DELISTING' ]: --> 160 return KrxDelisting(market).read() 161 elif market in ['KRX-ADMINISTRATIVE', 'KRX-ADMIN' ]: 162 return KrxAdministrative(market).read()

File C:\ProgramData\anaconda3\Lib\site-packages\FinanceDataReader\krx\listing.py:135, in KrxDelisting.read(self) 133 url = 'http://data.krx.co.kr/comm/bldAttendant/getJsonData.cmd' 134 r = requests.post(url, data, headers=self.headers) --> 135 j = json.loads(r.text) 136 df = pd.DataFrame(j['output']) 137 col_map = {'ISU_CD':'Symbol', 'ISU_NM':'Name', 'MKT_NM':'Market', 138 'SECUGRP_NM':'SecuGroup', 'KIND_STKCERT_TP_NM':'Kind', 139 'LIST_DD': 'ListingDate', 'DELIST_DD':'DelistingDate', 'DELIST_RSN_DSC':'Reason', 140 'ARRANTRD_MKTACT_ENFORCE_DD':'ArrantEnforceDate', 'ARRANTRD_END_DD':'ArrantEndDate', 141 'IDX_IND_NM':'Industry', 'PARVAL':'ParValue', 'LIST_SHRS':'ListingShares', 142 'TO_ISU_SRT_CD':'ToSymbol', 'TO_ISU_ABBRV':'ToName' }

File C:\ProgramData\anaconda3\Lib\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 C:\ProgramData\anaconda3\Lib\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 C:\ProgramData\anaconda3\Lib\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)

FinanceData commented 3 months ago

잘 수행되는 것을 확인하였습니다.

KRX의 일시적인 문제일 수 있습니다. 실패하는 경우 KRX에서 나오는 에러 메지시를 출력하도록 수정하여 원인을 파악하는데 도움이 되도록 수정하는 것을 검토하고 있습니다.