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

[示例] 获取同时属于两个板块的股票 #1015

Open
yutiansut opened this issue Mar 6, 2019 · 1 comment
Open

[示例] 获取同时属于两个板块的股票 #1015

yutiansut opened this issue Mar 6, 2019 · 1 comment

Comments

@yutiansut
Copy link
Owner

同志们写的过于复杂 给出一个示例

import QUANTAXIS as QA
block=QA.QA_fetch_stock_block_adv()
codes=block.data.reset_index().query('blockname == "5G概念" or blockname == "OLED概念"').code
codes[codes.duplicated()]

['002217', '002288', '002384', '002547', '300134', '000063', '000070', '000586', '000636', '000801', '000823', '000836', '000889', '000890', '000938', '000988', '002017', '002023', '002089', '002093', '002104', '002115', '002123', '002148', '002194', '002217', '002229', '002231', '002261', '002268', '002281', '002288', '002313', '002316', '002364', '002369', '002384', '002402', '002446', '002463', '002475', '002491', '002544', '002547', '002725', '002786', '002792', '002796', '002837', '002848', '002860', '002881', '002885', '002886', '002897', '002902', '002912', '002913', '002916', '002927', '002929', '002935', '300025', '300038', '300047', '300050', '300068', '300077', '300081', '300098', '300123', '300134', '300136', '300209', '300250', '300252', '300265', '300288', '300292', '300299', '300308', '300310', '300312', '300319', '300322', '300325', '300328', '300366', '300379', '300394', '300493', '300502', '300504', '300537', '300548', '300560', '300563', '300565', '300570', '300576', '300578', '300590', '300593', '300597', '300602', '300608', '300615', '300635', '300638', '300679', '300684', '300698', '300711', '300731', '300735', '300739', '300747', '600050', '600105', '600198', '600289', '600345', '600485', '600487', '600498', '600522', '600734', '600745', '600770', '600775', '600776', '601068', '601138', '601869', '603042', '603083', '603118', '603186', '603220', '603322', '603559', '603602', '603618', '603703', '603803', '603912']

我们拿一个来验证下

block.get_code('002217').data
		source	type
blockname	code		
黄河三角	002217	tdx	gn
5G概念	002217	tdx	gn
锂电池	002217	tdx	gn
智能穿戴	002217	tdx	gn
OLED概念	002217	tdx	gn
工业互联	002217	tdx	gn
中小板指	002217	tdx	yb
中小300	002217	tdx	yb
黄河三角	002217	tdx	yb
5G概念	002217	tdx	yb
锂电池	002217	tdx	yb
中小板指	002217	tdx	zs
中小300	002217	tdx	zs
中盘成长	002217	tdx	zs
深证300	002217	tdx	zs
深证成长	002217	tdx	zs
国证成长	002217	tdx	zs
信托重仓	002217	tdx	fg
股权转让	002217	tdx	fg
员工持股	002217	tdx	fg
昨日较强	002217	tdx	fg
上周弱势	002217	tdx	fg
无线充电	002217	ths	gn
智能穿戴	002217	ths	gn
山东	002217	ths	dy
光学光电子	002217	ths	thshy
深股通	002217	ths	gn
制造业	002217	ths	zjhhy
@yutiansut yutiansut pinned this issue Aug 26, 2019
@yutiansut yutiansut unpinned this issue Aug 26, 2019
@myuluo
Copy link

myuluo commented May 24, 2021

QUANTAXIS> save financialfiles
Traceback (most recent call last):
File "/opt/conda/bin/quantaxis", line 8, in
sys.exit(QA_cmd())
File "/opt/conda/lib/python3.8/site-packages/QUANTAXIS/QACmd/init.py", line 686, in QA_cmd
cli.cmdloop()
File "/opt/conda/lib/python3.8/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/opt/conda/lib/python3.8/cmd.py", line 217, in onecmd
return func(arg)
File "/opt/conda/lib/python3.8/site-packages/QUANTAXIS/QACmd/init.py", line 552, in do_save
QA_SU_save_financialfiles()
File "/opt/conda/lib/python3.8/site-packages/QUANTAXIS/QASU/main.py", line 619, in QA_SU_save_financialfiles
return save_financialfiles.QA_SU_save_financial_files()
File "/opt/conda/lib/python3.8/site-packages/QUANTAXIS/QASU/save_financialfiles.py", line 45, in QA_SU_save_financial_files
download_financialzip()
File "/opt/conda/lib/python3.8/site-packages/QUANTAXIS/QAFetch/QAfinancial.py", line 94, in download_financialzip
result = get_filename()
File "/opt/conda/lib/python3.8/site-packages/QUANTAXIS/QAFetch/QAfinancial.py", line 83, in get_filename
return [(l[0], l[1]) for l in [line.strip().split(",") for line in requests.get(FINANCIAL_URL).text.strip().split('\n')]]
File "/opt/conda/lib/python3.8/site-packages/QUANTAXIS/QAFetch/QAfinancial.py", line 83, in
return [(l[0], l[1]) for l in [line.strip().split(",") for line in requests.get(FINANCIAL_URL).text.strip().split('\n')]]
IndexError: list index out of range
(base) root@231670ed0574:~/QUANTAXIS/home#

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

2 participants