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

xa.get_daily("SH600036",) does not work ! #187

Open
e1-git opened this issue Jul 29, 2024 · 5 comments
Open

xa.get_daily("SH600036",) does not work ! #187

e1-git opened this issue Jul 29, 2024 · 5 comments

Comments

@e1-git
Copy link

e1-git commented Jul 29, 2024

{'data': {'items': [], 'items_size': 0},
'error_code': 0,
'error_description': ''}

File ~/opt/anaconda3/lib/python3.10/site-packages/xalpha/universal.py:171, in get_historical_fromxq(code, count, type_, full)
--> 171 df = pd.DataFrame(data=r["data"]["item"], columns=r["data"]["column"])
172 df["date"] = (df["timestamp"]).apply(ts2pdts) # reset hours to zero
173 return df

KeyError: 'item'

@refraction-ray
Copy link
Owner

works for me, need more info on the settings and environments to locate and reproduce the error

@e1-git
Copy link
Author

e1-git commented Aug 1, 2024

os: Ubuntu 22.04 LTS
python version: 3.10.9 (main, Mar 1 2023, 18:23:06) [GCC 11.2.0]
xalpha version: 0.11.11

os: macos Ventura 13.0.1
python version: 3.10.13 (main, Sep 11 2023, 08:16:02) [Clang 14.0.6 ]
xalpha version: 0.12.0

both have the same error.

KeyError Traceback (most recent call last)
File ~/anaconda3/lib/python3.10/site-packages/xalpha/universal.py:1993, in cachedio..cached..wrapper(*args, **kws)
1992 elif backend == "memory":
-> 1993 df0 = getattr(thismodule, "cached_dict")[key]
1994 else:

KeyError: 'SH600036'

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
Cell In[5], line 6
----> 6 xa.get_daily("SH600036", prev=15)

File ~/anaconda3/lib/python3.10/site-packages/xalpha/universal.py:2051, in cachedio..cached..wrapper(*args, **kws)
2047 kws["end"] = (
2048 today_obj() - dt.timedelta(days=1)
2049 ).strftime("%Y%m%d")
2050 is_changed = True
-> 2051 df0 = f(*args, **kws)
2053 if df0 is not None and len(df0) > 0 and is_changed:
2054 if backend == "csv":

File ~/anaconda3/lib/python3.10/site-packages/xalpha/universal.py:1128, in get_daily(code, start, end, prev, from, wrapper, handler, **kws)
1125 elif from in ["xueqiu", "xq", "snowball", "XQ"]:
1126 code, type
= decouple_code(code)
-> 1128 df = get_historical_fromxq(code, count, type
=type
)
1129 df = prettify(df)
1130 elif _from in ["zhongjianjia", "zjj", "chinamoney", "ZJJ"]:

File ~/anaconda3/lib/python3.10/site-packages/xalpha/universal.py:168, in get_historical_fromxq(code, count, type_, full)
160 # pe 是 TTM 数据
161 r = rget_json(
162 url.format(
163 code=code, tomorrow=int(tomorrow_ts() * 1000), count=count, type_=type_
(...)
166 headers={"user-agent": "Mozilla/5.0"},
167 )
--> 168 df = pd.DataFrame(data=r["data"]["item"], columns=r["data"]["column"])
169 df["date"] = (df["timestamp"]).apply(ts2pdts) # reset hours to zero
170 return df

KeyError: 'item'

@ohmyboy12
Copy link

I use xalpha 0.12.0, also the get_daily does not work

@refraction-ray
Copy link
Owner

refraction-ray commented Oct 5, 2024

refer to #190 (comment)

@ohmyboy12
Copy link

ohmyboy12 commented Oct 5, 2024 via email

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

3 participants