| | |
| | | |
| | | import constant |
| | | import inited_data |
| | | from api import low_suction_data_pusher |
| | | from code_attribute.gpcode_manager import BlackListCodeManager, HumanRemoveForbiddenManager |
| | | from l2.huaxin import huaxin_target_codes_manager |
| | | from l2.l2_transaction_data_manager import HuaXinBuyOrderManager |
| | |
| | | th_sell = BeforeSubDealBigOrderManager().get_big_sell_order_threshold(code) |
| | | except: |
| | | th_sell = 0 |
| | | |
| | | # (缺少的资金, 净成交金额, 要求的大单金额, 计算得到的大单阈值金额, 人为设置的大单) |
| | | deal_big_money_info = radical_buy_data_manager.get_total_deal_big_order_info( |
| | | code, gpcode_manager.get_limit_up_price_as_num(code)) |
| | | if deal_big_money_info[1] == 0 and len(codes) == 1: |
| | | # 总成交金额为0 |
| | | deal_big_money_info = list(deal_big_money_info) |
| | | # 没有订阅L2会出现没有值的情况,如果涨停过就拉取之前的涨停买/卖大单 |
| | | deal_big_orders_result = radical_buy_data_manager.request_deal_big_orders(code) |
| | |
| | | buy_datas, sell_datas = deal_big_orders_result[0], deal_big_orders_result[1] |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | limit_up_price_money_list = [x[0] for x in buy_datas if x[1] == limit_up_price] |
| | | threshold_money = BeforeSubDealBigOrderManager.compute_re_limit_up_big_money_threshold( |
| | | limit_up_price_money_list) |
| | | if limit_up_price_money_list: |
| | | threshold_money = BeforeSubDealBigOrderManager().compute_re_limit_up_big_money_threshold( |
| | | limit_up_price_money_list) |
| | | else: |
| | | threshold_money = 299e4 |
| | | logger_debug.info(f"{code}-临时回封均大单:{threshold_money}") |
| | | # 设置买单阈值 |
| | | th_buy = threshold_money |
| | | buy_money = sum(limit_up_price_money_list) |
| | | sell_money = sum([x[0] for x in sell_datas if x[1] == limit_up_price]) |
| | | # 涨停大单净买入 |
| | | # 涨停买净成交金额净买额 |
| | | deal_big_money_info[1] = buy_money - sell_money |
| | | # 要求的大单累计金额 |
| | | deal_big_money_info[ |
| | | 2] = radical_buy_data_manager.compute_total_deal_big_order_threshold_money(code, |
| | | limit_up_price, |
| | | threshold_money) |
| | | # logger_debug.info(f"{code}-累计大单阈值:{deal_big_money_info[2]}") |
| | | # logger_debug.info(f"{code}非订阅大单, buy_money-{buy_money}, sell_money-{sell_money}") |
| | | |
| | | big_money_rate = radical_buy_data_manager.TotalDealBigOrderInfoManager.get_big_order_rate( |
| | | code) |
| | |
| | | output_util.money_desc(th_sell), # 卖单阈值 |
| | | big_money_rate * 100 # 大单成交比 |
| | | ), |
| | | # 涨停大单净买入 |
| | | output_util.money_desc(deal_big_money_info[1]), |
| | | # 累计总大单阈值 |
| | | output_util.money_desc(deal_big_money_info[2]), |
| | | # 原累计大单阈值(非人为设置) |
| | | output_util.money_desc(deal_big_money_info[3]), |
| | | # 人为设置的大单 |
| | | output_util.money_desc(deal_big_money_info[4]) if deal_big_money_info[4] else '', |
| | | ] |
| | | if len(codes) == 1: |
| | | # 加载大单详情 |
| | | deal_big_order_detail_info = radical_buy_data_manager.get_l2_big_order_deal_info(code) |
| | | # 加载涨停大单详情 |
| | | # 买大单, 上板前买大单, 卖大单, 上板前卖大单 |
| | | limit_up_big_order_detail = radical_buy_data_manager.get_total_detal_big_order_details( |
| | | code) |
| | | if max(limit_up_big_order_detail) == 0: |
| | | # 没有数据,从网络加载 |
| | | limit_up_big_order_detail = list(limit_up_big_order_detail) |
| | | limit_up_big_order_detail[1] = deal_big_order_detail_info[1][0] |
| | | limit_up_big_order_detail[3] = deal_big_order_detail_info[2][0] |
| | | deal_big_order_info.append( |
| | | output_util.money_desc(limit_up_big_order_detail[0] + limit_up_big_order_detail[1])) |
| | | deal_big_order_info.append( |
| | | output_util.money_desc(limit_up_big_order_detail[2] + limit_up_big_order_detail[3])) |
| | | # 累计涨停买金额 |
| | | buy_money = output_util.money_desc(limit_up_big_order_detail[0] + limit_up_big_order_detail[1]) |
| | | sell_money = output_util.money_desc(limit_up_big_order_detail[2] + limit_up_big_order_detail[3]) |
| | | deal_big_order_info.append(buy_money) |
| | | # 累计涨停卖金额 |
| | | deal_big_order_info.append(sell_money) |
| | | deal_big_order_info.append( |
| | | radical_buy_data_manager.TotalDealBigOrderInfoManager().get_big_order_rate(code)) |
| | | |
| | |
| | | lambda: request_new_blocks_codes(update_new_block_plates, new_block_codes.keys())) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | # 将数据推送至其他项目 |
| | | try: |
| | | low_suction_data_pusher.push_limit_up_list(result_list_) |
| | | except: |
| | | pass |
| | | |
| | | self.__kplDataManager.save_data(type_, result_list_) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |