聚宽量化交易平台
jqdatasdk
pip install jqdatasdk
pip install -U jqdatasdk
from jqdatasdk import *
auth('帐号','密码')
is_auth()
get_query_count()
get_all_securities(types=[],date=None)
get_security_info(code,date=None)
get_index_stocks(index_symbol,date=None)
get_index_weights(index_id,date=None)
例子:绘制沪深300指数十大重仓股柱状图
df=get_index_weights('000300.XSHG')
df=df.sort_values('weight',ascending=False).iloc[:10,:]
from pyecharts import options as opts
from pyecharts.charts import Bar
c=Bar()
c.add_xaxis(list(df.loc[:,'display_name']))
c.add_yaxis('权重',list(df.loc[:,'weight']))
c.render_notebook()