Skip to content

어제까지 잘되던게 안되네요 ㅠㅠ #35

Description

@hwanys2

def today_stock_company():
global df_stock
today = stock.get_nearest_business_day_in_a_week()
df_stock = stock.get_market_ohlcv_by_ticker(today)
df_stock["종목명"] = df_stock["종목명"].str.upper()
df_stock = df_stock.reset_index()

today_stock_company()

이걸실행하면


JSONDecodeError Traceback (most recent call last)
in ()
28 df_stock = df_stock.reset_index()
29
---> 30 today_stock_company()
31
32 #### 종목 코드 검색

in today_stock_company()
23 def today_stock_company():
24 global df_stock
---> 25 today = stock.get_nearest_business_day_in_a_week()
26 df_stock = stock.get_market_ohlcv_by_ticker(today)
27 df_stock["종목명"] = df_stock["종목명"].str.upper()

/home/pi/.local/lib/python3.7/site-packages/pykrx/stock/api.py in get_nearest_business_day_in_a_week()
36 curr = _datetime2string(curr)
37 prev = _datetime2string(prev)
---> 38 df = krx.get_index_ohlcv_by_date(prev, curr, "1001")
39 return df.index[-1].strftime("%Y%m%d")
40

/home/pi/.local/lib/python3.7/site-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):
9 return DataFrame()

/home/pi/.local/lib/python3.7/site-packages/pykrx/website/krx/market/wrap.py in get_index_ohlcv_by_date(fromdate, todate, ticker)
383 20190131 2222.879883 2222.879883 2201.219971 2204.850098 545248000
384 """
--> 385 df = MKD20011_SUB().fetch(fromdate, todate, ticker[1:], ticker[0])
386 df = df[['trd_dd', 'opnprc_idx', 'hgprc_idx', 'lwprc_idx',
387 'clsprc_idx', 'acc_trdvol']]

/home/pi/.local/lib/python3.7/site-packages/pykrx/website/krx/market/core.py in fetch(self, fromdate, todate, index, market)
299 idx_cd = "1{}".format(index)
300 result = self.post(idx_cd=idx_cd, ind_tp_cd=market, idx_ind_cd=index, bz_dd=todate,
--> 301 chartType="line", chartStandard="srate", fromdate=fromdate, todate=todate)
302 return DataFrame(result['output'])
303

/home/pi/.local/lib/python3.7/site-packages/pykrx/website/krx/krxio.py in post(self, **params)
15 params.update({"code": otp.text})
16 resp = super().read(**params)
---> 17 return resp.json()
18
19 @Property

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

/usr/lib/python3/dist-packages/simplejson/init.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
516 parse_constant is None and object_pairs_hook is None
517 and not use_decimal and not kw):
--> 518 return _default_decoder.decode(s)
519 if cls is None:
520 cls = JSONDecoder

/usr/lib/python3/dist-packages/simplejson/decoder.py in decode(self, s, _w, _PY3)
368 if _PY3 and isinstance(s, bytes):
369 s = str(s, self.encoding)
--> 370 obj, end = self.raw_decode(s)
371 end = _w(s, end).end()
372 if end != len(s):

/usr/lib/python3/dist-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3)
398 elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
399 idx += 3
--> 400 return self.scan_once(s, idx=_w(s, idx).end())

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

이런오류가발생해요

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions