同花顺Supermind量化交易 技术面分析专题(一)-- 相似k线的形态验证与选股

形态验证并选股-“相似K线”的技术应用:

“W底”,“多头上涨”,“趋势回踩”,”上涨中继“这些都是常见的K线形态,以”上涨中继“为例,当股价快速上涨后,出现盘整形态而非顶部形态,预示股价还会进一步上涨,那么本节主要讲述”上涨中继”形态是否能够预测未来股价上涨,以及如何应用“上涨中继”形态,来快速选股。 

第一步:选取一段标准的“上涨中继”形态K线图
 


 

第二步:形态验证,在历史行情中寻找相似度高达0.8的K线图,并计算后5日、20日、60日的收益率。分析: 1.历史4年中“上涨中继”形态发生后,后5日上涨概率仅为30%,后20上涨概率也仅为50%,但后60日上涨概率高达70% 2.形态发生后,5日收益率均值为-2.45%,20日收益率均值仅为0.97%,但后60日收益率均值高达15.60% 并初步得出结论: 上涨中继形态发生后,技术分析者应该尽量选择低位介入,并且持有一段时间,而不是早早离场。 


 


 


 

第三步:形态选股应用,我们认为“上涨中继”是一个较优质的中线买入机会,我们对全市场个股进行“上涨中继”形态选股,寻找出相似度最高的股票:ST天业,相似度为0.895,K线形态符合“上涨中继”,如下: 

结束语:


"相似K线"技术相比于传统的K线组合而言更具技术性,其还有较多的运用空间,比如:运用顶部形态来监控个股潜在的下跌风险,运用相似度来监控个股是否脱离大盘走势,研究各类形态的上涨预测能力,并应用于选股等等。 注意:文中对股价的预测来源于模型运算结果,不构成投资建议!

参考文献:

-日本蜡烛图技术 [美] 史蒂夫·尼森

点击获取内容完整源码(仅支持PC):

点击→机器学习

微信扫码,在线阅读~:

形态验证:快速上涨后,出现盘整形态,后续上涨的可能性多大?

data = get_price('603383.SH',None,'20190114','1d',['open','high','low','close'],bar_count=60,is_panel =1)

startdate ='20181019'
enddate ='20190114'

import numpy as np
import matplotlib.pyplot as plt 
from matplotlib.finance import candlestick2_ohlc
import datetime

close1 = data['close']
open1 = data['open']
high1 = data['high']
low1 = data['low']

#画图
fig,ax = plt.subplots(figsize = (10,6.18),facecolor='white')
fig.subplots_adjust() 

ticks = ax.set_xticks([0,60])
labels = ax.set_xticklabels([startdate,enddate], fontsize=10) 


plt.yticks()  
plt.title("{} K线走势图".format('上涨中继'),fontsize = 15)  
plt.ylabel("股价",fontsize = 15)  
candlestick2_ohlc(ax,open1,high1,low1,close1,width=0.6,colorup='red',colordown='green')
(<matplotlib.collections.LineCollection at 0x7f8b266317f0>,
 <matplotlib.collections.PolyCollection at 0x7f8b26983da0>)

data = get_price('603383.SH','20181019','20190211','1d',['open','high','low','close'],is_panel =1)

startdate ='20181019'
enddate ='20190211'

import numpy as np
import matplotlib.pyplot as plt 
from matplotlib.finance import candlestick2_ohlc
import datetime

close1 = data['close']
open1 = data['open']
high1 = data['high']
low1 = data['low']

#画图
fig,ax = plt.subplots(figsize = (10,6.18),facecolor='white')
fig.subplots_adjust() 

ticks = ax.set_xticks([0,60])
labels = ax.set_xticklabels([startdate,enddate], fontsize=10) 

#支撑线
plt.plot([60,60],[np.min(low1),np.max(high1)],'gold',linewidth=3)

plt.yticks()  
plt.title("{}形态发生后,理想中的后续走势".format('上涨中继'),fontsize = 15)  
plt.ylabel("股价",fontsize = 15)  
candlestick2_ohlc(ax,open1,high1,low1,close1,width=0.6,colorup='red',colordown='green')
(<matplotlib.collections.LineCollection at 0x7f8b25d5b978>,
 <matplotlib.collections.PolyCollection at 0x7f8b25d5b780>)

data = get_price('603383.SH',None,'20190114','1d',['open','high','low','close'],bar_count=60,is_panel =1)

close1 = data['close']
open1 = data['open']
high1 = data['high']
low1 = data['low']


indexcode = '000300.SH'
startdate = '20140101'
enddate = '20190201'
stocklist = get_index_stocks(indexcode,enddate)
data = get_price(stocklist,startdate,enddate,'1d',['open','high','low','close'],is_panel =1)
#收盘价
closedf = data['close'].fillna(0)
opendf = data['open'].fillna(0)
highdf = data['high'].fillna(0)
lowdf = data['low'].fillna(0)


dt = pd.DataFrame(columns=['stock','startdate','enddate','T'])

trade = list(closedf.index.strftime('%Y%m%d'))
num = trade.index(enddate)
stocklist = list(closedf.columns)
y=0
import datetime
for d in list(range(60,num-20,20)):
    print(d,num)
    close2 = closedf.iloc[d-59:d+1]
    opens2 = opendf.iloc[d-59:d+1]
    high2 = highdf.iloc[d-59:d+1]
    low2 = lowdf.iloc[d-59:d+1]

    for s in stocklist:
        corropen = round(np.corrcoef(open1,opens2[s])[0][1],3)
        corrhigh = round(np.corrcoef(high1,high2[s])[0][1],3)
        corrlow = round(np.corrcoef(low1,low2[s])[0][1],3)
        corrclose = round(np.corrcoef(close1,close2[s])[0][1],3)

        #综合值
        T = (corropen+corrhigh+corrlow+corrclose)/4
        startdate = trade[d-59]
        enddate = trade[d+1]
        dt.loc[y] = [s,startdate,enddate,T]
        y+=1
        
dt = dt.fillna(0)
dt = dt.sort_values(by='T',ascending=False)
dt
60 1242
80 1242
100 1242
120 1242
140 1242
160 1242
180 1242
200 1242
220 1242
240 1242
260 1242
280 1242
300 1242
320 1242
340 1242
360 1242
380 1242
400 1242
420 1242
440 1242
460 1242
480 1242
500 1242
520 1242
540 1242
560 1242
580 1242
600 1242
620 1242
640 1242
660 1242
680 1242
700 1242
720 1242
740 1242
760 1242
780 1242
800 1242
820 1242
840 1242
860 1242
880 1242
900 1242
920 1242
940 1242
960 1242
980 1242
1000 1242
1020 1242
1040 1242
1060 1242
1080 1242
1100 1242
1120 1242
1140 1242
1160 1242
1180 1242
1200 1242
1220 1242

Out[29]:

