同花顺每日涨停数据获取
视图化分析优质板
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.widgets import MultiCursor
mpl.rcParams['font.sans-serif']=['SimHei']
#导入数据
df =pd.read_excel(r'E:\同花顺全部数据\Table421232涨停.xlsx')
df['封单额']=df['现价']*df['买量']
df['封交比']=df['封单额']/df['总金额']
df['封市比']=df['封单额']/df['流通市值']
#筛选优质板
df['优质板'] = np.where(np.logical_and(df['封单额'] > 50000000,df['封市比']>0.01), 1, 0)
df=df[df['优质板'] == 1]
#视图化封单占成交比,封单占流通比
fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True)
plt.subplot(2,1,1)
plt.plot(figsize=(220,10))
ax1.bar(df[' 名称'],df['封交比'])
plt.title('封交比')
plt.subplot(2,1,2)
plt.plot(figsize=(220,10))
plt.title('封市比')
ax2.bar(df[' 名称'],df['封市比'])
cursor = MultiCursor(fig.canvas, (ax1, ax2), useblit=True, horizOn=True, vertOn=True, color='r', lw=0.5)
plt.show()