返回列表 发布新帖

如何把选股代码放到自选板块,可以每天盘后复盘查看今日选股标的

2550 2
发表于 2023-12-22 17:48:43 | 显示全部楼层 阅读模式
复盘查看今日选股,可以根据以下代码进行参考
  1. # encoding:gbk

  2. '''
  3. 如何把选股代码放到自选板块,可供每天盘后复盘,今日选股

  4. 本实例剔除条件:ST 科创,价格

  5. '''
  6. import time

  7. import pandas as pd
  8. import numpy as np
  9. import talib

  10. data_list = []
  11. def init(C):
  12.     data_list.extend(C.get_stock_list_in_sector('沪深A股'))


  13. def after_init(C):
  14.     # 排除st合约
  15.     filter_list = []
  16.     # 初始化剔除合约
  17.     for s in data_list:
  18.         if s.startswith('3') or s.startswith('68'):
  19.             continue
  20.         ret_ins_dict = C.get_instrumentdetail(s)
  21.         if ret_ins_dict:
  22.             if ret_ins_dict['InstrumentName'] == None:
  23.                 continue
  24.             if 'ST' in ret_ins_dict['InstrumentName']:
  25.                 continue
  26.         # 排除股价大于20
  27.         res = C.get_full_tick([s])
  28.         last_price = res[s]['lastPrice']
  29.         if last_price > 20:
  30.             continue
  31.         filter_list.append(s)

  32.     # 创建板块
  33.     create_sector('我的', f'选股_{time.strftime("%Y%m%d")}', True)
  34.     for code in filter_list:
  35.         add_stock_to_sector(f'选股_{time.strftime("%Y%m%d")}', code)

  36. def handlebar(C):
  37.     # 计算当前主图的cci
  38.     pass
复制代码


评论2

Archer
发表于 2023-12-22 18:05:54 | 显示全部楼层
666
chenchen
发表于 2024-11-16 14:41:19 | 显示全部楼层
怎么取到5日,10日,20日均线数据?

回复

您需要登录后才可以回帖 登录 | 立即注册

客服专线

400-080-8112

用思考的速度交易,用真诚的态度合作,我们是认真的!
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2025 迅投QMT社区 版权所有 All Rights Reserved. 京ICP备2025122616号-3
关灯 快速发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表