yutiansut / QUANTAXIS

QUANTAXIS 支持任务调度 分布式部署的 股票/期货/期权 数据/回测/模拟/交易/可视化/多账户 纯本地量化解决方案
https://yutiansut.github.io/QUANTAXIS/
MIT License
8.25k stars 2.97k forks source link

save 问题(bond option)KeyError: "None of ['code'] are in the columns" #1720

Open disappearedgod opened 3 years ago

disappearedgod commented 3 years ago

问题反馈

当您安装/使用QUANTAXIS的时候如果遇到任何问题, 您可以在这里提出,我们会在24小时内给您答复

您使用的QUANTAXIS版本号是什么?

Successfully installed quantaxis-1.10.18

您的系统信息(包括系统版本,系统架构(32/64),内存大小等等)

MAC 2.3 GHz 八核Intel Core i9 16 GB 2667 MHz DDR4 AMD Radeon Pro 5600M 8 GB

使用Tushare Pro [TSPRO]

您的系统环境是什么?

- monodb
- python3.7/3.8
- docker(有无)

mongo "version": "4.4.5", python 3.6 conda

Package Version Location


absl-py 0.13.0 aiohttp 3.7.4.post0 akshare 0.6.10 alembic 1.6.5 alpaca-trade-api 1.2.3 alpha-vantage 2.3.1 appdirs 1.4.4 appnope 0.1.2 APScheduler 3.7.0 argo-workflows 3.6.1 argon2-cffi 20.1.0 arviz 0.11.2 astor 0.8.1 astunparse 1.6.3 async-generator 1.10 async-timeout 3.0.1 asyncio 3.4.3 attrdict 2.0.1 attrs 21.2.0 autopep8 1.5.7 backcall 0.2.0 backports.entry-points-selectable 1.1.0 backtrader 1.9.76.123 backtrader-plotting 2.0.0 bcolz 1.2.1 beautifulsoup4 4.9.3 binance 0.3 bleach 3.3.0 bokeh 2.3.2 Bottleneck 1.3.2 brotlipy 0.7.0 bs4 0.0.1 cached-property 1.5.2 cachetools 4.2.2 certifi 2021.5.30 cffi 1.14.5 cftime 1.5.0 chardet 4.0.0 click 7.1.2 cloudpickle 1.6.0 colorama 0.4.4 colorlog 5.0.1 commonmark 0.9.1 contextvars 2.4 cryptography 3.4.7 csscompressor 0.9.5 cvxopt 1.2.5 cvxpy 1.1.13 cycler 0.10.0 cytoolz 0.11.0 daiquiri 3.0.0 dask 2021.3.0 dataclasses 0.8 DateTime 4.3 decorator 5.0.9 defusedxml 0.7.1 delegator.py 0.1.1 demjson 2.2.4 dictdiffer 0.8.1 dill 0.3.4 distlib 0.3.2 distributed 2021.3.0 distro 1.5.0 docopt 0.6.2 e 1.4.5 ecos 2.0.7.post1 empyrical 0.5.5 entrypoints 0.3 et-xmlfile 1.1.0 fastprogress 1.0.0 filelock 3.0.12 Flask 2.0.1 flatbuffers 1.12 fonttools 4.25.0 fpdf 1.7.2 fsspec 2021.6.1 gast 0.3.3 gevent 21.1.2 gevent-websocket 0.10.1 google-auth 1.32.1 google-auth-oauthlib 0.4.4 google-pasta 0.2.0 graphviz 0.17 greenlet 1.1.0 grpcio 1.34.1 h5py 2.10.0 HeapDict 1.0.1 html5lib 1.1 IbPy2 0.8.0 idna 2.10 idna-ssl 1.1.0 img2pdf 0.4.1 immutables 0.15 importlib-metadata 2.1.1 importlib-resources 5.2.0 inflection 0.5.1 intervaltree 3.1.0 invectio 0.1.0 ipykernel 5.3.4 ipython 7.16.1 ipython-genutils 0.2.0 ipywidgets 7.6.3 iso3166 1.0.1 iso4217 1.6.20180829 itsdangerous 2.0.1 janus 0.4.0 jedi 0.17.0 Jinja2 3.0.1 joblib 1.0.1 jqdatasdk 1.8.10 jsonformatter 0.3.1 jsonpath 0.82 jsonschema 3.2.0 jupyter-client 6.1.12 jupyter-contrib-core 0.3.3 jupyter-contrib-nbextensions 0.5.1 jupyter-core 4.7.1 jupyter-highlight-selected-word 0.2.0 jupyter-latex-envs 1.4.6 jupyter-nbextensions-configurator 0.4.1 jupyter-nbrequirements 0.7.3 jupyter-nbutils 0.1.3 jupyter-require 0.6.1 jupyterlab-pygments 0.1.2 jupyterlab-widgets 1.0.0 jupyterthemes 0.20.0 Keras 2.4.0 Keras-Applications 1.0.8 Keras-Preprocessing 1.1.2 kiwisolver 1.3.1 kubernetes 11.0.0 lesscpy 0.14.0 llvmlite 0.36.0 locket 0.2.0 Logbook 1.5.3 lru-dict 1.1.7 lxml 4.6.3 Mako 1.1.4 Markdown 3.3.4 markdown2 2.4.0 MarkupSafe 2.0.1 matplotlib 3.2.2 micropipenv 1.1.0 mistune 0.8.4 mkl-service 2.4.0 mock 4.0.3 more-itertools 8.8.0 motor 2.4.0 mpld3 0.5.5 msgpack 1.0.2 multidict 5.1.0 multipledispatch 0.6.0 multitasking 0.0.9 nbclient 0.5.3 nbconvert 6.0.7 nbformat 5.1.3 nest-asyncio 1.5.1 netCDF4 1.5.7 networkx 1.11 notebook 6.4.0 numba 0.53.1 numexpr 2.7.1 numpy 1.18.5 oauthlib 3.1.1 olefile 0.46 openpyxl 3.0.7 openshift 0.11.0 opt-einsum 3.3.0 osqp 0.6.2.post0 packaging 21.0 pandas 1.1.5 pandas-datareader 0.9.0 pandocfilters 1.4.3 parso 0.8.2 partd 1.2.0 patsy 0.5.1 pdf-bookmark 1.1.0 pexpect 4.8.0 pickleshare 0.7.5 pikepdf 2.16.1 Pillow 7.2.0 pip 21.1.3 pipreqs 0.4.10 platformdirs 2.0.2 plotly 5.1.0 ply 3.11 polling 0.3.1 prettytable 2.1.0 prometheus-client 0.11.0 prompt-toolkit 3.0.17 protobuf 3.17.3 psutil 5.8.0 psycopg2 2.8.6 ptyprocess 0.7.0 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycodestyle 2.7.0 pyconvert 0.6.3 pycparser 2.20 pyecharts 1.9.0 pyecharts-snapshot 0.2.0 pyee 8.1.0 pyelftools 0.27 PyExecJS 1.5.1 pyfolio 0.9.2 Pygments 2.9.0 pyltp 0.2.1 pymc3 3.10.0 pymongo 3.11.4 PyMySQL 1.0.2 pyOpenSSL 20.0.1 pyparsing 2.4.7 PyPDF2 1.26.0 pypinyin 0.42.0 pyportfolioopt 1.4.2 pyppeteer 0.2.5 PyQt5 5.15.4 PyQt5-Qt5 5.15.2 PyQt5-sip 12.9.0 pyrenko 0.1 pyrsistent 0.17.3 PySocks 1.7.1 pytdx 1.72 pytesseract 0.3.8 python-dateutil 2.8.1 python-editor 1.0.4 python-interface 1.6.1 python-json-logger 2.0.1 python-string-utils 1.0.0 pytz 2021.1 PyYAML 5.3.1 pyzmq 20.0.0 qdldl 0.1.5.post0 qgrid 1.3.1 Quandl 3.6.1 quantaxis 1.10.18 /Users/derek/Documents/GitHub/QUANTAXIS ratelimit 2.2.1 requests 2.25.1 requests-oauthlib 1.3.0 retrying 1.3.3 rfc5424-logging-handler 1.4.3 rich 10.6.0 rise 5.3.0 rsa 4.7.2 ruamel.yaml 0.17.10 ruamel.yaml.clib 0.2.6 scikit-learn 0.24.2 scipy 1.5.0 scs 2.1.4 seaborn 0.11.1 semantic-version 2.8.5 Send2Trash 1.5.0 sentry-sdk 1.3.0 setuptools 52.0.0.post20210125 simplejson 3.17.2 six 1.16.0 sortedcontainers 2.4.0 soupsieve 2.2.1 SQLAlchemy 1.3.24 statsmodels 0.12.2 TA-Lib 0.4.18 tables 3.6.1 tabulate 0.8.9 tblib 1.7.0 tenacity 8.0.1 tensorboard 2.5.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.0 tensorflow 2.3.0 tensorflow-estimator 2.3.0 termcolor 1.1.0 terminado 0.9.4 testpath 0.5.0 thamos 1.19.0 Theano-PyMC 1.0.11 thoth-analyzer 0.1.8 thoth-common 0.32.0 thoth-python 0.16.2 threadpoolctl 2.1.0 thriftpy2 0.4.14 toml 0.10.2 toolz 0.11.1 tornado 6.1 tqdm 4.61.2 trading-calendars 2.1.1 traitlets 4.3.3 tushare 1.2.64 typing-extensions 3.10.0.0 tzlocal 2.1 urllib3 1.26.6 virtualenv 20.6.0 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 1.1.0 websockets 8.1 Werkzeug 2.0.1 wheel 0.36.2 widgetsnbextension 3.5.1 wrapt 1.12.1 xarray 0.18.2 xlrd 2.0.1 yarg 0.1.9 yarl 1.6.3 yaspin 2.0.0 yfinance 0.1.63 zenlog 1.1 zict 2.0.0 zipline-trader 1.6.1+6.gacc6dde7 /Users/derek/Documents/GitHub/zipline-trader/src/zipline-trader zipp 3.5.0 zope.event 4.5.0 zope.interface 5.4.0

