本文主要是介绍akshare尾盘选股实践,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
刷抖音看到广告介绍尾盘选股涨跌幅,换手率,流通市值,量比等来判断股价涨跌。
下午2.30入场第二天早上卖出号称什么一夜持股。
今天就用akshare的证券量化来弄一下这个尾盘选股。
至于akshare如何安装可以参考akshare官网里面介绍的比较全面了
import akshare as ak
import pandas as pd
from datetime import datetime,timedeltacurrent_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-1zx2 = length-2zx3 = length-3zdflj = 0sp1 = 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.代码+"-选股结束")
运行结果确实能选出几只股票不过具体看要看板块,资金,是否属于热门趋势来判断。
这篇关于akshare尾盘选股实践的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!