| | |
| | | logger_real_place_order_position, logger_device |
| | | from output import l2_output_util |
| | | from third_data import kpl_util, history_k_data_manager, huaxin_l1_data_manager, third_blocks_manager, kpl_data_manager |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager, RealTimeKplMarketData |
| | | from third_data.history_k_data_manager import HistoryKDataManager |
| | | from third_data.history_k_data_util import JueJinApi, HistoryKDatasUtils |
| | | from third_data.kpl_data_manager import KPLDataManager |
| | |
| | | data = { |
| | | "blocks": {}, |
| | | "origin_blocks": {}, |
| | | "match_blocks": [list(filter_blocks), list(match_blocks)] |
| | | "match_blocks": [list(filter_blocks), list(match_blocks)], |
| | | # 板块净流入情况 |
| | | "block_in_moneys": [RealTimeKplMarketData.get_block_info_at_block_in(b) for b in filter_blocks] |
| | | } |
| | | for s in source_origin_dict: |
| | | data["origin_blocks"][s] = list(source_origin_dict[s]) |
| | |
| | | # 获取买入下单设置 |
| | | data = { |
| | | "radical_buy": {"price": (constant.MIN_CODE_RADICAL_BUY_PRICE, constant.MAX_CODE_RADICAL_BUY_PRICE), |
| | | "zyltgb": constant.RADICAL_BUY_ZYLTGB_AS_YI_RANGES}} |
| | | "zyltgb": constant.RADICAL_BUY_ZYLTGB_AS_YI_RANGES, |
| | | "top_block_count_by_market_strong":constant.RADICAL_BUY_TOP_IN_COUNT_BY_MARKET_STRONG, |
| | | "special_codes_max_block_in_rank": constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL |
| | | }} |
| | | self.send_response({"code": 0, "data": data, "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | |
| | | constant.MIN_CODE_RADICAL_BUY_PRICE = radical_buy["price"][0] |
| | | constant.MAX_CODE_RADICAL_BUY_PRICE = radical_buy["price"][1] |
| | | constant.RADICAL_BUY_ZYLTGB_AS_YI_RANGES = radical_buy["zyltgb"] |
| | | if radical_buy.get("top_block_count_by_market_strong"): |
| | | constant.RADICAL_BUY_TOP_IN_COUNT_BY_MARKET_STRONG = radical_buy.get("top_block_count_by_market_strong") |
| | | if radical_buy.get("special_codes_max_block_in_rank"): |
| | | constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL = radical_buy.get( |
| | | "special_codes_max_block_in_rank") |
| | | |
| | | self.send_response({"code": 0, "data": {}, "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | |
| | | |
| | | # 常规买是否买入 |
| | | CAN_COMMON_BUY = False |
| | | |
| | | # 根据市场强度确定买净流入身位前几:[(最低分,最高分,买前几)] |
| | | RADICAL_BUY_TOP_IN_COUNT_BY_MARKET_STRONG = [(0, 60, 20), (60, 70, 25), (70, 80, 30), (80, 90, 35), (90, 101, 40)] |
| | | # 辨识度的票板块最低流入前几 |
| | | RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL = 20 |
| | | |
| | |
| | | b_need_cancel, b_cancel_data, extra_msg = RDCancelBigNumComputer().need_cancel(code, start_index, |
| | | end_index) |
| | | if b_need_cancel and b_cancel_data: |
| | | return b_cancel_data, f"RD撤({extra_msg})", trade_constant.CANCEL_TYPE_RD |
| | | big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | | code)) |
| | | if big_order_info[0]>0: |
| | | return b_cancel_data, f"RD撤({extra_msg})", trade_constant.CANCEL_TYPE_RD |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_error, |
| | | f"RD撤出错 参数:buy_single_index-{_buy_single_index} buy_exec_index-{_buy_exec_index} 错误原因:{str(e)}") |
| | |
| | | temp.append(1) |
| | | else: |
| | | temp.append(0) |
| | | if in_blocks and d[1] == in_blocks[-1]: |
| | | temp.append(RealTimeKplMarketData.get_market_strong()) |
| | | else: |
| | | temp.append(0) |
| | | temp_datas.append(temp) |
| | | |
| | | fdatas = temp_datas |
| | | elif type_ == 1: |
| | | out_blocks = RealTimeKplMarketData().get_top_market_jingxuan_out_blocks() |
| | |
| | | score = 60 |
| | | if cls.__market_strong is not None: |
| | | score = int(cls.__market_strong) |
| | | score = score // 10 |
| | | if score >= 10: |
| | | score = 9 |
| | | if score < 6: |
| | | score = 5 |
| | | return score * 2 - 2 |
| | | for info in constant.RADICAL_BUY_TOP_IN_COUNT_BY_MARKET_STRONG: |
| | | if info[0]<=score<info[1]: |
| | | return info[2] |
| | | return 10 |
| | | |
| | | @classmethod |
| | | def set_market_jingxuan_blocks(cls, datas): |
| | |
| | | @return: |
| | | """ |
| | | # 流入阈值 |
| | | THRESHOLD_MONEY = 100 * (tool.trade_time_sub(tool.get_now_time_str(), "09:30:00") // 60) + 1000 |
| | | THRESHOLD_MONEY = min(THRESHOLD_MONEY, 10000) |
| | | THRESHOLD_MONEY = max(THRESHOLD_MONEY, 1000) |
| | | THRESHOLD_MONEY = THRESHOLD_MONEY * 10000 |
| | | # THRESHOLD_MONEY = 100 * (tool.trade_time_sub(tool.get_now_time_str(), "09:30:00") // 60) + 1000 |
| | | # THRESHOLD_MONEY = min(THRESHOLD_MONEY, 10000) |
| | | # THRESHOLD_MONEY = max(THRESHOLD_MONEY, 1000) |
| | | # THRESHOLD_MONEY = THRESHOLD_MONEY * 10000 |
| | | THRESHOLD_MONEY = 0 |
| | | # 最大数量 |
| | | MAX_COUNT = cls.get_jingxuan_in_block_threshold_count() |
| | | |
| | |
| | | if count >= MAX_COUNT: |
| | | break |
| | | # 记录精选流出日志 |
| | | async_log_util.info(logger_kpl_jx_in, f"原数据:{datas[:20]} 板块:{blocks}") |
| | | async_log_util.info(logger_kpl_jx_in, f"原数据:{datas[:50]} 板块:{blocks}") |
| | | blocks = list(blocks) |
| | | blocks.sort(key=lambda x: fblock_money.get(x), reverse=True) |
| | | cls.__top_jx_blocks = blocks |
| | |
| | | return cls.__top_jx_out_blocks |
| | | |
| | | @classmethod |
| | | def get_block_info_at_block_in(cls, b): |
| | | """ |
| | | 获取板块的净流入情况 |
| | | @param b: |
| | | @return: (板块名称,身位,流入金额) |
| | | """ |
| | | for i in range(0, len(cls.top_in_list_cache)): |
| | | if cls.top_in_list_cache[i][1] == b: |
| | | return b, i, cls.top_in_list_cache[i][3] |
| | | return b, -1, 0 |
| | | |
| | | |
| | | |
| | | @classmethod |
| | | def set_top_5_industry(cls, datas): |
| | | for d in datas: |
| | | cls.total_industry_dict[d[1]] = d |
| | |
| | | ignore_open_limit_up=False) |
| | | if history_index > 5: |
| | | return False, f"处于首板老{history_index + 1}" |
| | | |
| | | # 判断是净流入前排 |
| | | in_blocks = RealTimeKplMarketData.get_top_market_jingxuan_blocks() |
| | | if block not in in_blocks or in_blocks.index(block) >= constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL: |
| | | return False, f"没有在精选净流入前{constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL}" |
| | | |
| | | # if history_index >= 4: |
| | | # # 判断量是否换够 |
| | | # volume_rate = CodeVolumeManager().get_volume_rate_refer_in_5days(code) |
| | |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | pass |
| | | pass |