stockstartdateenddateT
2046601328.SH20140703201409260.92825
2066601788.SH20140703201409260.92750
14425000703.SZ20171208201803120.92525
13279002460.SZ20170811201711100.92400
1859002142.SZ20140703201409260.92225
3194600637.SH20141031201501270.91750
1916600000.SH20140703201409260.91350
9898603986.SH20160816201611170.91200
4871002310.SZ20150429201507240.91000
4977600482.SH20150429201507240.90850
9533601166.SH20160719201610200.90450
11941601228.SH20170317201706160.90325
14971601838.SH20180108201804110.90300
5383601985.SH20150528201508210.90200
1921600015.SH20140703201409260.90075
6901000002.SZ20151124201602240.90000
12625000703.SZ20170616201709080.89900
14093603260.SH20171013201801080.89825
5310600886.SH20150528201508210.89750
3776600438.SH20141226201503310.89675
1803000069.SZ20140703201409260.89625
2079601901.SH20140703201409260.89575
2022601009.SH20140703201409260.89500
11382601939.SH20170113201704180.89475
2082601939.SH20140703201409260.89475
2089601998.SH20140703201409260.89350
2453002044.SZ20140828201411280.89300
1932600036.SH20140703201409260.89125
240601225.SH20140103201404040.89075
9416600000.SH20160719201610200.88725
...............
10657600233.SH2016111720170217-0.86350
16076600438.SH2018051120180806-0.86425
5164002230.SZ2015052820150821-0.86425
2738000895.SZ2014092620141226-0.86475
7396600674.SH2015122220160323-0.86825
11925601021.SH2017031720170616-0.86825
14339601216.SH2017111020180205-0.86850
10763601688.SH2016111720170217-0.86875
11936601198.SH2017031720170616-0.86900
14379601901.SH2017111020180205-0.86900
14863600339.SH2018010820180411-0.87000
9747600153.SH2016081620161117-0.87000
365002236.SZ2014020720140507-0.87075
15448600157.SH2018031220180608-0.87100
12086002558.SZ2017041820170714-0.87575
12015000503.SZ2017041820170714-0.87675
15385002555.SZ2018031220180608-0.87825
10725601021.SH2016111720170217-0.87975
14711000413.SZ2018010820180411-0.88000
16123601012.SH2018051120180806-0.88050
16553002044.SZ2018070920181009-0.88150
16244000983.SZ2018060820180903-0.88225
15977002450.SZ2018051120180806-0.88375
16209000402.SZ2018060820180903-0.88650
15993002673.SZ2018051120180806-0.89125
3392002625.SZ2014112820150303-0.89250
209600867.SH2014010320140404-0.90050
10890002602.SZ2016121520170317-0.90350
12097002797.SZ2017041820170714-0.91150
8847600153.SH2016052020160816-0.91225

17700 rows × 4 columns

In [30]:

for s in [0,-1]:
    stock = dt.iloc[s].stock
    startdate = dt.iloc[s].startdate
    enddate = dt.iloc[s].enddate

    import numpy as np
    import matplotlib.pyplot as plt 
    from matplotlib.finance import candlestick2_ohlc
    import datetime
    s = stock

    trade = list(closedf.index.strftime('%Y%m%d'))
    num = trade.index(enddate)
    close1 = closedf[s].iloc[num-59:num+21]
    open1 = opendf[s].iloc[num-59:num+21]
    high1 = highdf[s].iloc[num-59:num+21]
    low1 = lowdf[s].iloc[num-59:num+21]

    #画图
    fig,ax = plt.subplots(figsize = (10,6.18),facecolor='white')
    fig.subplots_adjust() 
    #支撑线
    plt.plot([60,60],[np.min(low1),np.max(high1)],'gold',linewidth=3)
    ticks = ax.set_xticks([0,60])
    labels = ax.set_xticklabels([startdate,enddate], fontsize=10) 

    plt.yticks()  
    plt.title("{} K线走势图".format(s),fontsize = 15)  
    plt.ylabel("股价",fontsize = 15)  
    candlestick2_ohlc(ax,open1,high1,low1,close1,width=0.6,colorup='red',colordown='green')

highdt = dt[dt['T']>0.8]
highdt['code'] = highdt.index
highdt['buyprice'] = highdt['code'].apply(lambda x:closedf[list(highdt['stock'])[list(highdt['code']).index(x)]].iloc[list(highdt['code']).index(x)])
highdt = highdt[highdt['buyprice']!=0]
highdt['5day'] = highdt['code'].apply(lambda x:closedf[list(highdt['stock'])[list(highdt['code']).index(x)]].iloc[list(highdt['code']).index(x)+5])
highdt['20day'] = highdt['code'].apply(lambda x:closedf[list(highdt['stock'])[list(highdt['code']).index(x)]].iloc[list(highdt['code']).index(x)+20])
highdt['60day'] = highdt['code'].apply(lambda x:closedf[list(highdt['stock'])[list(highdt['code']).index(x)]].iloc[list(highdt['code']).index(x)+60])
highdt['5day']=highdt['5day']/highdt['buyprice']-1
highdt['20day']=highdt['20day']/highdt['buyprice']-1
highdt['60day']=highdt['60day']/highdt['buyprice']-1
highdt
stockstartdateenddateTcodebuyprice5day20day60day
2046601328.SH20140703201409260.9282520462.46-0.012195-0.016260-0.032520
2066601788.SH20140703201409260.9275020667.42-0.084906-0.060647-0.080863
14425000703.SZ20171208201803120.92525144254.88-0.096311-0.008197-0.026639
13279002460.SZ20170811201711100.92400132793.46-0.0317920.3092490.462428
1859002142.SZ20140703201409260.9222518594.32-0.064815-0.004630-0.002315
3194600637.SH20141031201501270.91750319431.28-0.026535-0.039003-0.158568
1916600000.SH20140703201409260.9135019164.98-0.0421690.0240960.098394
4871002310.SZ20150429201507240.9100048717.44-0.0268820.056452-0.134409
4977600482.SH20150429201507240.9085049778.69-0.0023010.1461450.215190
9533601166.SH20160719201610200.9045095336.610.0075640.0393340.077156
1921600015.SH20140703201409260.9007519214.46-0.0201790.0067260.044843
6901000002.SZ20151124201602240.9000069014.170.071942-0.0791370.040767
12625000703.SZ20170616201709080.89900126254.910.0081470.032587-0.075356
5310600886.SH20150528201508210.8975053102.980.0000000.0100670.204698
3776600438.SH20141226201503310.8967537763.940.0000000.0431470.025381
1803000069.SZ20140703201409260.8962518034.290.000000-0.116550-0.053613
2079601901.SH20140703201409260.8957520795.570.0000000.007181-0.016158
2022601009.SH20140703201409260.8950020222.090.0000000.000000-0.038278
11382601939.SH20170113201704180.89475113822.560.000000-0.062500-0.015625
2082601939.SH20140703201409260.8947520822.540.000000-0.059055-0.011811
2089601998.SH20140703201409260.8935020894.020.000000-0.024876-0.069652
2453002044.SZ20140828201411280.8930024532.270.000000-0.057269-0.136564
1932600036.SH20140703201409260.8912519326.950.000000-0.149640-0.089209
240601225.SH20140103201404040.890752404.270.000000-0.182670-0.206089
9416600000.SH20160719201610200.8872594165.030.000000-0.1292250.061630
4780601919.SH20150331201506260.8872547803.380.0000000.000000-0.076923
2474002411.SZ20140828201411280.88700247410.030.000000-0.103689-0.325025
1986600547.SH20140703201409260.88675198616.100.0000000.140373-0.037888
1842000961.SZ20140703201409260.8857518422.570.0000000.0544750.058366
9561601668.SH20160719201610200.8852595611.330.000000-0.0225560.067669
..............................
4205000157.SZ20150303201505280.8052542055.520.018116-0.0036230.369565
12840601225.SH20170616201709080.80475128405.340.1310860.0112360.625468
14872600398.SH20180108201804110.804501487210.450.0239230.0354070.408612
3786600547.SH20141226201503310.80425378624.610.089395-0.0422590.225518
9564601727.SH20160719201610200.8042595649.960.134538-0.0220880.867470
1837000876.SZ20140703201409260.8042518376.92-0.049133-0.0130060.575145
9917000553.SZ20160913201612150.80425991714.45-0.010381-0.0055360.074048
14583600519.SH20171208201803120.8042514583142.24-0.056384-0.0079440.400028
11170002304.SZ20170113201704180.804001117046.800.0649570.0104700.259829
12889601998.SH20170616201709080.80400128895.890.023769-0.0033960.234295
9509600867.SH20160719201610200.8037595099.63-0.164071-0.0467290.470405
7875002415.SZ20160224201605200.80375787511.21-0.068689-0.0338980.134701
9016000538.SZ20160621201609130.80375901659.77-0.0416600.0107080.061904
8415000503.SZ20160421201607190.80375841540.70-0.057740-0.0049140.094595
6401300017.SZ20150922201512220.80350640112.25-0.166531-0.0253060.462041
14115000503.SZ20171110201802050.803501411543.64-0.121448-0.0604950.112511
11144000983.SZ20170113201704180.80350111448.07-0.078067-0.0061960.080545
12722600016.SH20170616201709080.80325127227.33-0.042292-0.0204640.099591
3310000408.SZ20141128201503030.80275331013.40-0.1402990.0074630.567164
12791600585.SH20170616201709080.802751279118.66-0.051447-0.0042870.087889
13280002466.SZ20170811201711100.802501328013.350.0681650.0037450.240449
3567601800.SH20141128201503030.80250356714.60-0.121918-0.0020550.276712
2784002508.SZ20140926201412260.80250278413.53-0.0739100.0036950.481153
9513600900.SH20160719201610200.8020095138.68-0.101382-0.0023040.267281
4762601669.SH20150331201506260.8017547628.83-0.163080-0.0464330.921857
852601398.SH20140307201406050.801508523.96-0.146465-0.0530300.131313
9587601992.SH20160719201610200.8012595875.45-0.1834860.0201830.170642
9360002146.SZ20160719201610200.80025936010.29-0.376093-0.081633-0.124393
6408300124.SZ20150922201512220.80025640820.78-0.162175-0.0269490.446583
13613300296.SZ20170908201712080.80025136135.59-0.273703-0.0518780.329159

