Skip to content

get_market_trading_volume_by_date 해당 함수 사용시 에러가 나고 있습니다. #71

Description

@asjgi

`/usr/local/lib/python3.7/dist-packages/pykrx/stock/api.py in get_market_trading_volume_by_date(fromdate, todate, ticker, etf, etn, elw, on, detail, freq)
742 on, detail)
743 else:
--> 744 df = krx.get_market_trading_value_and_volume_on_ticker_by_date(fromdate, todate, ticker, "거래량", on, detail)
745 return resample_ohlcv(df, freq, sum)
746

/usr/local/lib/python3.7/dist-packages/pykrx/website/comm/util.py in wrapper(*args, **kwargs)
5 def wrapper(*args, **kwargs):
6 try:
----> 7 return func(*args, **kwargs)
8 except (AttributeError, KeyError, TypeError) as e:
9 logging.info(args, kwargs)

/usr/local/lib/python3.7/dist-packages/pykrx/website/krx/market/wrap.py in get_market_trading_value_and_volume_on_ticker_by_date(fromdate, todate, ticker, option_a, option_b, detail_view)
519 1 2021/01/21 69,180,642 13,051,423 1,168,810,381 109,023,034 1,360,065,480
520 """
--> 521 isin = get_stock_ticker_isin(ticker)
522
523 option_a = {"거래량": 1, "거래대금": 2}.get(option_a, 1)

/usr/local/lib/python3.7/dist-packages/pykrx/website/comm/util.py in wrapper(*args, **kwargs)
5 def wrapper(*args, **kwargs):
6 try:
----> 7 return func(*args, **kwargs)
8 except (AttributeError, KeyError, TypeError) as e:
9 logging.info(args, kwargs)

/usr/local/lib/python3.7/dist-packages/pykrx/website/krx/market/ticker.py in get_stock_ticker_isin(ticker)
62 @dataframe_empty_handler
63 def get_stock_ticker_isin(ticker):
---> 64 s = StockTicker().get(ticker)
65 return s['ISIN']
66

/usr/local/lib/python3.7/dist-packages/pykrx/website/comm/util.py in init(self, *args, **kwargs)
24 if self._sealed:
25 return
---> 26 super(class_w, self).init(*args, **kwargs)
27 self.sealed = True
28 class_w.name = class
.name

/usr/local/lib/python3.7/dist-packages/pykrx/website/krx/market/ticker.py in init(self)
13 def init(self):
14 self.listed = self.__fetch(상장종목검색)
---> 15 self.delisted = self.__fetch(상폐종목검색)
16
17 @dataframe_empty_handler

/usr/local/lib/python3.7/dist-packages/pykrx/website/comm/util.py in wrapper(*args, **kwargs)
5 def wrapper(*args, **kwargs):
6 try:
----> 7 return func(*args, **kwargs)
8 except (AttributeError, KeyError, TypeError) as e:
9 logging.info(args, kwargs)

/usr/local/lib/python3.7/dist-packages/pykrx/website/krx/market/ticker.py in __fetch(self, what, market)
19 market_dict = {"코스피": "STK", "코스닥": "KSQ", "코넥스": "KNX", "전체": "ALL"}
20 market = market_dict.get(market, "ALL")
---> 21 df = what().fetch(market)
22 df = df[['short_code', 'codeName', 'full_code', 'marketName']]
23 df = df.replace("유가증권", "코스피")

/usr/local/lib/python3.7/dist-packages/pykrx/website/krx/market/core.py in fetch(self, mktsel, searchText)
55 3 KR7038120002 038120 AD모터스 KSQ 코스닥 16
56 """
---> 57 result = self.read(mktsel=mktsel, searchText=searchText, typeNo=0)
58 return DataFrame(result['block1'])
59

/usr/local/lib/python3.7/dist-packages/pykrx/website/krx/krxio.py in read(self, **params)
8 params.update(bld=self.bld)
9 resp = super().read(**params)
---> 10 return resp.json()
11
12 @Property

/usr/local/lib/python3.7/dist-packages/requests/models.py in json(self, **kwargs)
896 # used.
897 pass
--> 898 return complexjson.loads(self.text, **kwargs)
899
900 @Property

/usr/lib/python3.7/json/init.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
346 parse_int is None and parse_float is None and
347 parse_constant is None and object_pairs_hook is None and not kw):
--> 348 return _default_decoder.decode(s)
349 if cls is None:
350 cls = JSONDecoder

/usr/lib/python3.7/json/decoder.py in decode(self, s, _w)
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):

/usr/lib/python3.7/json/decoder.py in 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)`

제가 볼때는 Json Decode할때 에러가 나는 듯 한데, 내부 market/core 파일 에서의 문제 같은데.
도움 주시면 감사하겠습니다 (__)
덕분에 종종 잘 사용하고 있습니다.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions