1251240000 / StockVisualization

基于Django框架的Tushare股票数据可视化平台
114 stars 36 forks source link

有个错误,请问怎么回事 #3

Closed ohyeah521 closed 4 years ago

ohyeah521 commented 4 years ago
root@131:~/StcokVisualization# python3 manage.py refresh_data
[Getting data:]#Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.7/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.7/dist-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/root/StcokVisualization/ui/management/commands/refresh_data.py", line 26, in handle
    today_all = ts.get_today_all()
  File "/usr/local/lib/python3.7/dist-packages/tushare/stock/trading.py", line 317, in get_today_all
    df = _parsing_dayprice_json('hs_a', 1)
  File "/usr/local/lib/python3.7/dist-packages/tushare/stock/trading.py", line 131, in _parsing_dayprice_json
    df = pd.DataFrame(pd.read_json(js, dtype={'code':object}),
  File "/usr/local/lib/python3.7/dist-packages/pandas/io/json/_json.py", line 592, in read_json
    result = json_reader.read()
  File "/usr/local/lib/python3.7/dist-packages/pandas/io/json/_json.py", line 717, in read
    obj = self._get_object_parser(self.data)
  File "/usr/local/lib/python3.7/dist-packages/pandas/io/json/_json.py", line 739, in _get_object_parser
    obj = FrameParser(json, **kwargs).parse()
  File "/usr/local/lib/python3.7/dist-packages/pandas/io/json/_json.py", line 849, in parse
    self._parse_no_numpy()
  File "/usr/local/lib/python3.7/dist-packages/pandas/io/json/_json.py", line 1093, in _parse_no_numpy
    loads(json, precise_float=self.precise_float), dtype=None
ValueError: No ':' found when decoding object value
1251240000 commented 4 years ago

tushare提供的数据有时候会出错,多尝试几次 若错误一直存在,可以在ui/management/commands/refresh_data.py中追踪此错误

ohyeah521 commented 4 years ago

tushare提供的数据有时候会出错,多尝试几次 若错误一直存在,可以在ui/management/commands/refresh_data.py中追踪此错误

我单独测试了一下tushare的接口,这个接口失效了: today_all = ts.get_today_all()

一直返回错误,不知道是我的环境原因还是就是这个接口不能用了,另外我看tushare好像有 pro版本的,但是在里面没找到这个接口。

解决方法参考链接:https://blog.csdn.net/xsophiax/article/details/106119968

替换文件:usr/local/lib/python3.7/dist-packages/tushare/stock/trading.py

trading.zip