284 rows × 9 columns

highdt.describe()

 

Out[32]:

Tcodebuyprice5day20day60day
count284.000000284.000000284.000000284.000000284.000000284.000000
mean0.8391516365.90493010.044085-0.0259430.0080550.157349
std0.0308464523.93330814.0910660.0865130.0630170.220266
min0.8002504.0000001.330000-0.507956-0.186047-0.325025
25%0.8146252054.7500004.057500-0.050792-0.0226190.000000
50%0.8306254756.0000006.615000-0.0087530.0022130.118084
75%0.8569389569.75000011.1800000.0075720.0346610.262899
max0.92825017491.000000142.2400000.2890930.3148851.057554

In [33]:

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 1, 0.618]) #插入面板2
x1_list = list(highdt['5day'])
y=np.array(x1_list)
x=np.array(range(0,len(x1_list)))
axes.plot(x, y, 'r')
axes.set_xlabel('相似度递减',fontsize=15)
axes.set_ylabel('收益率',fontsize=15)
axes.set_title('上涨中继买入后五日收益率',fontsize=15)
<matplotlib.text.Text at 0x7f8b26065f60>

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 1, 0.618]) #插入面板2
x1_list = list(highdt['20day'])
y=np.array(x1_list)
x=np.array(range(0,len(x1_list)))
axes.plot(x, y, 'r')
axes.set_xlabel('相似度递减',fontsize=15)
axes.set_ylabel('收益率',fontsize=15)
axes.set_title('上涨中继买入后二十日收益率',fontsize=15)
<matplotlib.text.Text at 0x7f8b273dcc18>

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 1, 0.618]) #插入面板2
x1_list = list(highdt['60day'])
y=np.array(x1_list)
x=np.array(range(0,len(x1_list)))
axes.plot(x, y, 'r')
axes.set_xlabel('相似度递减',fontsize=15)
axes.set_ylabel('收益率',fontsize=15)
axes.set_title('上涨中继买入后六十日收益率',fontsize=15)
<matplotlib.text.Text at 0x7f8b25cb0748>

形态选股应用

以上涨中继作为筛选形态,从历史行情中挑出一段行情。

data = get_price('603383.SH',None,'20190114','1d',['open','high','low','close'],bar_count=60,is_panel =1)

startdate ='20181019'
enddate ='20190114'

import numpy as np
import matplotlib.pyplot as plt 
from matplotlib.finance import candlestick2_ohlc
import datetime

close1 = data['close']
open1 = data['open']
high1 = data['high']
low1 = data['low']

#画图
fig,ax = plt.subplots(figsize = (10,6.18),facecolor='white')
fig.subplots_adjust() 

ticks = ax.set_xticks([0,60])
labels = ax.set_xticklabels([startdate,enddate], fontsize=10) 


plt.yticks()  
plt.title("{} K线走势图".format('趋势上涨'),fontsize = 15)  
plt.ylabel("股价",fontsize = 15)  
candlestick2_ohlc(ax,open1,high1,low1,close1,width=0.6,colorup='red',colordown='green')
(<matplotlib.collections.LineCollection at 0x7f8b273c4a90>,
 <matplotlib.collections.PolyCollection at 0x7f8b273c4e80>)

全市场中寻找目前趋势上涨的股票

date = '20190211'
stocklist = list(get_all_securities('stock',date).index)
stocklist
['300056.SZ',
 '300674.SZ',
 '300108.SZ',
 '300357.SZ',
 '600841.SH',
 '600495.SH',
 '300249.SZ',
 '002852.SZ',
 '000058.SZ',
 '002568.SZ',
 '300199.SZ',
 '300490.SZ',
 '000893.SZ',
 '603859.SH',
 '600565.SH',
 '603063.SH',
 '600117.SH',
 '300036.SZ',
 '300746.SZ',
 '002906.SZ',
 '600052.SH',
 '002187.SZ',
 '300613.SZ',
 '000596.SZ',
 '002351.SZ',
 '000736.SZ',
 '000810.SZ',
 '002767.SZ',
 '601318.SH',
 '300183.SZ',
 '002755.SZ',
 '002502.SZ',
 '603722.SH',
 '002298.SZ',
 '300711.SZ',
 '300678.SZ',
 '600362.SH',
 '002176.SZ',
 '600887.SH',
 '300430.SZ',
 '300712.SZ',
 '300291.SZ',
 '300486.SZ',
 '600876.SH',
 '601988.SH',
 '601100.SH',
 '603688.SH',
 '600078.SH',
 '603958.SH',
 '000811.SZ',
 '000537.SZ',
 '300260.SZ',
 '002434.SZ',
 '000541.SZ',
 '002673.SZ',
 '600804.SH',
 '603268.SH',
 '300567.SZ',
 '600038.SH',
 '300382.SZ',
 '600370.SH',
 '000150.SZ',
 '600158.SH',
 '000888.SZ',
 '603458.SH',
 '300723.SZ',
 '300670.SZ',
 '600100.SH',
 '600678.SH',
 '603566.SH',
 '600237.SH',
 '002166.SZ',
 '002073.SZ',
 '300071.SZ',
 '601666.SH',
 '600422.SH',
 '002642.SZ',
 '000027.SZ',
 '002537.SZ',
 '000631.SZ',
 '002457.SZ',
 '603359.SH',
 '600189.SH',
 '600592.SH',
 '600290.SH',
 '603988.SH',
 '002857.SZ',
 '300105.SZ',
 '603321.SH',
 '601398.SH',
 '600755.SH',
 '002480.SZ',
 '600919.SH',
 '300690.SZ',
 '603133.SH',
 '300328.SZ',
 '300759.SZ',
 '603979.SH',
 '002055.SZ',
 '002741.SZ',
 '300391.SZ',
 '600211.SH',
 '002278.SZ',
 '000639.SZ',
 '300273.SZ',
 '300543.SZ',
 '000823.SZ',
 '300521.SZ',
 '000762.SZ',
 '002493.SZ',
 '000597.SZ',
 '600765.SH',
 '000826.SZ',
 '300680.SZ',
 '300341.SZ',
 '002628.SZ',
 '603611.SH',
 '000573.SZ',
 '000766.SZ',
 '001979.SZ',
 '600620.SH',
 '300575.SZ',
 '000726.SZ',
 '002920.SZ',
 '002081.SZ',
 '002797.SZ',
 '002383.SZ',
 '300471.SZ',
 '600011.SH',
 '600151.SH',
 '300628.SZ',
 '600007.SH',
 '300488.SZ',
 '300539.SZ',
 '000831.SZ',
 '000539.SZ',
 '300538.SZ',
 '600814.SH',
 '000889.SZ',
 '002839.SZ',
 '600926.SH',
 '600805.SH',
 '002155.SZ',
 '002319.SZ',
 '600562.SH',
 '000652.SZ',
 '000603.SZ',
 '600313.SH',
 '002131.SZ',
 '000812.SZ',
 '300332.SZ',
 '600775.SH',
 '603886.SH',
 '000963.SZ',
 '300535.SZ',
 '000656.SZ',
 '002261.SZ',
 '603029.SH',
 '300369.SZ',
 '600326.SH',
 '600811.SH',
 '300451.SZ',
 '600488.SH',
 '600392.SH',
 '603966.SH',
 '600597.SH',
 '002651.SZ',
 '002733.SZ',
 '600509.SH',
 '600477.SH',
 '300485.SZ',
 '600978.SH',
 '603712.SH',
 '601179.SH',
 '600055.SH',
 '002903.SZ',
 '000968.SZ',
 '002526.SZ',
 '000088.SZ',
 '603260.SH',
 '000690.SZ',
 '600185.SH',
 '002392.SZ',
 '600398.SH',
 '300444.SZ',
 '002865.SZ',
 '002897.SZ',
 '002057.SZ',
 '603678.SH',
 '002510.SZ',
 '600409.SH',
 '002484.SZ',
 '300065.SZ',
 '002943.SZ',
 '002276.SZ',
 '000510.SZ',
 '300431.SZ',
 '300097.SZ',
 '600022.SH',
 '600171.SH',
 '000014.SZ',
 '300124.SZ',
 '300651.SZ',
 '600983.SH',
 '002915.SZ',
 '600010.SH',
 '000683.SZ',
 '600621.SH',
 '002476.SZ',
 '300368.SZ',
 '300525.SZ',
 '300394.SZ',
 '300453.SZ',
 '000955.SZ',
 '300003.SZ',
 '600777.SH',
 '002144.SZ',
 '002584.SZ',
 '002592.SZ',
 '600220.SH',
 '600221.SH',
 '603716.SH',
 '300658.SZ',
 '600622.SH',
 '002832.SZ',
 '603603.SH',
 '002381.SZ',
 '300195.SZ',
 '000806.SZ',
 '002451.SZ',
 '300224.SZ',
 '600088.SH',
 '002418.SZ',
 '300347.SZ',
 '603733.SH',
 '600153.SH',
 '603679.SH',
 '601800.SH',
 '601108.SH',
 '002743.SZ',
 '600982.SH',
 '300320.SZ',
 '000922.SZ',
 '603648.SH',
 '300045.SZ',
 '600187.SH',
 '600594.SH',
 '300634.SZ',
 '600673.SH',
 '000096.SZ',
 '600306.SH',
 '600651.SH',
 '002577.SZ',
 '601010.SH',
 '600103.SH',
 '002204.SZ',
 '603311.SH',
 '600846.SH',
 '000760.SZ',
 '002033.SZ',
 '603585.SH',
 '600396.SH',
 '002438.SZ',
 '002564.SZ',
 '000543.SZ',
 '601311.SH',
 '603689.SH',
 '000782.SZ',
 '300725.SZ',
 '002727.SZ',
 '603685.SH',
 '600094.SH',
 '600609.SH',
 '300365.SZ',
 '002691.SZ',
 '600785.SH',
 '002037.SZ',
 '601966.SH',
 '300591.SZ',
 '000902.SZ',
 '600888.SH',
 '603036.SH',
 '603916.SH',
 '002668.SZ',
 '600405.SH',
 '603839.SH',
 '300167.SZ',
 '002294.SZ',
 '600209.SH',
 '000589.SZ',
 '603986.SH',
 '000925.SZ',
 '002390.SZ',
 '600826.SH',
 '000068.SZ',
 '000680.SZ',
 '300139.SZ',
 '603383.SH',
 '603887.SH',
 '000973.SZ',
 '002137.SZ',
 '300505.SZ',
 '002788.SZ',
 '300026.SZ',
 '000055.SZ',
 '002787.SZ',
 '000004.SZ',
 '600360.SH',
 '600480.SH',
 '000558.SZ',
 '300545.SZ',
 '300305.SZ',
 '600059.SH',
 '603520.SH',
 '002397.SZ',
 '300307.SZ',
 '300620.SZ',
 '002314.SZ',
 '000403.SZ',
 '600086.SH',
 '000070.SZ',
 '002009.SZ',
 '002302.SZ',
 '300705.SZ',
 '600583.SH',
 '300572.SZ',
 '000868.SZ',
 '603701.SH',
 '002032.SZ',
 '603056.SH',
 '600499.SH',
 '600936.SH',
 '603612.SH',
 '000605.SZ',
 '300103.SZ',
 '300663.SZ',
 '000807.SZ',
 '300581.SZ',
 '300450.SZ',
 '603059.SH',
 '600764.SH',
 '600395.SH',
 '601952.SH',
 '600272.SH',
 '002761.SZ',
 '000969.SZ',
 '002201.SZ',
 '300091.SZ',
 '002689.SZ',
 '300079.SZ',
 '300161.SZ',
 '600280.SH',
 '300321.SZ',
 '600579.SH',
 '300423.SZ',
 '603917.SH',
 '000533.SZ',
 '300151.SZ',
 '002747.SZ',
 '603037.SH',
 '002181.SZ',
 '002461.SZ',
 '002305.SZ',
 '002112.SZ',
 '600338.SH',
 '600839.SH',
 '300514.SZ',
 '600248.SH',
 '002309.SZ',
 '603897.SH',
 '300568.SZ',
 '603829.SH',
 '601633.SH',
 '600714.SH',
 '300311.SZ',
 '600724.SH',
 '300532.SZ',
 '600284.SH',
 '601838.SH',
 '000521.SZ',
 '300114.SZ',
 '603589.SH',
 '002329.SZ',
 '002024.SZ',
 '600779.SH',
 '603718.SH',
 '300573.SZ',
 '002663.SZ',
 '000069.SZ',
 '002817.SZ',
 '300698.SZ',
 '603668.SH',
 '000937.SZ',
 '603908.SH',
 '002156.SZ',
 '000531.SZ',
 '601668.SH',
 '600292.SH',
 '002725.SZ',
 '603500.SH',
 '000528.SZ',
 '002026.SZ',
 '002648.SZ',
 '601038.SH',
 '000629.SZ',
 '000777.SZ',
 '000692.SZ',
 '000566.SZ',
 '603111.SH',
 '002653.SZ',
 '000548.SZ',
 '300659.SZ',
 '600063.SH',
 '600066.SH',
 '300482.SZ',
 '002866.SZ',
 '300176.SZ',
 '300403.SZ',
 '002530.SZ',
 '600702.SH',
 '600985.SH',
 '000861.SZ',
 '600416.SH',
 '002268.SZ',
 '300326.SZ',
 '002323.SZ',
 '300638.SZ',
 '600606.SH',
 '300603.SZ',
 '603227.SH',
 '600293.SH',
 '600812.SH',
 '000835.SZ',
 '002106.SZ',
 '000421.SZ',
 '000666.SZ',
 '002478.SZ',
 '300381.SZ',
 '603033.SH',
 '600998.SH',
 '600479.SH',
 '600079.SH',
 '600875.SH',
 '002095.SZ',
 '300295.SZ',
 '600819.SH',
 '000892.SZ',
 '300044.SZ',
 '600848.SH',
 '603936.SH',
 '600635.SH',
 '600468.SH',
 '000407.SZ',
 '002931.SZ',
 '300258.SZ',
 '600029.SH',
 '300336.SZ',
 '002690.SZ',
 '600655.SH',
 '300399.SZ',
 '300325.SZ',
 '600555.SH',
 '000821.SZ',
 '600677.SH',
 '600572.SH',
 '002858.SZ',
 '600240.SH',
 '603138.SH',
 '600608.SH',
 '600310.SH',
 '600522.SH',
 '000587.SZ',
 '601211.SH',
 '600335.SH',
 '000988.SZ',
 '600196.SH',
 '600435.SH',
 '300107.SZ',
 '600099.SH',
 '600433.SH',
 '600641.SH',
 '603787.SH',
 '600067.SH',
 '601579.SH',
 '600385.SH',
 '002100.SZ',
 '002345.SZ',
 '603222.SH',
 '000635.SZ',
 '300319.SZ',
 '002688.SZ',
 '600207.SH',
 '000153.SZ',
 '002833.SZ',
 '600235.SH',
 '603677.SH',
 '002084.SZ',
 '000619.SZ',
 '603968.SH',
 '603085.SH',
 '603889.SH',
 '002170.SZ',
 '002358.SZ',
 '601808.SH',
 '603198.SH',
 '000655.SZ',
 '002695.SZ',
 '300069.SZ',
 '603810.SH',
 '600893.SH',
 '300081.SZ',
 '600508.SH',
 '601128.SH',
 '000819.SZ',
 '002815.SZ',
 '600871.SH',
 '601368.SH',
 '600665.SH',
 '002221.SZ',
 '600418.SH',
 '600536.SH',
 '600255.SH',
 '300123.SZ',
 '603189.SH',
 '300078.SZ',
 '600854.SH',
 '603690.SH',
 '601101.SH',
 '601828.SH',
 '002013.SZ',
 '600163.SH',
 '002344.SZ',
 '603919.SH',
 '002444.SZ',
 '300134.SZ',
 '300480.SZ',
 '600461.SH',
 '300256.SZ',
 '600082.SH',
 '002572.SZ',
 '000001.SZ',
 '601777.SH',
 '002242.SZ',
 '300353.SZ',
 '000977.SZ',
 '002341.SZ',
 '300607.SZ',
 '000576.SZ',
 '603659.SH',
 '002543.SZ',
 '601326.SH',
 '600999.SH',
 '000516.SZ',
 '002758.SZ',
 '600020.SH',
 '300266.SZ',
 '300616.SZ',
 '300682.SZ',
 '002621.SZ',
 '000410.SZ',
 '000897.SZ',
 '300225.SZ',
 '600793.SH',
 '002003.SZ',
 '600817.SH',
 '000938.SZ',
 '002371.SZ',
 '002353.SZ',
 '300261.SZ',
 '002064.SZ',
 '002548.SZ',
 '300452.SZ',
 '603517.SH',
 '002677.SZ',
 '300642.SZ',
 '600550.SH',
 '600009.SH',
 '000735.SZ',
 '002336.SZ',
 '000595.SZ',
 '300588.SZ',
 '002054.SZ',
 '002824.SZ',
 '300232.SZ',
 '603389.SH',
 '000961.SZ',
 '002440.SZ',
 '300013.SZ',
 '603166.SH',
 '300218.SZ',
 '300677.SZ',
 '002317.SZ',
 '002508.SZ',
 '002664.SZ',
 '300226.SZ',
 '300269.SZ',
 '002905.SZ',
 '000783.SZ',
 '002582.SZ',
 '300741.SZ',
 '000509.SZ',
 '600323.SH',
 '002731.SZ',
 '600618.SH',
 '601996.SH',
 '603299.SH',
 '300310.SZ',
 '603328.SH',
 '600083.SH',
 '600823.SH',
 '300030.SZ',
 '300197.SZ',
 '002448.SZ',
 '300717.SZ',
 '300188.SZ',
 '600798.SH',
 '603456.SH',
 '002819.SZ',
 '002545.SZ',
 '603999.SH',
 '300121.SZ',
 '000505.SZ',
 '300635.SZ',
 '300145.SZ',
 '002306.SZ',
 '300395.SZ',
 '300590.SZ',
 '603496.SH',
 '002483.SZ',
 '603351.SH',
 '000932.SZ',
 '002554.SZ',
 '002005.SZ',
 '002307.SZ',
 '002789.SZ',
 '300021.SZ',
 '300424.SZ',
 '600726.SH',
 '600507.SH',
 '600657.SH',
 '000585.SZ',
 '300052.SZ',
 '000554.SZ',
 '002250.SZ',
 '300020.SZ',
 '000801.SZ',
 '603416.SH',
 '002883.SZ',
 '300083.SZ',
 '600460.SH',
 '601678.SH',
 '601228.SH',
 '300633.SZ',
 '002316.SZ',
 '002368.SZ',
 '300294.SZ',
 '600653.SH',
 '002099.SZ',
 '002586.SZ',
 '600881.SH',
 '601858.SH',
 '600822.SH',
 '300417.SZ',
 '600800.SH',
 '601086.SH',
 '300208.SZ',
 '600987.SH',
 '603880.SH',
 '000623.SZ',
 '000007.SZ',
 '600397.SH',
 '300407.SZ',
 '000995.SZ',
 '300059.SZ',
 '300173.SZ',
 '000951.SZ',
 '603901.SH',
 '600319.SH',
 '600525.SH',
 '603136.SH',
 '600271.SH',
 '002578.SZ',
 '600642.SH',
 '600801.SH',
 '603179.SH',
 '300459.SZ',
 '300533.SZ',
 '601799.SH',
 '000828.SZ',
 '600090.SH',
 '600267.SH',
 '000839.SZ',
 '300697.SZ',
 '000933.SZ',
 '600995.SH',
 '300418.SZ',
 '603183.SH',
 '600420.SH',
 '300117.SZ',
 '601208.SH',
 '000719.SZ',
 '300560.SZ',
 '000778.SZ',
 '300293.SZ',
 '300461.SZ',
 '002802.SZ',
 '300040.SZ',
 '601555.SH',
 '002665.SZ',
 '600410.SH',
 '002193.SZ',
 '300074.SZ',
 '600652.SH',
 '002409.SZ',
 '000780.SZ',
 '002297.SZ',
 '300089.SZ',
 '300171.SZ',
 '002606.SZ',
 '600278.SH',
 '600346.SH',
 '002888.SZ',
 '600016.SH',
 '600241.SH',
 '002566.SZ',
 '603506.SH',
 '002539.SZ',
 '600275.SH',
 '002705.SZ',
 '603789.SH',
 '002619.SZ',
 '002855.SZ',
 '300720.SZ',
 '600637.SH',
 '300660.SZ',
 '300436.SZ',
 '600623.SH',
 '000488.SZ',
 '600260.SH',
 '300398.SZ',
 '000858.SZ',
 '002707.SZ',
 '603976.SH',
 '002401.SZ',
 '300462.SZ',
 '000536.SZ',
 '001696.SZ',
 '002928.SZ',
 '600966.SH',
 '600439.SH',
 '300507.SZ',
 '002464.SZ',
 '300593.SZ',
 '000795.SZ',
 '002022.SZ',
 '600792.SH',
 '000939.SZ',
 '300033.SZ',
 '000878.SZ',
 '300489.SZ',
 '603159.SH',
 '603838.SH',
 '600231.SH',
 '600145.SH',
 '300262.SZ',
 '002827.SZ',
 '601099.SH',
 '300109.SZ',
 '002110.SZ',
 '300440.SZ',
 '300760.SZ',
 '002282.SZ',
 '300062.SZ',
 '600467.SH',
 '603866.SH',
 '600601.SH',
 '603011.SH',
 '600213.SH',
 '600282.SH',
 '600816.SH',
 '300622.SZ',
 '300244.SZ',
 '600519.SH',
 '603569.SH',
 '600184.SH',
 '600114.SH',
 '603819.SH',
 '603869.SH',
 '002419.SZ',
 '300213.SZ',
 '600093.SH',
 '603386.SH',
 '002718.SZ',
 '601020.SH',
 '002714.SZ',
 '002835.SZ',
 '000705.SZ',
 '002312.SZ',
 '600838.SH',
 '002763.SZ',
 '300137.SZ',
 '300702.SZ',
 '300279.SZ',
 '300589.SZ',
 '300541.SZ',
 '600517.SH',
 '300277.SZ',
 '002004.SZ',
 '002659.SZ',
 '300247.SZ',
 '300067.SZ',
 '600733.SH',
 '603039.SH',
 '000950.SZ',
 '002060.SZ',
 '002849.SZ',
 '002645.SZ',
 '002078.SZ',
 '300684.SZ',
 '600035.SH',
 '000561.SZ',
 '603987.SH',
 '002056.SZ',
 '300322.SZ',
 '000613.SZ',
 '000860.SZ',
 '600614.SH',
 '601598.SH',
 '000006.SZ',
 '300189.SZ',
 '002732.SZ',
 '000971.SZ',
 '300058.SZ',
 '603158.SH',
 '600363.SH',
 '603638.SH',
 '300443.SZ',
 '603667.SH',
 '600559.SH',
 '002420.SZ',
 '002528.SZ',
 '002909.SZ',
 '000710.SZ',
 '002765.SZ',
 '002929.SZ',
 '603626.SH',
 '600372.SH',
 '300526.SZ',
 '002223.SZ',
 '000166.SZ',
 '600098.SH',
 '603700.SH',
 '600379.SH',
 '002002.SZ',
 '300467.SZ',
 '002311.SZ',
 '600222.SH',
 '601857.SH',
 '603933.SH',
 '600586.SH',
 '002334.SZ',
 '002198.SZ',
 '300229.SZ',
 '300283.SZ',
 '000921.SZ',
 '600436.SH',
 '002366.SZ',
 '600845.SH',
 '000532.SZ',
 '600810.SH',
 '300136.SZ',
 '300601.SZ',
 '601929.SH',
 '002927.SZ',
 '600959.SH',
 '603366.SH',
 '603555.SH',
 '600201.SH',
 '603583.SH',
 '603797.SH',
 '601226.SH',
 '300017.SZ',
 '601901.SH',
 '002875.SZ',
 '300404.SZ',
 '603077.SH',
 '600682.SH',
 '002547.SZ',
 '300665.SZ',
 '002244.SZ',
 '600225.SH',
 '300066.SZ',
 '300555.SZ',
 '002191.SZ',
 '601162.SH',
 '603556.SH',
 '002154.SZ',
 '600735.SH',
 '601958.SH',
 '603607.SH',
 '600754.SH',
 '002473.SZ',
 '601118.SH',
 '002254.SZ',
 '600890.SH',
 '002426.SZ',
 '300379.SZ',
 '000593.SZ',
 '002696.SZ',
 '000901.SZ',
 '300692.SZ',
 '002801.SZ',
 '603396.SH',
 '002333.SZ',
 '000712.SZ',
 '002910.SZ',
 '000158.SZ',
 '002722.SZ',
 '600901.SH',
 '600667.SH',
 '603533.SH',
 '002837.SZ',
 '002738.SZ',
 '600072.SH',
 '600423.SH',
 '603167.SH',
 '300509.SZ',
 '600452.SH',
 '002210.SZ',
 '000018.SZ',
 '600366.SH',
 '603336.SH',
 '000581.SZ',
 '002212.SZ',
 '300276.SZ',
 '000818.SZ',
 '300722.SZ',
 '002088.SZ',
 '300112.SZ',
 '601699.SH',
 '600885.SH',
 '600546.SH',
 '300126.SZ',
 '600685.SH',
 '601606.SH',
 '601615.SH',
 '600356.SH',
 '601158.SH',
 '002945.SZ',
 '002753.SZ',
 '600766.SH',
 '600829.SH',
 '600148.SH',
 '300495.SZ',
 '601798.SH',
 '000607.SZ',
 '300504.SZ',
 '601766.SH',
 '603363.SH',
 '600686.SH',
 '002911.SZ',
 '300222.SZ',
 '600179.SH',
 '600723.SH',
 '002708.SZ',
 '300548.SZ',
 '300618.SZ',
 '603939.SH',
 '300164.SZ',
 '300344.SZ',
 '601811.SH',
 '300481.SZ',
 '300389.SZ',
 '600337.SH',
 '002076.SZ',
 '000790.SZ',
 '300455.SZ',
 '002011.SZ',
 '002602.SZ',
 '000998.SZ',
 '600076.SH',
 '000852.SZ',
 '603629.SH',
 '000962.SZ',
 '002590.SZ',
 '600183.SH',
 '601007.SH',
 '002327.SZ',
 '002864.SZ',
 '002068.SZ',
 '603018.SH',
 '300375.SZ',
 '601021.SH',
 '600567.SH',
 '600860.SH',
 '603666.SH',
 '601928.SH',
 '002559.SZ',
 '002678.SZ',
 '603816.SH',
 ...]
