(iwencai选股策略)今日增仓占比_5%、竞价涨幅>-2<5、量比大于1

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

问财量化选股策略逻辑

首先,我们来分析一下这个策略的逻辑。根据题目中的条件,我们需要选择今天增仓比例超过5%的股票,同时要求股票在竞价阶段的涨幅在-2到5之间,量比大于1.5,量比小于6。具体来说,我们可以使用以下代码来实现这些条件:

def get_top_gainers():
    # 获取今天所有股票的增仓比例
    gains = get_gains()
    
    # 筛选出今天增仓比例超过5%的股票
    top_gainers = gains[gains['percentage'] > 0.05]['code'].tolist()
    
    # 获取每个股票在竞价阶段的涨幅
    prices = get_prices()
    price_changes = prices.pct_change()
    
    # 筛选出今天竞价涨幅在-2到5之间的股票
    top_price_gainers = []
    for code in top_gainers:
        if price_changes[code].abs() > -2 and price_changes[code].abs() < 5:
            top_price_gainers.append(code)
    
    # 获取每个股票的量比
    volume = get_volume()
    volume_ratio = volume / volume.shift(1)
    
    # 筛选出量比大于1.5且量比小于6的股票
    top_volume_gainers = []
    for code in top_price_gainers:
        if volume_ratio[code] > 1.5 and volume_ratio[code] < 6:
            top_volume_gainers.append(code)
    
    return top_volume_gainers

这个策略的逻辑比较简单,主要是通过筛选今天增仓比例超过5%的股票,然后在竞价阶段筛选出涨幅在-2到5之间的股票,最后再筛选出量比大于1.5且量比小于6的股票。最终,我们将得到一个包含符合条件的股票代码的列表。

有何风险?

这个策略的逻辑比较简单,但是仍然存在一些风险。首先,如果股票的成交量非常小,那么量比可能会变得非常不稳定,从而导致策略的准确性受到影响。其次,如果股票的价格波动非常大,那么竞价阶段的涨幅可能会变得非常不稳定,从而导致策略的准确性受到影响。最后,如果市场整体表现不佳,那么所有股票的增仓比例都可能会下降,从而导致策略的准确性受到影响。

如何优化?

为了优化这个策略,我们可以考虑使用更多的数据来筛选股票。例如,我们可以使用滚动平均线来筛选股票的价格波动情况,使用技术指标来筛选股票的走势情况,或者使用宏观经济数据来筛选股票的市场表现情况。这些数据可以帮助我们更好地筛选出符合条件的股票,从而提高策略的准确性。

最终的选股逻辑

最终,我们可以使用以下代码来实现最终的选股逻辑:

def get_top_gainers():
    # 获取今天所有股票的增仓比例
    gains = get_gains()
    
    # 筛选出今天增仓比例超过5%的股票
    top_gainers = gains[gains['percentage'] > 0.05]['code'].tolist()
    
    # 获取每个股票在竞价阶段的涨幅
    prices = get_prices()
    price_changes = prices.pct_change()
    
    # 筛选出今天竞价涨幅在-2到5之间的股票
    top_price_gainers = []
    for code in top_gainers:
        if price_changes[code].abs() > -2 and price_changes[code].abs() < 5:
            top_price_gainers.append(code)
    
    # 获取每个股票的量比
    volume = get_volume()
    volume_ratio = volume / volume.shift(1)
    
    # 筛选出量比大于1.5且量比小于6的股票
    top_volume_gainers = []
    for code in top_price_gainers:
        if volume_ratio[code] > 1.5 and volume_ratio[code] < 6:
            top_volume_gainers.append(code)
    
    # 使用滚动平均线筛选股票的价格波动情况
    prices = get_prices()
    prices = prices.rolling(window=30).mean()
    price_changes = prices.pct_change()
    
    # 筛选出价格波动较小的股票
    top_price_gainers = []
    for code in top_volume_gainers:
        if price_changes[code].abs() < 2:
            top_price_gainers.append(code)
    
    # 使用技术指标筛选股票的走势情况
    prices = get_prices()
    prices = prices.rolling(window=30).mean()
    technical_indicators = calculate_technical_indicators(prices)
    top_price_gainers = []
    for code in top_volume_gainers:
        if technical_indicators[code]['macd'] > 0 and technical_indicators[code]['rsi'] < 70:
            top_price_gainers.append(code)
    
    # 使用宏观经济

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

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

模板如何使用?

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


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

评论