| | |
| | | import threading |
| | | import time |
| | | |
| | | from code_attribute import code_nature_analyse, gpcode_manager |
| | | from log_module.log import logger_debug |
| | | from third_data import history_k_data_manager |
| | | from third_data.history_k_data_manager import HistoryKDataManager |
| | | from third_data.history_k_data_util import JueJinApi |
| | | from trade import l2_trade_util |
| | | from utils import tool, init_data_util |
| | | |
| | | if __name__ == '__main__': |
| | | # code = "603960" |
| | | # day = tool.get_now_date_str() |
| | | # datas = init_data_util.get_volumns_by_code(code, 150) |
| | | # HistoryKDataManager().save_history_bars(code, day, datas, force=True) |
| | | # print(HistoryKDataManager().get_history_bars(code, day)) |
| | | # print(HistoryKDataManager().get_pre_close(code, day)) |
| | | # history_k_data_manager.re_set_price_pres([code]) |
| | | # volumes_data = init_data_util.get_volumns_by_code("600211", 150) |
| | | # for volume in volumes_data: |
| | | # print(volume) |
| | | code = "000333" |
| | | now_day = "2024-10-10" |
| | | |
| | | def __update(): |
| | | time.sleep(5) |
| | | history_k_data_manager.update_history_k_bars() |
| | | |
| | | |
| | | def __is_normal_in_5d(code): |
| | | """ |
| | | 最近5天是否处于正常状态 |
| | | @param code: |
| | | @return: |
| | | """ |
| | | now_day = tool.get_now_date_str() |
| | | results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix([code]), |
| | | tool.date_sub(now_day, 30), tool.date_sub(now_day, 1)) |
| | | print(results) |
| | | results = results[-5:] |
| | | normal = True |
| | | for r in results: |
| | | if r["sec_level"] != 1: |
| | | normal = False |
| | | break |
| | | return normal |
| | | |
| | | |
| | | if __name__ == '__main__1': |
| | | codes = {'300947', '002025', '002875', '000757', '603076', '600785', '300766', '600595', '603511', '002205', |
| | | '002943', '002802', '002715', '603967', '600818', '000796', '600960', '603882', '002883', '603578', |
| | | '600650', '603028', '002905', '300058', '000503', '603228', '603920', '603693', '002209', '300819', |
| | | '002105', '300155', '002152', '002982', '600588', '001282', '605186', '600889', '002364', '603106', |
| | | '300451', '600506', '002559', '002363', '603888', '605259', '605069', '002622', '001258', '601566', |
| | | '002946', '002733', '002448', '000056', '600101', '603979', '002800', '603881', '003010', '002295', |
| | | '600322', '603580', '300153', '605398', '300946', '603506', '601218', '603938', '600120', '601619', |
| | | '002229', '002990', '002298', '603305', '002188', '002560', '300244', '001313', '000899', '600319', |
| | | '603183', '603876', '002662', '601579', '605333', '000818', '300069', '000048', '002881', '600590', |
| | | '002261', '002734', '600868', '002285', '002847', '002444', '000715', '601777', '000710', '002133', |
| | | '600143', '600280', '605011', '600728', '300488', '002286', '600718', '002354', '002475', '600114', |
| | | '603312', '300454', '300941', '000151', '600708', '002163', '002305', '002851', '002173', '002785', |
| | | '600032', '000920', '002913', '001389', '603121', '603063', '002384', '300067', '603273', '600602', |
| | | '000599', '603517', '002335', '002529', '002463', '600719', '601921', '603280', '600336', '600533', |
| | | '002358', '002357', '600979', '301396', '002068', '605255', '002248', '000722', '000688', '002518', |
| | | '603001', '600318', '600095', '300746', '001333', '002976', '002122', '301230', '603829', '300599', |
| | | '001279', '000007', '603269', '002743', '603286', '002134', '603193', '600376', '002970', '603860', |
| | | '002044', '000657', '002273', '605228', '002953', '002484', '600758', '600456', '605388', '603729', |
| | | '300288', '001298', '300528', '300643', '002707', '603108', '605162', '000592', '603716', '000558', |
| | | '600173', '002380', '300534', '600238', '002394', '603901', '002418', '002965', '002296', '603566', |
| | | '002779', '000888', '600825', '603268', '003038', '002993', '000659', '002580', '300253', '603215', |
| | | '002725', '603038', '002938', '002666', '002599', '600665', '603500', '002065', '002760', '301299', |
| | | '300078', '002436', '601869', '603610', '002888', '000815', '600183', '603238', '002829', '603296', |
| | | '603950', '603109', '000428'} |
| | | print(",".join(codes)) |
| | | |
| | | if __name__ == '__main__': |
| | | code = "002809" |
| | | limit_up_price = 13.01 |
| | | volumes_data = init_data_util.get_volumns_by_code(code, 150) |
| | | volumes = init_data_util.parse_max_volume_new(code, volumes_data[:60]) |
| | | if code_nature_analyse.is_price_too_high_in_days(code, volumes_data, limit_up_price)[0]: |
| | | pass |
| | | # 保存K线形态 |
| | | k_format = code_nature_analyse.get_k_format(code, limit_up_price, volumes_data) |
| | | |
| | | if k_format[10] and k_format[10][0]: |
| | | # 近5个交易日有涨停/炸板/跌停 |
| | | price_info = k_format[10][1] |
| | | p_price_info = price_info[0] # (价格,量) |
| | | t_price_info = price_info[1] # (价格,量)/None |
| | | # 初始化不能买 |
| | | can_buy = False |
| | | # 抛压已释放:今日涨停价≥T高价且T高价当日成交量≥P高价对应的那一天的成交量*101% |
| | | if t_price_info and limit_up_price >= t_price_info[0] and t_price_info[1] >= p_price_info[0] * 1.01: |
| | | can_buy = True |
| | | |
| | | if not can_buy: |
| | | # 抛压当日大幅释放:今日涨停价≥T高价+2%且今日涨停实时成交量≥T高价当日成交量*90% |
| | | if t_price_info and limit_up_price >= t_price_info[0] * 1.02: |
| | | today_volume = int(98.02 * 10000 * 100) |
| | | if today_volume >= t_price_info[1] * 0.9: |
| | | can_buy = True |
| | | |
| | | if not can_buy: |
| | | # 抛压今日强势释放:没有T高价时,今日涨停价≥P高价+6%且今日涨停实时成交量≥P高价当日成交量*101% |
| | | if not t_price_info and limit_up_price >= p_price_info[0] * 1.06: |
| | | today_volume = int(98.02 * 10000 * 100) |
| | | if today_volume >= p_price_info[1] * 1.01: |
| | | can_buy = True |
| | | |
| | | if not can_buy: |
| | | print("抛压没释放") |
| | | else: |
| | | print("抛压已释放") |