zipline

您需要反馈的问题

除了save all/save min之外

save bond/option 时候出了这样的问题

QUANTAXIS>> === The BEST SERVER === stock_ip 121.14.104.70 future_ip 106.14.95.149 Traceback (most recent call last): File "/Users/derek/opt/anaconda3/envs/zipline/bin/quantaxis", line 33, in sys.exit(load_entry_point('quantaxis', 'console_scripts', 'quantaxis')()) File "/Users/derek/Documents/GitHub/QUANTAXIS/QUANTAXIS/QACmd/init.py", line 735, in QA_cmd cli.cmdloop() File "/Users/derek/opt/anaconda3/envs/zipline/lib/python3.6/cmd.py", line 138, in cmdloop stop = self.onecmd(line) File "/Users/derek/opt/anaconda3/envs/zipline/lib/python3.6/cmd.py", line 217, in onecmd return func(arg) File "/Users/derek/Documents/GitHub/QUANTAXIS/QUANTAXIS/QACmd/init.py", line 630, in do_save QA_SU_save_option_contract_list("tdx") File "/Users/derek/Documents/GitHub/QUANTAXIS/QUANTAXIS/QASU/main.py", line 250, in QA_SU_save_option_contract_list engine.QA_SU_save_option_contract_list(client=client) File "/Users/derek/Documents/GitHub/QUANTAXIS/QUANTAXIS/QASU/save_tdx.py", line 5432, in QA_SU_save_option_contract_list rows_of_option = QA_fetch_get_option_all_contract_time_to_market() File "/Users/derek/Documents/GitHub/QUANTAXIS/QUANTAXIS/QAFetch/QATdx.py", line 1703, in QA_fetch_get_option_all_contract_time_to_market result = QA_fetch_get_option_list('tdx') File "/Users/derek/Documents/GitHub/QUANTAXIS/QUANTAXIS/QAFetch/QATdx.py", line 2008, in QA_fetch_get_option_list ) if extension_market_list is None else extension_market_list File "/Users/derek/Documents/GitHub/QUANTAXIS/QUANTAXIS/QAFetch/QATdx.py", line 1515, in QA_fetch_get_extensionmarket_list drop=False) File "/Users/derek/opt/anaconda3/envs/zipline/lib/python3.6/site-packages/pandas/core/frame.py", line 4555, in set_index raise KeyError(f"None of {missing} are in the columns") KeyError: "None of ['code'] are in the columns"

