最近5年, 移动183天内按日线线收盘价, 最高/最低 - 1 >= 300%.
2014-05-18到2019-05-17, 正好包含上轮牛市, 不太过时.
183天(以125个交易日近似), 300%参照了近期的龙头股"正邦科技".
大多数人没时间看源码, 所以放在最后面. 鸣谢聚宽客服(微信号jqdata01)约稿, 为JQ打call! 需要转载或者具体数据的, 就加微信号jqdata01.
一共有多少只大牛股, 能涨的如此气壮山河?
牛股家数439, 涨幅中位数399.72%
仔细研究或许有些启发
print(bull_stks.head(40))
代码 名称 起始 终止 涨幅 1 300431.XSHE 暴风集团 2015-03-24 2016-03-29 2262.72 2 603019.XSHG 中科曙光 2014-11-06 2015-05-29 1818.96 3 002625.XSHE 光启技术 2014-05-08 2015-05-13 1759.27 4 002506.XSHE 协鑫集成 2014-01-09 2015-12-28 1553.62 5 300348.XSHE 长亮科技 2014-06-05 2015-06-05 1450.20 6 603169.XSHG 兰石重装 2014-10-10 2015-05-06 1267.48 7 000626.XSHE 远大控股 2014-09-04 2015-05-22 1217.23 8 002044.XSHE 美年健康 2014-06-20 2015-06-11 1148.28 9 300399.XSHE 京天利 2014-10-09 2015-04-17 977.69 10 300666.XSHE 江丰电子 2017-06-15 2017-12-22 975.41 11 002558.XSHE 巨人网络 2014-05-23 2015-12-15 958.57 12 300350.XSHE 华鹏飞 2014-05-20 2015-06-12 957.23 13 300085.XSHE 银之杰 2014-10-10 2015-06-03 955.40 14 300059.XSHE 东方财富 2014-08-14 2015-04-30 951.63 15 300364.XSHE 中文在线 2015-01-22 2015-08-13 943.06 16 300033.XSHE 同花顺 2014-11-05 2015-05-12 927.96 17 300359.XSHE 全通教育 2014-04-29 2015-03-24 907.83 18 300451.XSHE 创业慧康 2015-05-14 2015-11-17 895.21 19 000676.XSHE 智度股份 2014-06-20 2015-11-20 877.29 20 300618.XSHE 寒锐钴业 2017-03-06 2017-09-06 868.04 21 300248.XSHE 新开普 2014-07-28 2015-05-18 844.84 22 601882.XSHG 海天精工 2016-11-07 2017-05-17 839.91 23 300208.XSHE 青岛中程 2014-09-18 2015-05-21 826.80 24 600571.XSHG 信雅达 2014-08-15 2015-06-04 822.25 25 600986.XSHG 科达股份 2014-07-02 2015-06-02 816.47 26 603600.XSHG 永艺股份 2015-01-23 2015-07-29 804.77 27 300469.XSHE 信息发展 2015-06-11 2015-12-16 798.88 28 600701.XSHG *ST工新 2014-05-29 2015-06-10 796.84 29 002751.XSHE 易尚展示 2015-04-24 2015-11-04 795.47 30 600903.XSHG 贵州燃气 2017-11-07 2018-05-23 793.71 31 300496.XSHE 中科创达 2015-12-10 2016-06-16 790.61 32 300676.XSHE 华大基因 2017-07-14 2018-01-29 780.91 33 002785.XSHE 万里石 2015-12-23 2016-06-29 772.12 34 300459.XSHE 金科文化 2015-05-15 2016-03-31 758.39 35 600053.XSHG 九鼎投资 2014-08-28 2015-12-21 745.58 36 601608.XSHG 中信重工 2014-08-11 2015-05-28 741.63 37 300446.XSHE 乐凯新材 2015-04-23 2015-10-28 735.39 38 601299.XSHG 中国北车 2014-07-22 2015-04-17 714.83 39 002517.XSHE 恺英网络 2013-12-31 2015-06-15 712.74 40 603533.XSHG 掌阅科技 2017-09-21 2018-04-03 708.93
这里依旧看到了我们的轻资产券商老朋友: 同花顺, 东方财富, 一对好基友, 排名都这么接近.
print(bull_stks.head(80).tail(40))
代码 名称 起始 终止 涨幅 41 300571.XSHE 平治信息 2016-12-13 2017-06-21 708.51 42 002657.XSHE 中科金财 2014-10-13 2015-05-12 695.52 43 300649.XSHE 杭州园林 2017-05-05 2017-11-14 689.80 44 002027.XSHE 分众传媒 2014-12-30 2015-11-20 688.73 45 002782.XSHE 可立克 2015-12-23 2016-06-29 688.20 46 000796.XSHE 凯撒旅游 2014-04-28 2015-06-11 685.15 47 300380.XSHE 安硕信息 2014-11-05 2015-05-12 673.48 48 600776.XSHG 东方通信 2018-10-17 2019-04-22 669.44 49 300159.XSHE 新研股份 2014-08-11 2015-06-01 663.33 50 601766.XSHG 中国中车 2014-07-22 2015-04-17 656.31 51 300708.XSHE 聚灿光电 2017-10-16 2018-04-19 653.33 52 300063.XSHE 天龙集团 2014-06-19 2015-05-21 652.69 53 000025.XSHE 特力A 2015-07-08 2016-01-19 648.35 54 300725.XSHE 药石科技 2017-11-10 2018-05-25 640.14 55 300491.XSHE 通合科技 2015-12-31 2016-07-07 636.10 56 300484.XSHE 蓝海华腾 2016-03-22 2016-09-21 633.68 57 300506.XSHE 名家汇 2016-03-24 2016-09-23 625.97 58 002777.XSHE 久远银海 2015-12-31 2016-07-21 617.08 59 300603.XSHE 立昂技术 2017-01-26 2017-11-29 614.57 60 601390.XSHG 中国中铁 2014-10-14 2015-04-28 601.62 61 300601.XSHE 康泰生物 2017-02-07 2017-08-08 598.42 62 300675.XSHE 建科院 2017-07-19 2018-01-18 593.71 63 002491.XSHE 通鼎互联 2014-07-24 2015-05-22 589.82 64 002800.XSHE 天顺股份 2016-05-30 2016-12-02 585.35 65 000005.XSHE 世纪星源 2014-07-17 2015-05-29 581.90 66 002771.XSHE 真视通 2015-06-29 2015-12-30 580.35 67 300450.XSHE 先导智能 2015-05-18 2015-11-19 575.00 68 300383.XSHE 光环新网 2015-02-12 2015-12-08 573.68 69 300299.XSHE 富春股份 2014-12-09 2015-11-11 567.62 70 603918.XSHG 金桥信息 2015-05-28 2015-12-01 564.65 71 002175.XSHE *ST东网 2014-11-13 2015-06-03 560.34 72 002631.XSHE 德尔未来 2014-12-09 2015-06-17 556.53 73 300186.XSHE 大华农 2014-07-31 2015-06-02 548.05 74 002622.XSHE 融钰集团 2014-11-18 2015-05-25 547.83 75 300140.XSHE 中环装备 2014-09-02 2015-05-27 547.61 76 002326.XSHE 永太科技 2014-11-11 2015-05-25 545.61 77 300109.XSHE 新开源 2014-06-04 2015-05-12 543.97 78 002636.XSHE 金安国纪 2014-12-12 2015-06-18 538.14 79 300493.XSHE 润欣科技 2015-12-10 2016-06-16 538.14 80 300466.XSHE 赛摩电气 2015-05-28 2016-05-03 537.87
来看看2018年以来有哪些牛股, 后悔药吃饱了再往下看哦
print(bull_stks[bull_stks['起始'].values >= '2018-01-01'])
代码 名称 起始 终止 涨幅 48 600776.XSHG 东方通信 2018-10-17 2019-04-22 669.44 85 002194.XSHE *ST凡谷 2018-10-12 2019-04-17 529.16 95 002157.XSHE 正邦科技 2018-10-19 2019-04-24 517.96 107 000723.XSHE 美锦能源 2018-10-15 2019-04-18 500.30 132 600604.XSHG 市北高新 2018-10-18 2019-04-23 466.13 170 002565.XSHE 顺灏股份 2018-10-15 2019-04-18 437.69 175 600218.XSHG 全柴动力 2018-10-17 2019-04-22 434.74 205 002547.XSHE 春兴精工 2018-10-22 2019-04-25 408.47 212 603383.XSHG 顶点软件 2018-10-11 2019-04-16 406.71 257 600975.XSHG 新五丰 2018-10-19 2019-04-24 380.80 311 002017.XSHE 东信和平 2018-08-20 2019-03-08 349.80 315 002124.XSHE 天邦股份 2018-08-21 2019-03-19 348.81 366 601066.XSHG 中信建投 2018-10-18 2019-04-23 325.35 393 603000.XSHG 人民网 2018-10-16 2019-04-19 318.39 407 002733.XSHE 雄韬股份 2018-10-19 2019-04-24 315.19
接下来就要看K线图了, 还没有行情软件那么方便. 需要逐个手工输入代码和日期, 再运行. 等我有空给大家做个牛股图集吧.
---------------------- 以下是源码 ------------------------
import pandas as pd
from talib import ROC
from datetime import timedelta
from datetime import datetime as dt
N_INCR_DAYS = 125 # 滚动天数, 近似为半年自然日
THRESHOLD_INCR = 300 # 涨幅阈值
start_date = (dt.now() - timedelta(days=round(5.5 * 365))).strftime('%Y-%m-%d')
end_date = dt.now().strftime('%Y-%m-%d')
all_sec = get_all_securities()
print(start_date, end_date, len(all_sec))
bull_stks = []
for stk, stk_name in zip(all_sec.index.values,
all_sec['display_name'].values):
w_k = get_price(stk, start_date=start_date, end_date=end_date,
frequency='1d', fq='pre', fields='close', skip_paused=True)
if len(w_k) < N_INCR_DAYS + 1:
continue
roc = np.round(ROC(w_k['close'].values, N_INCR_DAYS), 2)
if np.nanmax(roc) < THRESHOLD_INCR:
continue
days = [str(d)[:10] for d in w_k.index.values]
loc = np.nanargmax(roc)
bull_stks += [[stk, stk_name, days[loc - N_INCR_DAYS], days[loc], roc[loc]]]
cols = ['代码', '名称', '起始', '终止', '涨幅']
bull_stks = pd.DataFrame(bull_stks, columns=cols)
bull_stks.sort_values(by=['涨幅'], ascending=False, inplace=True)
bull_stks.index.values[:] = np.arange(1, len(bull_stks) + 1)
print('牛股家数{}, 涨幅中位数{}%'.format(len(bull_stks),
np.median(bull_stks['涨幅'].values)))
print(bull_stks)
bull_stks.to_csv('半年3倍牛股名单.csv', float_format='%.2f', encoding='utf-8')
2013-11-16 2019-05-17 3694 牛股家数439, 涨幅中位数399.72% 代码 名称 起始 终止 涨幅 1 300431.XSHE 暴风集团 2015-03-24 2016-03-29 2262.72 2 603019.XSHG 中科曙光 2014-11-06 2015-05-29 1818.96 3 002625.XSHE 光启技术 2014-05-08 2015-05-13 1759.27 4 002506.XSHE 协鑫集成 2014-01-09 2015-12-28 1553.62 5 300348.XSHE 长亮科技 2014-06-05 2015-06-05 1450.20 6 603169.XSHG 兰石重装 2014-10-10 2015-05-06 1267.48 7 000626.XSHE 远大控股 2014-09-04 2015-05-22 1217.23 8 002044.XSHE 美年健康 2014-06-20 2015-06-11 1148.28 9 300399.XSHE 京天利 2014-10-09 2015-04-17 977.69 10 300666.XSHE 江丰电子 2017-06-15 2017-12-22 975.41 11 002558.XSHE 巨人网络 2014-05-23 2015-12-15 958.57 12 300350.XSHE 华鹏飞 2014-05-20 2015-06-12 957.23 13 300085.XSHE 银之杰 2014-10-10 2015-06-03 955.40 14 300059.XSHE 东方财富 2014-08-14 2015-04-30 951.63 15 300364.XSHE 中文在线 2015-01-22 2015-08-13 943.06 16 300033.XSHE 同花顺 2014-11-05 2015-05-12 927.96 17 300359.XSHE 全通教育 2014-04-29 2015-03-24 907.83 18 300451.XSHE 创业慧康 2015-05-14 2015-11-17 895.21 19 000676.XSHE 智度股份 2014-06-20 2015-11-20 877.29 20 300618.XSHE 寒锐钴业 2017-03-06 2017-09-06 868.04 21 300248.XSHE 新开普 2014-07-28 2015-05-18 844.84 22 601882.XSHG 海天精工 2016-11-07 2017-05-17 839.91 23 300208.XSHE 青岛中程 2014-09-18 2015-05-21 826.80 24 600571.XSHG 信雅达 2014-08-15 2015-06-04 822.25 25 600986.XSHG 科达股份 2014-07-02 2015-06-02 816.47 26 603600.XSHG 永艺股份 2015-01-23 2015-07-29 804.77 27 300469.XSHE 信息发展 2015-06-11 2015-12-16 798.88 28 600701.XSHG *ST工新 2014-05-29 2015-06-10 796.84 29 002751.XSHE 易尚展示 2015-04-24 2015-11-04 795.47 30 600903.XSHG 贵州燃气 2017-11-07 2018-05-23 793.71 .. ... ... ... ... ... 410 300031.XSHE 宝通科技 2014-12-15 2015-11-25 313.41 411 600896.XSHG 览海投资 2014-10-23 2015-06-25 312.50 412 000717.XSHE 韶钢松山 2014-11-26 2015-06-02 312.10 413 600240.XSHG *ST华业 2014-08-06 2015-05-25 311.18 414 300023.XSHE 宝德股份 2015-09-15 2016-03-23 310.97 415 002160.XSHE 常铝股份 2014-07-21 2015-06-08 310.58 416 600458.XSHG 时代新材 2014-09-17 2015-06-05 309.81 417 603322.XSHG 超讯通信 2016-07-28 2017-02-07 309.37 418 300378.XSHE 鼎捷软件 2014-11-19 2015-05-26 309.36 419 300609.XSHE 汇纳科技 2017-02-15 2017-08-16 308.49 420 601558.XSHG ST锐电 2014-11-14 2015-06-12 307.06 421 603131.XSHG 上海沪工 2016-06-07 2016-12-12 306.84 422 300222.XSHE 科大智能 2014-09-25 2015-06-04 306.23 423 603318.XSHG 派思股份 2015-04-24 2015-11-03 306.11 424 000034.XSHE 神州数码 2014-12-24 2015-12-23 306.07 425 600570.XSHG 恒生电子 2014-09-10 2015-04-13 305.82 426 300288.XSHE 朗玛信息 2014-04-02 2014-12-25 305.16 427 000516.XSHE 国际医学 2014-10-08 2015-04-23 304.53 428 600556.XSHG ST慧球 2014-02-27 2014-12-29 303.50 429 000058.XSHE 深赛格 2014-12-12 2015-06-18 303.41 430 002915.XSHE 中欣氟材 2017-12-05 2018-06-19 303.25 431 002675.XSHE 东诚药业 2014-05-16 2015-06-04 302.60 432 300657.XSHE 弘信电子 2017-05-23 2018-01-12 302.33 433 002170.XSHE 芭田股份 2014-08-08 2015-05-14 302.11 434 603311.XSHG 金海环境 2015-05-18 2015-11-19 301.18 435 002632.XSHE 道明光学 2014-12-09 2015-06-15 301.16 436 603165.XSHG 荣晟环保 2017-01-17 2017-07-25 301.07 437 002735.XSHE 王子新材 2014-12-03 2015-06-09 300.84 438 300229.XSHE 拓尔思 2014-11-28 2015-06-04 300.34 439 603021.XSHG 山东华鹏 2015-04-23 2015-11-11 300.21 [439 rows x 5 columns]
print(bull_stks[bull_stks['起始'].values >= '2018-01-01'])
代码 名称 起始 终止 涨幅 48 600776.XSHG 东方通信 2018-10-17 2019-04-22 669.44 85 002194.XSHE *ST凡谷 2018-10-12 2019-04-17 529.16 95 002157.XSHE 正邦科技 2018-10-19 2019-04-24 517.96 107 000723.XSHE 美锦能源 2018-10-15 2019-04-18 500.30 132 600604.XSHG 市北高新 2018-10-18 2019-04-23 466.13 170 002565.XSHE 顺灏股份 2018-10-15 2019-04-18 437.69 175 600218.XSHG 全柴动力 2018-10-17 2019-04-22 434.74 205 002547.XSHE 春兴精工 2018-10-22 2019-04-25 408.47 212 603383.XSHG 顶点软件 2018-10-11 2019-04-16 406.71 257 600975.XSHG 新五丰 2018-10-19 2019-04-24 380.80 311 002017.XSHE 东信和平 2018-08-20 2019-03-08 349.80 315 002124.XSHE 天邦股份 2018-08-21 2019-03-19 348.81 366 601066.XSHG 中信建投 2018-10-18 2019-04-23 325.35 393 603000.XSHG 人民网 2018-10-16 2019-04-19 318.39 407 002733.XSHE 雄韬股份 2018-10-19 2019-04-24 315.19
# 下面画图代码来自社区帖子
# https://www.joinquant.com/view/community/detail/81d0e041f08b5e0a61172d6267f9f342?type=1
#pyecharts文档请见http://pyecharts.org
from pyecharts import Kline, online,Overlap,Scatter,Style,Line,Grid,Bar
import talib
stk_code = '600975.XSHG' # 深圳后缀改为.XSHE
start_date = '2018-10-19'
end_date = '2019-04-24'
class Kshow:
def __init__(self,stock_name,jsPath='https://cdn.bootcss.com/echarts/4.1.0.rc2'):
#使用最新的echarts js文件
online(jsPath)
#K线
self.kline=Kline(stock_name)
#macd line,即dif、dea
self.macd_line=Line('')
self.macd_bar=Bar('')
def chart_init(self,data_df,show_BI=True,show_Line=True,show_Center=True):
#获取K线数据
def get_K_data(df):
kdata=df.loc[:,['open','close','low','high']].to_dict('split')['data']
xaxis=[str(d)[:10] for d in df.index.values]
return xaxis,kdata
#获取MACD数据
def get_macd_data(df):
dif=[l[1] for l in df.dif.iteritems()]
dea=[l[1] for l in df.dea.iteritems()]
macd_z=[l for l in df[df.macd>=0].macd.iteritems()]
macd_f=[l for l in df[df.macd<0].macd.iteritems()]
return dif,dea,macd_z,macd_f
kx,ky=get_K_data(data_df)
#添加K线,is_datazoom_show显示时间轴,datazoom_range时间轴范围
self.kline.add('K',kx,ky,is_datazoom_show=True,datazoom_range=[80,100])
#修改K线颜色
self.kline._option['series'][0]['itemStyle']={'normal':{'color':'#ef232a', 'color0': '#14b143','borderColor': '#ef232a', 'borderColor0': '#14b143'}}
dif,dea,macd_z,macd_f=get_macd_data(data_df)
self.macd_bar.add('macd_z',[t for t,v in macd_z],macd_z,is_datazoom_show=True)
self.macd_bar.add('macd_f',[t for t,v in macd_f],macd_f,is_datazoom_show=True)
self.macd_line.add('dif',kx,dif,is_datazoom_show=True, xaxis_type='category',line_width =1,
is_symbol_show=False,is_fill=False)
self.macd_line.add('dea',kx,dea,is_datazoom_show=True, xaxis_type='category',line_width =1,
is_symbol_show=False,is_fill=False)
#这个应该是目前版本pyechart的bug,导致区域填充,删除后只显示线
del chart.macd_line._option['series'][0]['areaStyle']
del chart.macd_line._option['series'][1]['areaStyle']
#主图
def get_main_chart(self,height=600,width=1000):
overlap = Overlap(height=height,width=height)
overlap.add(self.kline)
return overlap
#辅图
def get_macd_chart(self,height=200,width=1000):
overlap = Overlap(height=height,width=height)
overlap.add(self.macd_line)
overlap.add(self.macd_bar)
return overlap
#获取图,并显示
def show_chart(self,zoom_start=50,height=600,width=1000):
grid = Grid(height=height,width =width)
main_ov=self.get_main_chart(height-200,width)
macd_ov=self.get_macd_chart(200,width)
grid.add(main_ov,grid_top=0,grid_bottom=220)
grid.add(macd_ov,grid_top=height-200)
grid._option['dataZoom'][0]['xAxisIndex']=[0, 1]
grid._option['dataZoom'][0]['start']=zoom_start
grid._option['xAxis'][1]['show']=False
grid._option['legend'][1]['show']=False
grid._option['color']=['#145b7d','#e0861a','#ef232a','#14b143'] #DIF,DEA,MACD正,MACD负
return grid
# 股票代码
stock= stk_code
#名称
stock_name=get_security_info(stock).display_name
#获取dataframe
df=get_price(stock, start_date=start_date, end_date=end_date,
fields=['open','close','high','low'], frequency='1d')
#计算macd
df['dif'],df['dea'],df['macd']=talib.MACD(df.close.values,
fastperiod=12 ,
slowperiod=26,
signalperiod=9 )
#macd最开始一段数据不准,移除
# df=df.iloc[100:,:]
#初始化画图函数
chart=Kshow(stock[:6]+' '+stock_name)
#初始化数据
chart.chart_init(df)
#显示图表
chart.show_chart(height=600,width=1000)
本社区仅针对特定人员开放
查看需注册登录并通过风险意识测评
5秒后跳转登录页面...
移动端课程