data = get_price(stocklist,None,date,'1d',['open','high','low','close'],bar_count = 60,is_panel =1)
data
<class 'pandas.core.panel.Panel'>
Dimensions: 4 (items) x 60 (major_axis) x 3585 (minor_axis)
Items axis: close to open
Major_axis axis: 2018-11-09 00:00:00 to 2019-02-11 00:00:00
Minor_axis axis: 000001.SZ to 603999.SH
closedf = data['close'].fillna(0)
opendf = data['open'].fillna(0)
highdf = data['high'].fillna(0)
lowdf = data['low'].fillna(0)
lowdf
lowdf

Out[39]:

000001.SZ000002.SZ000004.SZ000005.SZ000006.SZ000007.SZ000008.SZ000009.SZ000010.SZ000011.SZ...603987.SH603988.SH603989.SH603990.SH603991.SH603993.SH603996.SH603997.SH603998.SH603999.SH
2018-11-0910.4023.5316.002.865.036.714.434.274.268.92...6.049.9222.1030.0117.704.108.407.955.184.75
2018-11-1210.3823.4016.152.794.977.063.994.264.208.82...6.0110.9922.3030.1517.904.048.447.915.204.74
2018-11-1310.3823.4416.502.935.058.034.124.374.239.08...6.0910.8622.3330.5018.184.068.407.935.334.82
2018-11-1410.4223.9617.003.045.247.924.194.504.339.29...6.2510.6422.5132.0319.144.138.728.165.585.08
2018-11-1510.4223.9616.803.015.247.704.154.594.349.39...6.2810.6022.5131.9919.514.108.878.185.535.11
2018-11-1610.4924.0216.933.045.457.754.154.874.409.58...6.4310.6222.8032.7020.304.158.968.265.645.21
2018-11-1910.5724.6817.303.115.518.154.135.334.4210.04...6.4510.8222.5532.2620.074.118.858.265.685.25
2018-11-2010.5225.2316.803.035.477.884.005.024.3010.16...6.2710.7022.0831.8519.344.108.748.005.525.11
2018-11-2110.4825.3516.652.975.398.233.965.044.259.98...6.1910.6021.0031.5019.353.978.537.885.424.98
2018-11-2210.4825.2817.043.035.459.054.125.004.3210.25...6.4310.7521.1831.6619.454.058.728.195.575.11
2018-11-2310.3124.6816.492.885.259.374.014.744.319.66...6.0610.3521.0131.2118.513.857.968.365.215.04
2018-11-2610.3024.7416.352.875.258.643.954.754.349.65...6.0710.1120.6831.5018.353.797.958.205.155.12
2018-11-2710.1624.7816.462.895.268.143.954.844.479.70...6.1410.0120.7031.7618.533.808.028.215.135.17
2018-11-2810.1624.9916.672.895.177.933.894.744.429.49...6.0310.1220.5031.8818.133.777.888.255.085.02
2018-11-2910.1925.0016.322.995.327.293.754.694.459.54...6.409.8019.7031.7017.733.867.968.005.115.10
2018-11-3010.1725.0315.962.905.226.873.664.584.029.40...6.608.8719.8031.7017.803.827.867.965.064.80
2018-12-0310.4724.8116.393.035.447.263.854.854.069.85...6.7010.8020.7232.6618.684.058.258.165.255.05
2018-12-0410.5324.8616.523.035.497.393.964.894.069.93...6.7710.7121.0532.7618.914.038.348.115.275.05
2018-12-0510.4024.7616.552.985.477.843.914.804.019.92...6.6110.7021.3831.3518.803.978.198.155.475.35
2018-12-0610.2324.9016.642.955.557.763.914.754.0210.15...6.6610.3821.4632.4218.504.058.188.105.305.80
2018-12-0710.2725.1216.303.005.627.913.904.763.8610.47...6.5510.2021.2532.6018.634.038.218.005.205.46
2018-12-1010.1324.9015.802.915.537.203.804.653.8210.20...6.3510.1921.1032.0818.033.978.167.665.055.12
2018-12-1110.1724.9116.072.935.627.383.834.663.7010.36...6.4310.2321.2032.1218.203.978.227.655.075.19
2018-12-1210.2026.1416.522.995.768.253.854.713.6110.76...6.4010.2821.2631.7418.314.038.247.795.105.25
2018-12-1310.2026.4016.412.995.728.343.864.733.5210.88...6.7110.4221.2831.5318.354.078.168.155.095.21
2018-12-1410.1626.3116.462.925.668.103.964.583.3810.61...6.469.9620.8831.2018.034.078.018.105.035.10
2018-12-1710.1025.9417.252.915.728.053.904.523.3810.58...6.319.9020.3031.5117.754.047.947.924.885.03
2018-12-1810.1025.3416.832.875.388.223.824.563.459.92...6.339.8320.2132.1917.664.097.687.824.895.08
2018-12-199.9025.1516.322.865.428.793.814.553.479.97...6.339.9820.2132.1017.614.087.717.804.885.08
2018-12-209.6324.9116.302.845.408.613.794.533.459.81...6.369.9520.1931.9017.514.017.757.714.845.06
2018-12-219.3323.7016.172.835.338.233.804.483.469.67...6.549.8920.3231.2817.553.917.627.704.865.11
2018-12-249.3123.3316.082.825.278.183.804.503.459.60...6.619.8020.2031.8017.613.927.657.724.915.09
2018-12-259.2123.3815.922.725.038.013.854.233.329.27...6.359.8020.0731.6017.453.767.337.384.794.80
2018-12-269.2723.5816.162.735.158.463.964.373.409.41...6.4310.0620.4532.2618.363.847.567.464.854.90
2018-12-279.2823.4416.032.665.168.103.844.303.269.13...6.429.9520.1032.7918.373.757.437.504.654.81
2018-12-289.3123.6715.732.655.157.903.854.303.209.12...6.349.9820.0032.6018.183.747.367.404.674.81
2019-01-029.1623.6716.012.665.107.993.814.263.259.20...6.429.8219.2532.1518.063.657.487.654.524.75
2019-01-039.1523.7116.002.655.117.583.834.233.269.29...6.409.6618.7531.8017.823.677.477.704.534.72
2019-01-049.2223.8516.012.665.067.503.804.183.229.14...6.369.6218.5931.7917.423.677.367.724.504.66
2019-01-079.6324.9916.462.765.287.933.924.413.329.68...6.589.9519.3931.8018.363.837.737.754.744.92
2019-01-089.6224.6316.802.825.317.824.034.443.359.63...6.5510.0319.2031.8118.563.857.747.784.865.01
2019-01-099.7025.1116.722.845.347.804.064.463.369.72...6.8010.1819.5331.8718.853.838.017.854.925.00
2019-01-109.8625.0316.662.845.297.774.004.413.369.52...6.7210.2219.1631.8118.853.807.897.904.984.96
2019-01-1110.0525.0116.492.915.307.633.984.403.349.55...6.6810.1919.2331.5518.793.807.917.705.004.95
2019-01-1410.0724.9216.492.975.286.974.004.443.529.52...6.359.9418.7631.5019.063.807.877.645.004.93
2019-01-1510.0924.3216.403.045.237.053.984.443.479.53...6.3510.0118.9031.5218.883.807.917.775.004.94
2019-01-1610.2324.8316.552.965.317.074.004.433.519.64...6.4010.2419.3831.5619.143.818.087.775.034.97
2019-01-1710.1724.9416.402.955.256.773.954.373.429.66...6.289.8818.8031.5018.693.787.997.624.964.95
2019-01-1810.2824.9916.442.955.246.563.804.333.279.51...6.349.7518.8631.5018.583.817.957.614.984.86
2019-01-2110.3225.4016.422.965.336.723.894.403.319.62...6.429.8118.9131.0518.283.917.997.665.025.07
2019-01-2210.2625.2316.282.925.256.703.894.253.349.53...6.429.6818.8231.3618.893.857.877.654.975.03
2019-01-2310.2925.2016.202.975.236.623.864.263.319.53...6.379.6618.7131.5318.753.837.867.614.934.97
2019-01-2410.3724.9316.222.905.206.453.844.283.289.43...6.399.6817.9531.8518.593.838.077.624.944.97
2019-01-2510.5525.4916.272.915.256.203.854.283.259.48...6.369.5917.7332.0318.433.838.027.634.934.93
2019-01-2810.8825.8616.012.905.205.613.854.223.249.25...6.129.3217.7532.2218.233.837.937.544.864.93
2019-01-2910.7725.8715.002.785.105.053.804.083.028.93...5.929.0717.6332.2717.533.627.237.414.715.10
2019-01-3010.8626.6315.032.805.124.613.824.122.828.99...6.059.2217.5132.3917.273.737.287.334.654.92
2019-01-3110.9427.0014.052.825.114.753.504.022.858.94...5.858.4117.5032.6016.573.787.257.014.614.72
2019-02-0110.9626.9814.702.855.174.883.654.082.919.07...5.968.7517.5633.1316.803.837.467.124.664.73
2019-02-1110.9726.8914.852.975.255.123.614.263.049.29...6.199.0418.1234.9117.453.897.927.454.774.86
dt = pd.DataFrame(columns=['stock','startdate','enddate','T'])


