问财量化选股策略逻辑
选股逻辑:选取RSI小于65、PE大于0、500日内至少2次涨停的股票。
选股逻辑分析
该选股策略使用了RSI和PE指标来筛选基本面良好的股票,并加入了500日内至少2次涨停的条件,选择的是热门股票。
有何风险?
该选股策略选取的是热门股票,可能出现持续上涨之后的回撤,投资者应该具备足够的风险承受能力。而且涨停股票数量较少,选股结果可能相对不稳定。
如何优化?
除了RSI和PE指标,可以考虑加入其他基本面指标的分析,如市盈率、市净率等。同时可以加入其它技术指标的筛选,如KDJ等,以提高筛选精度。也可以根据投资者的风险偏好,调整涨停次数的筛选标准,来实现更加个性化的选股策略。
最终的选股逻辑
基于RSI和PE指标,选取RSI小于65、PE大于0,同时500日内至少2次涨停的股票。
同花顺指标公式代码参考
- RSI指标:REF(CAS(CLOSE,1),1),6)/EMA(C,6)*100
- PE指标:TURNOVER/VOL/CAPITAL
Python代码参考
import pandas as pd
import tushare as ts
def get_stock_list(rsi_threshold=65, pe_threshold=0, limit_count=2):
stock_list = pd.DataFrame(columns=['股票代码', '名称'])
for _, row in ts.get_today_all().iterrows():
symbol = row['code']
name = row['name']
hist_data = ts.get_hist_data(symbol)
if hist_data is None:
continue
limit_up_count = 0
for i in range(1, 500):
if ts.get_hist_data(symbol).iloc[-i]['pct_chg'] == 10:
limit_up_count += 1
if limit_up_count >= limit_count:
break
if limit_up_count < limit_count:
continue
if ts.get_hist_data(symbol)['p_change'].iloc[-1] > rsi_threshold:
continue
pe = ts.get_hist_data(symbol)['turnover'].iloc[-1]/vol/ts.get_stock_basics().loc[symbol]['totals']
if pe < pe_threshold:
continue
stock_list = stock_list.append({'股票代码':symbol, '名称':name}, ignore_index=True)
return stock_list
## 如何进行量化策略实盘?
请把您优化好的选股语句放入文章最下面模板的选股语句中即可。
select_sentence = '市值小于100亿' #选股语句。
模板如何使用?
点击图标右上方的复制按钮,复制到自己的账户即可使用模板进行回测。
## 如果有任何问题请添加 下方的二维码进群提问。


