| | |
| | | from trade.trade_data_manager import CodeActualPriceProcessor, RadicalBuyDealCodesManager |
| | | import concurrent.futures |
| | | |
| | | trade_gui = import_util.import_lib("trade.trade_gui") |
| | | |
| | | __actualPriceProcessor = CodeActualPriceProcessor() |
| | | |
| | | __pre_big_order_deal_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10) |
| | |
| | | # 想买单 |
| | | if gpcode_manager.WantBuyCodesManager().is_in_cache(code): |
| | | return 0 |
| | | else: |
| | | return -1 |
| | | # 隔夜单排一 |
| | | if gpcode_manager.BuyOpenLimitUpCodeManager().is_in_cache(code): |
| | | return 0 |
| | |
| | | code, price = d["code"], float(d["price"]) |
| | | temp_prices.append((code, price)) |
| | | # 获取收盘价 |
| | | pricePre = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code) |
| | | pricePre = gpcode_manager.CodePrePriceManager().get_price_pre_cache(code) |
| | | if pricePre is not None: |
| | | # 是否是想买单 |
| | | order_index = compute_code_order(code, top_in_blocks, yesterday_limit_up_codes, |
| | |
| | | # 创业板的涨幅需要打折 |
| | | rate = rate / 2 |
| | | if order_index >= 0: |
| | | if order_index < 1000 and rate >= 5: |
| | | # 涨幅大于3%的才能订阅 |
| | | if order_index < 1000 and rate >= 7: |
| | | # 涨幅大于7%的才能订阅 |
| | | _code_list.append((rate, code, order_index)) |
| | | else: |
| | | _delete_list.append((rate, code, 0)) |
| | |
| | | dif2 = add_code_set - latest_add_codes |
| | | if dif2: |
| | | # 新增加的订阅需要拉取之前的大单 |
| | | for c in dif2: |
| | | __pre_big_order_deal_thread_pool.submit(radical_buy_data_manager.pull_pre_deal_big_orders, c) |
| | | __pre_big_order_deal_thread_pool.submit(radical_buy_data_manager.pull_pre_deal_big_orders_by_codes, |
| | | dif2) |
| | | if True: |
| | | async_log_util.info(logger_l2_codes_subscript, |
| | | f"({request_id})预处理新增订阅代码:{dif2}") |
| | |
| | | add_datas = [] |
| | | for d in add_code_list: |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(d) |
| | | min_volume = int(round(50 * 10000 / limit_up_price)) |
| | | min_volume = int(round(constant.L2_MIN_MONEY / limit_up_price)) |
| | | # 需要订阅的特殊的量 |
| | | special_volumes = BuyMoneyUtil.get_possible_buy_volumes(limit_up_price) |
| | | special_volumes |= set([tool.get_buy_volume_by_money(limit_up_price, x) for x in |
| | |
| | | tool.get_buy_volume(limit_up_price), list(special_volumes))) |
| | | huaxin_target_codes_manager.HuaXinL2SubscriptCodesManager.push(add_datas, request_id) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | logger_debug.exception(e) |
| | | else: |
| | | pass |
| | | |