data = get_price('603383.SH',None,'20190114','1d',['open','high','low','close'],bar_count=60,is_panel =1)

close1 = data['close']
open1 = data['open']
high1 = data['high']
low1 = data['low']

stocklist = list(closedf.columns)
y=0
for s in stocklist:
    corropen = round(np.corrcoef(open1,opendf[s])[0][1],3)
    corrhigh = round(np.corrcoef(high1,highdf[s])[0][1],3)
    corrlow = round(np.corrcoef(low1,lowdf[s])[0][1],3)
    corrclose = round(np.corrcoef(close1,closedf[s])[0][1],3)

    #综合值
    T = (corropen+corrhigh+corrlow+corrclose)/4
    startdate = '20181109'
    enddate = '20190211'
    dt.loc[y] = [s,startdate,enddate,T]
    y+=1
dt = dt.fillna(0)
dt = dt.sort_values(by='T',ascending=False)
dt
dt

Out[40]:

stockstartdateenddateT
2810600807.SH20181109201902110.89650
1385002943.SZ20181109201902110.89125
2125300752.SZ20181109201902110.87300
510002047.SZ20181109201902110.84575
3237603187.SH20181109201902110.84575
1384002942.SZ20181109201902110.83925
3450603711.SH20181109201902110.83775
74000401.SZ20181109201902110.83650
2382600298.SH20181109201902110.83650
1564300176.SZ20181109201902110.81875
3357603520.SH20181109201902110.81850
2575600547.SH20181109201902110.81725
1403300014.SZ20181109201902110.81275
3445603703.SH20181109201902110.80975
2526600489.SH20181109201902110.80850
3152603026.SH20181109201902110.80850
1165002705.SZ20181109201902110.79425
3568603976.SH20181109201902110.79150
1461300073.SZ20181109201902110.78925
1568300180.SZ20181109201902110.78800
2713600702.SH20181109201902110.78725
1649300262.SZ20181109201902110.78250
2492600436.SH20181109201902110.77825
3242603197.SH20181109201902110.77450
134000543.SZ20181109201902110.76650
2080300702.SZ20181109201902110.75825
2561600529.SH20181109201902110.75750
552002089.SZ20181109201902110.75500
3392603605.SH20181109201902110.75350
3367603558.SH20181109201902110.75275
...............
2240600131.SH2018110920190211-0.78025
2699600687.SH2018110920190211-0.78100
201000629.SZ2018110920190211-0.78225
3158603032.SH2018110920190211-0.78300
1624300237.SZ2018110920190211-0.78350
444000981.SZ2018110920190211-0.78600
3492603811.SH2018110920190211-0.78775
2701600689.SH2018110920190211-0.79025
2330600235.SH2018110920190211-0.79200
2294600195.SH2018110920190211-0.79450
3105601918.SH2018110920190211-0.79450
2695600683.SH2018110920190211-0.79550
3267603269.SH2018110920190211-0.80200
2237600128.SH2018110920190211-0.80400
2646600624.SH2018110920190211-0.80500
1108002647.SZ2018110920190211-0.80700
656002193.SZ2018110920190211-0.80850
3042601577.SH2018110920190211-0.80975
517002054.SZ2018110920190211-0.81150
2801600796.SH2018110920190211-0.81350
103000504.SZ2018110920190211-0.81375
610002147.SZ2018110920190211-0.81500
2370600283.SH2018110920190211-0.82150
1382002940.SZ2018110920190211-0.82250
1381002939.SZ2018110920190211-0.82825
1492300104.SZ2018110920190211-0.83000
2399600317.SH2018110920190211-0.83900
1711300324.SZ2018110920190211-0.84800
1046002585.SZ2018110920190211-0.85300
2926600981.SH2018110920190211-0.87450

3585 rows × 4 columns

查看相似最高的股票和最低的股票

for s in [0,-1]:
    stock = dt.iloc[s].stock
    startdate = dt.iloc[s].startdate
    enddate = dt.iloc[s].enddate

    import numpy as np
    import matplotlib.pyplot as plt 
    from matplotlib.finance import candlestick2_ohlc
    import datetime
    s = stock

    trade = list(closedf.index.strftime('%Y%m%d'))
    num = trade.index(enddate)
    close1 = closedf[s]
    open1 = opendf[s]
    high1 = highdf[s]
    low1 = lowdf[s]
    
    #画图
    fig,ax = plt.subplots(figsize = (10,6.18),facecolor='white')
    fig.subplots_adjust() 
    
    
    ticks = ax.set_xticks([0,60])
    labels = ax.set_xticklabels([startdate,enddate], fontsize=10) 

    plt.yticks()  
    plt.title("{} K线走势图".format(s),fontsize = 15)  
    plt.ylabel("股价",fontsize = 15)  
    candlestick2_ohlc(ax,open1,high1,low1,close1,width=0.6,colorup='red',colordown='green')
 

查看以上策略详细请 到 supermind量化交易官网查看:技术面分析专题(一)-- 相似k线的形态验证与选股

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值