代码拉取完成,页面将自动刷新
同步操作将从 盘丝/ministock 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
from minifun import *
from pyecharts import options as opts
from pyecharts.charts import Parallel
bankuai_dic = {}
stock_df = get_block_list(bk='BK0448', pz=200)
stock_df['上市日期'] = pd.to_datetime(stock_df['上市日期'], format='%Y%m%d')
stock_df = stock_df[stock_df['上市日期'] < '2021-01-01']
stock_ls = list(stock_df['代码'])
season_pc = []
ns_pc = []
for sc in stock_ls:
sk = get_stock_kline(sc, 'S')
pcls = sk['涨幅'].to_list()
season_pc.append(pcls[-2])
ns_pc.append(pcls[-1])
stock_df['季涨幅'] = season_pc
stock_df['最新季涨幅'] = ns_pc
s_dff = stock_df[['流通市值', '毛利率', 'ROE', '季涨幅', 'pe', '最新季涨幅']]
s_dff = s_dff[s_dff['ROE']!='-']
s_dff = s_dff[s_dff['流通市值'] < 400]
s_dff = s_dff[s_dff['ROE'] > -3]
s_dff = s_dff[s_dff['pe'] > -100]
c1 = s_dff['季涨幅'] >= 10
c2 = s_dff['季涨幅'] >= 0
c3 = s_dff['季涨幅'] < 0
c4 = s_dff['季涨幅'] < -10
s1 = s_dff[c1]
s2 = s_dff[~c1 & c2]
s3 = s_dff[c3 & ~c4]
s4 = s_dff[c4]
data1 = s1.values.tolist()
data2 = s2.values.tolist()
data3 = s3.values.tolist()
data4 = s4.values.tolist()
c = (Parallel(init_opts=opts.InitOpts(height="800px")).add_schema([
opts.ParallelAxisOpts(dim=0, name="流通市值"),
opts.ParallelAxisOpts(dim=1, name="毛利率"),
opts.ParallelAxisOpts(dim=2, name="ROE"),
opts.ParallelAxisOpts(dim=3, name="季涨幅"),
opts.ParallelAxisOpts(dim=4, name="PE"),
opts.ParallelAxisOpts(dim=5, name="最新季涨幅"),
]).add("季涨幅>10", data1, linestyle_opts=opts.LineStyleOpts(width=2, color='rgba(255,0,0,0.7)')).add(
"季涨幅>0", data2, linestyle_opts=opts.LineStyleOpts(width=2, color='rgba(255,255,0,0.7)')).add(
"-季涨幅<0",
data3,
linestyle_opts=opts.LineStyleOpts(width=2, color='rgba(0,0,255,0.7)')).add(
"季涨幅<-10",
data4,
linestyle_opts=opts.LineStyleOpts(
width=2, color='rgba(0,255,0,0.7)')).render("parallel_category.html"))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。