| | |
| | | __process_l1_data_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10) |
| | | __current_price_dict = {} |
| | | current_buy1_dict = {} |
| | | __updating_jx_blocks_codes = set() |
| | | |
| | | @classmethod |
| | | def __sell(cls, datas): |
| | |
| | | |
| | | @classmethod |
| | | def l2_market_data(cls, code, data): |
| | | |
| | | def update_kpl_jx_block(code_, buy_1_price_, limit_up_price_): |
| | | # ----------------------------------板块相关------------------------------ |
| | | try: |
| | | if code_ in cls.__updating_jx_blocks_codes: |
| | | return |
| | | cls.__updating_jx_blocks_codes.add(code_) |
| | | cls.__KPLCodeJXBlockManager.load_jx_blocks(code_, buy_1_price_, limit_up_price_, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.get_current_reasons()) |
| | | # 更新板块信息 |
| | | latest_current_limit_up_records = kpl_data_manager.get_latest_current_limit_up_records() |
| | | CodePlateKeyBuyManager.update_can_buy_blocks(code_, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.latest_origin_datas, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.total_datas, |
| | | latest_current_limit_up_records, |
| | | block_info.get_before_blocks_dict(), |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.get_current_reason_codes_dict()) |
| | | finally: |
| | | cls.__updating_jx_blocks_codes.discard(code_) |
| | | |
| | | time_str = f"{data['dataTimeStamp']}" |
| | | if time_str.startswith("9"): |
| | | time_str = "0" + time_str |
| | |
| | | buy_1_price, buy_1_volume = data["buy"][0] |
| | | sell_1_price, sell_1_volume = data["sell"][0] |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | |
| | | code_price_manager.Buy1PriceManager().set_latest_buy1_money(code, buy_1_price, buy_1_volume) |
| | | |
| | | # -----------------------判断是是否有自动撤单规则----------------------- |
| | | try: |
| | |
| | | # 买1封单额平稳 |
| | | LCancelBigNumComputer().re_compute_l_down_watch_indexes(code) |
| | | |
| | | # ----------------------------------板块相关------------------------------ |
| | | cls.__KPLCodeJXBlockManager.load_jx_blocks(code, buy_1_price, limit_up_price, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.get_current_reasons()) |
| | | # 更新板块信息 |
| | | latest_current_limit_up_records = kpl_data_manager.get_latest_current_limit_up_records() |
| | | CodePlateKeyBuyManager.update_can_buy_blocks(code, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.latest_origin_datas, |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.total_datas, |
| | | latest_current_limit_up_records, |
| | | block_info.get_before_blocks_dict(), |
| | | kpl_data_manager.KPLLimitUpDataRecordManager.get_current_reason_codes_dict()) |
| | | threading.Thread(target=lambda: update_kpl_jx_block(code, buy_1_price, limit_up_price), daemon=True).start() |
| | | |
| | | async_log_util.info(hx_logger_l2_market_data, f"{code}#{data}") |
| | | L2MarketSellManager().set_current_total_sell_data(code, time_str, |
| | |
| | | "pay_attention": need_pay_attention, |
| | | "trade_progress_percent": round( |
| | | total_left_num * float(limit_up_price) * 100 * 100 / buy1_money, 2), # 成交进度比例 |
| | | "limit_up_price": gpcode_manager.get_limit_up_price(code) |
| | | } |
| | | fdatas.append(fdata) |
| | | except Exception as e: |
| | |
| | | |
| | | # 做一些初始化的操作 |
| | | def __init(): |
| | | def run_pending(): |
| | | while True: |
| | | schedule.run_pending() |
| | | time.sleep(1) |
| | | # 9点半后终止运行 |
| | | if tool.trade_time_sub(tool.get_now_time_str(), "09:30:00") > 0: |
| | | break |
| | | |
| | | # 持仓刷新 |
| | | huaxin_trade_data_update.add_position_list() |
| | | # 定时持仓刷新 |
| | | schedule.every().day.at("09:00:00").do(huaxin_trade_data_update.add_position_list) |
| | | schedule.every().day.at("09:10:00").do(huaxin_trade_data_update.add_position_list) |
| | | threading.Thread(target=schedule.run_pending, daemon=True).start() |
| | | threading.Thread(target=run_pending, daemon=True).start() |
| | | |
| | | |
| | | def run(queue_strategy_r_trade_w, queue_l1_w_strategy_r, queue_strategy_w_trade_r, queue_strategy_w_trade_r_for_read, |