问财量化选股策略逻辑
选股逻辑:选用RSI小于65、2021年营收/2018年营收大于1.1、10天内涨停天数大于2的股票进行投资。
选股逻辑分析
该选股逻辑基于技术面指标、营收比例、涨停信息等多重因素综合考虑,以期找到具有较好投资价值的股票。
有何风险?
- 涨停天数的情况变化可能对选股结果产生影响,例如市场风格和宏观经济情况的变化等;
- 结合技术面指标和营收比例考虑涨停信息,忽略了其他重要的财务指标和行业前景等因素。
如何优化?
- 结合公司的历史表现、行业趋势等多重因素综合考虑,综合运用多种技术和基本面指标;
- 可以通过引入更多的涨停信息,例如涨停后的开盘价、涨停板之前的价格波动情况等,来提高选股精度和稳定性;
- 科学合理地设置涨停天数的限制,根据历史数据和市场情况动态调整。
最终的选股逻辑
选用RSI小于65、2021年营收/2018年营收大于1.1、10天内涨停天数大于2的股票进行投资,选取前N个股票进行投资,投资期限为一年。
同花顺指标公式代码参考
通达信公式:
CATEG('深圳本市主板') AND CAPITAL<=2000 AND (C/REF(C,1)>1.1)
AND (COUNT(DAY>HHV(HIGH,1),10)>2) AND (RSI(CLOSE,14)<65)
该公式在原有选股策略的基础上加入了涨停天数的限制。
Python代码参考
以下是基于该选股策略编写的Python代码示例,仅供参考。
import tushare as ts
import talib
def select_stocks(n):
res = []
basic_info = ts.get_stock_basics()
for code in basic_info.index:
try:
rsi_threshold = 65
revenue_ratio_threshold = 1.1
limit_days_threshold = 2
# 过滤条件:上市时间超过一年
if basic_info.loc[code]['timeToMarket'] > int(time.strftime("%Y%m%d")) - 365:
continue
# 主板条件筛选
if basic_info.loc[code]['exchange'] != 'SZSE' or '主板' not in basic_info.loc[code]['area']:
continue
# 规模筛选条件
capital = basic_info.loc[code]['totals'] * basic_info.loc[code]['price'] * 10000
if capital < capital_threshold:
continue
# 营收筛选条件
revenue_ratio = ts.get_hist_data(code)['revenue'][-1] / ts.get_hist_data(code)['revenue'][0]
if revenue_ratio < revenue_ratio_threshold:
continue
# 涨停筛选条件
limit_days = 0
for i in range(10):
if ts.get_tick_data(code, date=time.strftime("%Y-%m-%d", time.localtime(time.time() - i * 24 * 3600)))['change'].max() == 10:
limit_days += 1
if limit_days < limit_days_threshold:
continue
# RSI指标
rsi_data = talib.RSI(ts.get_hist_data(code)['close'].values, timeperiod=14)
if rsi_data[-1] > rsi_threshold:
continue
res.append(code)
except Exception as e:
continue
return res[:n]
# 选取前10个股票
res = select_stocks(10)
print(res)
注:在使用该代码时,请遵守国家法律法规和相关规定,严禁擅自开展证券投资活动,自行承担相应风险。
## 如何进行量化策略实盘?
请把您优化好的选股语句放入文章最下面模板的选股语句中即可。
select_sentence = '市值小于100亿' #选股语句。
模板如何使用?
点击图标右上方的复制按钮,复制到自己的账户即可使用模板进行回测。
## 如果有任何问题请添加 下方的二维码进群提问。


