刷抖音看到广告介绍尾盘选股涨跌幅,换手率,流通市值,量比等来判断股价涨跌。
下午2.30入场第二天早上卖出号称什么一夜持股。
今天就用akshare的证券量化来弄一下这个尾盘选股。
至于akshare如何安装可以参考akshare官网里面介绍的比较全面了
import akshare as ak
import pandas as pd
from datetime import datetime,timedelta
current_time = datetime.now()
nowtime = current_time.strftime("%Y%m%d")
oldDate = current_time - timedelta(days=30)
oldtime = oldDate.strftime("%Y%m%d")
#获取实时行情数据
ak_df = ak.stock_zh_a_spot_em()
for index, row in ak_df.iterrows():
#涨跌幅,换手率,流通市值,量比
if(row.涨跌幅>3 and row.涨跌幅<7 and row.换手率>2 and row.换手率<10 and row.流通市值>2000000000 and row.量比>1):
#print(row.名称 +'||'+ row.代码)
#获取K线数据删选成交量稳步上涨股价也在上涨的股票
stock_zh_a_hist = ak.stock_zh_a_hist(symbol=row.代码, period="daily",start_date=oldtime,end_date=nowtime)
rows = list(stock_zh_a_hist.iterrows())
length = len(rows)
zx1 = length-1
zx2 = length-2
zx3 = length-3
zdflj = 0
sp1 = 0#今天最近价格
sp2 = 0#昨天收盘价格
sp3 = 0#前天收盘价格
cje1 = 0#今天的成交额
cje2 = 0#昨天的成交额
cje3 = 0#前天的成交额
for index2, row2 in stock_zh_a_hist.iterrows():
if(index2 == zx1):
sp1 = row2.收盘
cje1 = row2.成交额
if(index2 == zx2):
sp2 = row2.收盘
cje2 = row2.成交额
if(index2 == zx3):
sp3 = row2.收盘
cje3 = row2.成交额
if(cje1 > cje2 > cje3):#成交额连续三日增加
if(sp1 > sp2 > sp3):#股价连续三日上涨
print(row.代码+"-选股结束")
运行结果确实能选出几只股票不过具体看要看板块,资金,是否属于热门趋势来判断。