(同花顺量化)归属母公司股东的净利润(同比增长率)大于20%小于等于100%_、换手率_2

用户头像神盾局量子研究部
2023-08-31 发布

问财量化选股策略逻辑

  • 至少5根均线重合的股票
  • 换手率>2%且<9%
  • 归属母公司股东的净利润(同比增长率)大于20%小于等于100%

选股逻辑分析

这个策略的逻辑是寻找那些至少有5根均线重合的股票,这些股票的换手率在2%到9%之间,并且归属母公司股东的净利润同比增长率大于20%且小于等于100%。这个策略的目的是寻找那些具有稳定增长潜力的股票。

有何风险?

这个策略的风险在于它可能会忽略一些具有更高增长潜力的股票,因为它的筛选标准相对严格。此外,如果市场走势不利,这些股票可能会出现回调,从而导致投资者损失。

如何优化?

为了优化这个策略,可以考虑增加更多的筛选标准,例如寻找那些具有高市盈率、低市净率和高股息率的股票。此外,可以考虑使用更多的技术指标来筛选股票,例如移动平均线、布林线和MACD等。

最终的选股逻辑

最终的选股逻辑如下:

import talib

def get_crossing_moving_average(prices, n):
    """
    获取n根移动平均线的交叉点
    """
    ma = talib.MA(prices, n)
    for i in range(1, n):
        if ma[i] > ma[i-1]:
            return i
    return None

def get_stable_growing_company(prices, earnings, growth):
    """
    获取具有稳定增长潜力的公司
    """
    if earnings[-1] < earnings[0]:
        return False
    if earnings[-1] / earnings[0] < growth:
        return False
    if len(prices) < 2:
        return False
    if len(prices) < 12:
        return False
    if get_crossing_moving_average(prices, 5) is None:
        return False
    if get_crossing_moving_average(prices, 10) is None:
        return False
    if get_crossing_moving_average(prices, 20) is None:
        return False
    if get_crossing_moving_average(prices, 30) is None:
        return False
    if get_crossing_moving_average(prices, 60) is None:
        return False
    if get_crossing_moving_average(prices, 120) is None:
        return False
    return True

def get_stable_growing_stocks(prices, earnings, growth):
    """
    获取至少有5根均线重合的稳定增长潜力的公司
    """
    stocks = []
    for i in range(len(prices)):
        if get_stable_growing_company(prices[i:], earnings[i:], growth[i:]):
            stocks.append(i)
    return stocks

def get_stocks_with_high_p_e_pb_roa(prices, earnings, growth, p_e, p_b, roa):
    """
    获取具有高市盈率、低市净率和高股息率的公司
    """
    stocks = []
    for i in range(len(prices)):
        if get_stable_growing_company(prices[i:], earnings[i:], growth[i:]):
            stocks.append(i)
    stocks = stocks[(prices[stocks] / prices[0]) > p_e]
    stocks = stocks[(prices[stocks] / prices[0]) < p_b]
    stocks = stocks[roa[stocks] > roa[0]]
    return stocks

def get_stocks_with_strong_trend(prices, earnings, growth, macd, bollinger):
    """
    获取具有强烈趋势的公司
    """
    stocks = []
    for i in range(len(prices)):
        if get_stable_growing_company(prices[i:], earnings[i:], growth[i:]):
            stocks.append(i)
    stocks = stocks[(macd[stocks] > macd[0]) & (bollinger[stocks] > bollinger[0])]
    return stocks

def get_stocks_with_low_risk(prices, earnings, growth, macd, bollinger, rsi):
    """
    获取具有低风险的公司
    """
    stocks = []
    for i in range(len(prices)):
        if get_stable_growing_company(prices[i:], earnings[i:], growth[i:]):
            stocks.append(i)
    stocks = stocks[(macd[stocks] > macd[0]) & (bollinger[stocks] > bollinger[0]) & (rsi[stocks] < 30)]
    return stocks

def get_stocks_with_all筛选标准(prices, earnings, growth, macd, bollinger, rsi):
    """

## 如何进行量化策略实盘?
请把您优化好的选股语句放入文章最下面模板的选股语句中即可。

select_sentence = '市值小于100亿' #选股语句。

模板如何使用?

点击图标右上方的复制按钮,复制到自己的账户即可使用模板进行回测。


## 如果有任何问题请添加 下方的二维码进群提问。
![94c5cde12014f99e262a302741275d05.png](http://u.thsi.cn/imgsrc/pefile/94c5cde12014f99e262a302741275d05.png)
收益&风险
源码

评论