感谢您的反馈 如有意见和建议,请在此说明:

您的联系方式(QQ/EMAIL)

THANKS by yutiansut 2017.12

disappearedgod commented 3 years ago

尝试过 Reinstall pytdx 但是还是有问题

Successfully uninstalled pytdx-1.72

NotF404 commented 2 years ago

兄弟你解决了吗

haydengao commented 2 years ago

数据源需要多样化,不能全靠pytdx来解决问题,有些数据tdx有可能并不提供,可使用hqget命令行自行测试数据质量。例如可转债这一块,我是使用爬虫技术自己去有关网站爬取的,封装进QA,作为上层接口调用,目前免费的可以补充的数据源,推荐baostock,akshare。

yutiansut commented 2 years ago

数据源需要多样化,不能全靠pytdx来解决问题,有些数据tdx有可能并不提供,可使用hqget命令行自行测试数据质量。例如可转债这一块,我是使用爬虫技术自己去有关网站爬取的,封装进QA,作为上层接口调用,目前免费的可以补充的数据源,推荐baostock,akshare。

已经加入了 对 rqdata/jqdata的数据支持

James1010422846 commented 2 years ago

余哥,baostock的股票数据确实不错,没问题,可以作为tushare的替代品。但是akshare的问题很多,他是使用跑爬虫从腾讯这些网址爬取,质量很差,然后会有重复出现。