(同花顺量化)2021年_、涨跌幅×超大单净量、今日增仓占比_5%

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

问财量化选股策略逻辑

  • 今日增仓占比>5%
  • 涨跌幅×超大单净量
  • 2021年

选股逻辑分析

  • 今日增仓占比>5%:说明该股票近期有资金流入,说明市场对该股票有一定的信心。
  • 涨跌幅×超大单净量:说明该股票的涨跌幅与超大单净量的乘积大于某个阈值,说明市场对该股票的买卖力量对比比较明显。
  • 2021年:说明该股票在2021年的表现,可以排除一些表现不佳的股票。

有何风险?

  • 该策略过于简单,可能无法捕捉到市场中更为复杂的因素。
  • 如果市场出现极端行情,该策略可能会失效。

如何优化?

  • 可以考虑加入更多的筛选条件,例如市值、市盈率等。
  • 可以使用技术分析方法,例如趋势线、均线等,来判断股票的走势。

最终的选股逻辑

  • 今日增仓占比>5%
  • 涨跌幅×超大单净量
  • 2021年
  • 市值>100亿
  • 市盈率<20

python代码参考

import talib

def get筛选条件():
    # 获取今日增仓占比
    today_open_price = get_open_price()
    today_close_price = get_close_price()
    today_amount = get_amount()
    today_buy_amount = today_amount - today_open_price
    today_buy_amount_ratio = today_buy_amount / today_amount
    return today_buy_amount_ratio > 0.05

def get_stock_info(stock_code):
    # 获取股票基本信息
    info = get_stock_info_by_code(stock_code)
    return info

def get_open_price():
    # 获取开盘价
    return get_stock_info(stock_code)['open']

def get_close_price():
    # 获取收盘价
    return get_stock_info(stock_code)['close']

def get_amount():
    # 获取成交量
    return get_stock_info(stock_code)['vol']

def get_amount_by_type(type):
    # 获取某一种成交量
    return get_stock_info(stock_code)['vol'][type]

def get_stock_info_by_code(stock_code):
    # 获取股票基本信息
    url = f'https://quote.eastmoney.com/{stock_code}'
    response = requests.get(url)
    data = response.json()
    return data

def get_trend_line(stock_code, start_date, end_date):
    # 获取趋势线
    url = f'https://quote.eastmoney.com/{stock_code}/trendline'
    params = {
        'start_date': start_date,
        'end_date': end_date
    }
    response = requests.get(url, params=params)
    data = response.json()
    return data['trendline']

def get_stock_k_data(stock_code, start_date, end_date):
    # 获取股票K线数据
    url = f'https://quote.eastmoney.com/{stock_code}/kline'
    params = {
        'start_date': start_date,
        'end_date': end_date
    }
    response = requests.get(url, params=params)
    data = response.json()
    return data

def get_stock_k_data_by_type(stock_code, start_date, end_date, type):
    # 获取某一种股票K线数据
    url = f'https://quote.eastmoney.com/{stock_code}/kline'
    params = {
        'start_date': start_date,
        'end_date': end_date,
        'type': type
    }
    response = requests.get(url, params=params)
    data = response.json()
    return data[type]

def get_stock_c_data(stock_code, start_date, end_date):
    # 获取股票CPI数据
    url = f'https://quote.eastmoney.com/{stock_code}/cpi'
    params = {
        'start_date': start_date,
        'end_date': end_date
    }
    response = requests.get(url, params=params)
    data = response.json()
    return data

def get_stock_m_data(stock_code, start_date, end_date):
    # 获取股票M1数据
    url = f'https://quote.eastmoney.com/{stock_code}/m1'
    params = {
        'start_date': start_date,
        'end_date': end_date
    }
    response = requests.get(url, params=params)
    data = response.json()
    return data

def get_stock_m2_data(stock_code, start_date, end_date):
    # 获取股票M2数据
    url = f'https://quote.eastmoney.com/{stock_code}/m2'
    params = {
        'start_date': start_date,
        'end_date

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

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

模板如何使用?

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


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

评论