问财量化选股策略逻辑
选股逻辑:选取RSI小于65、换手率在3%到12%之间、2019年分红比例大于25%的股票作为投资标的。
选股逻辑分析
该选股策略结合了技术面和基本面,主要是为了找到RSI指标低、换手率适中、分红比例高的股票,以便于长期投资。
有何风险?
- 选股策略仍存在一定的主观性,可能会影响到操作效果;
- 分红比例高的股票不一定是好的投资标的,可能存在公司实质性经营问题;
- 该选股策略可能无法涵盖所有的投资需求,需要谨慎使用。
如何优化?
- 可以加入其他基本面指标,例如EPS、净利润等,以提高选股策略的准确度;
- 严格控制风险,以避免公司实质性经营问题而影响到投资效果。
最终的选股逻辑
选取RSI小于65、换手率在3%到12%之间、2019年分红比例大于25%的股票作为投资标的。
同花顺指标公式代码参考
- RSI:RSI(CLOSE, N=14),其中CLOSE为股价收盘价,N为计算周期,例如RSI(CLOSE, 14)
- 分红比例:每股股利金额 / 每股净利润,用Tushare的financials接口中的每股现金及股息净额字段即可计算。
Python代码参考
以下是Python代码示例,仅供参考。
import tushare as ts
import pandas as pd
import talib
def select_stocks(n):
res = []
for code in ts.get_stock_basics().index:
try:
# 行情数据
hist_data = ts.get_hist_data(code)
if hist_data is None:
continue
close_data = hist_data['close'].values
vol_data = hist_data['volume'].values
# RSI
rsi_threshold = 65
rsi = talib.RSI(close_data)[-1]
if rsi >= rsi_threshold:
continue
# 换手率
turnover_threshold = (3, 12)
turnover = vol_data[-1] / talib.SMA(vol_data, 20)[-1]
if turnover <= turnover_threshold[0] or turnover >= turnover_threshold[1]:
continue
# 2019年分红比例
dividend_threshold = 0.25
financials = ts.get_profit_statement(code)
if financials is None:
continue
net_profit = financials['n_income'][0] * 10000 # 单位为元
dividend = financials['divi'][0] * 10 # 单位为分
if net_profit == 0 or dividend / net_profit < dividend_threshold:
continue
res.append(code)
except Exception as e:
continue
res = res[:n]
return res
# 选取前5个符合要求的股票
res = select_stocks(5)
print(res)
注:在使用该代码时,请遵守国家法律法规和相关规定,严禁私自开展证券投资活动,自行承担相应风险。
## 如何进行量化策略实盘?
请把您优化好的选股语句放入文章最下面模板的选股语句中即可。
select_sentence = '市值小于100亿' #选股语句。
模板如何使用?
点击图标右上方的复制按钮,复制到自己的账户即可使用模板进行回测。
## 如果有任何问题请添加 下方的二维码进群提问。


