| | |
| | | |
| | | if data["sell"] and len(data["sell"]) > 1 and data["sell"][1][1] > 0: |
| | | # 出现卖二 |
| | | radical_buy_strategy.clear_data(code, force=True) |
| | | radical_buy_strategy.clear_data(code, force=True, market_time_str=time_str) |
| | | |
| | | # 设置扫入数据 |
| | | RadicalCodeMarketInfoManager().set_market_info(code, time_str, limit_up_price, data["buy"][0], |
| | |
| | | break |
| | | latest_deal_time = l2_market_time_str |
| | | RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict[code] = ( |
| | | time.time() + 30, latest_buy_no, buy_blocks, |
| | | time.time() + 60, latest_buy_no, buy_blocks, |
| | | latest_deal_time, buy_blocks_with_money) |
| | | return False |
| | | else: |
| | |
| | | kpl_block_dict[code] = [] |
| | | kpl_block_dict[code].append((r[2], r[1])) # (板块, 日期) |
| | | for code in kpl_block_dict: |
| | | if code =='002361': |
| | | print("") |
| | | block_infos = kpl_block_dict.get(code) |
| | | cls.__radical_buy_reasons_dict[code] = cls.__compute_limit_up_reasons(code, block_infos) |
| | | |
| | |
| | | # {"板块":[(出现次数, 最近出现日期)]} |
| | | temp_dict = {} |
| | | for b in block_infos: |
| | | if b[0] in constant.KPL_INVALID_BLOCKS: |
| | | continue |
| | | if b[0] not in temp_dict: |
| | | temp_dict[b[0]] = [0, b[1]] |
| | | temp_dict[b[0]][0] += 1 |
| | | if not temp_dict: |
| | | return set() |
| | | temp_list = [(k, temp_dict[k][0], temp_dict[k][1]) for k in temp_dict] |
| | | # 按照涨停次数与最近涨停时间排序 |
| | | temp_list.sort(key=lambda x: (x[1], x[2]), reverse=True) |
| | |
| | | __latest_deal_active_buy_order = {} |
| | | |
| | | |
| | | def clear_data(code, force=False): |
| | | def clear_data(code, force=False, market_time_str=None): |
| | | """ |
| | | 清除数据:下单过后/开板后清除数据 |
| | | @param market_time_str: L2 market时间 |
| | | @param force: 是否强制清除 |
| | | @param code: |
| | | @return: |
| | |
| | | force = True |
| | | |
| | | if force: |
| | | # 如果比最近成交时间<=L2 market时间就视为数据延迟 |
| | | if market_time_str and code in RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict: |
| | | if tool.trade_time_sub(market_time_str, |
| | | RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict[code][3]) <= 0: |
| | | async_log_util.info(logger_l2_radical_buy, f"L2market时间小于成交时间:{code}-{market_time_str}") |
| | | return |
| | | |
| | | if __deal_active_buy_total_money.get(code): |
| | | async_log_util.info(logger_l2_radical_buy, f"清除涨停卖成交数据") |
| | | async_log_util.info(logger_l2_radical_buy, f"清除涨停卖成交数据:{code}-{market_time_str}") |
| | | # 强制清除数据 |
| | | if code in __deal_active_buy_total_money: |
| | | __deal_active_buy_total_money.pop(code) |
| | |
| | | RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict.pop(code) |
| | | |
| | | |
| | | def process_limit_up_active_buy_deal(code, transaction_datas, is_almost_open_limit_up = False): |
| | | def process_limit_up_active_buy_deal(code, transaction_datas, is_almost_open_limit_up=False): |
| | | """ |
| | | 涨停主动买成交 |
| | | @param code: |