| | |
| | | import hashlib |
| | | import json |
| | | import logging |
| | | import multiprocessing |
| | | import queue |
| | | import random |
| | | import socket |
| | |
| | | import threading |
| | | import time |
| | | |
| | | import requests |
| | | import schedule |
| | | |
| | | import constant |
| | |
| | | from cancel_strategy.s_l_h_cancel_strategy import SCancelBigNumComputer |
| | | from code_attribute import gpcode_manager, code_volumn_manager, global_data_loader, zyltgb_util |
| | | from code_attribute.code_l1_data_manager import L1DataManager |
| | | from code_attribute.gpcode_manager import CodePrePriceManager, CodesNameManager, GreenListCodeManager |
| | | from code_attribute.gpcode_manager import CodePrePriceManager, CodesNameManager, \ |
| | | WantBuyCodesManager |
| | | from huaxin_client import l2_data_transform_protocol |
| | | from huaxin_client.trade_transform_protocol import TradeResponse |
| | | from l2 import l2_data_manager_new, l2_log, code_price_manager, l2_data_util, transaction_progress, \ |
| | |
| | | from log_module import async_log_util, log_export |
| | | from log_module.log import hx_logger_contact_debug, hx_logger_trade_callback, \ |
| | | hx_logger_l2_orderdetail, hx_logger_l2_market_data, logger_l2_g_cancel, logger_debug, \ |
| | | logger_system, logger_trade, logger_local_huaxin_l1_trade_info, logger_l2_codes_subscript, logger_l2_radical_buy |
| | | logger_system, logger_trade, logger_l2_radical_buy |
| | | from third_data import block_info, kpl_data_manager, history_k_data_manager, huaxin_l1_data_manager |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager, CodePlateKeyBuyManager, RealTimeKplMarketData |
| | | from third_data.history_k_data_util import JueJinApi |
| | | from trade import l2_trade_util, \ |
| | | trade_data_manager, trade_constant, buy_open_limit_up_strategy |
| | | from trade.buy_radical import radical_buy_data_manager, radical_buy_strategy, block_special_codes_manager |
| | | from trade.buy_radical import radical_buy_data_manager, radical_buy_strategy |
| | | from trade.buy_money_count_setting import BuyMoneyAndCountSetting, BuyMoneyUtil |
| | | |
| | | from trade.huaxin import huaxin_trade_api as trade_api, huaxin_trade_api, huaxin_trade_data_update, \ |
| | | huaxin_trade_record_manager, huaxin_sell_util |
| | | huaxin_trade_record_manager |
| | | from api.outside_api_command_callback import OutsideApiCommandCallback |
| | | from trade.huaxin.huaxin_trade_record_manager import DelegateRecordManager |
| | | from trade.order_statistic import DealAndDelegateWithBuyModeDataManager |
| | |
| | | finally: |
| | | cls.__updating_jx_blocks_codes.discard(code_) |
| | | |
| | | def pull_pre_deal_big_orders(code_): |
| | | response_data = requests.get( |
| | | "http://127.0.0.1:9005/get_big_buy_order_list?code=" + code_) |
| | | r_str = response_data.text |
| | | response_data = json.loads(r_str) |
| | | if response_data["code"] == 0: |
| | | datas = response_data["data"] |
| | | logger_debug.info(f"拉取炸板前成交的大单:{code_}-{datas}") |
| | | if datas: |
| | | RadicalBigOrderThresholdManager().set_big_deal_order_list(code_, datas, gpcode_manager.get_limit_up_price_as_num(code_)) |
| | | |
| | | |
| | | |
| | | time_str = f"{data['dataTimeStamp']}" |
| | | if time_str.startswith("9"): |
| | |
| | | L2MarketSellManager().set_current_total_sell_data(code, time_str, |
| | | data["totalAskVolume"] * data["avgAskPrice"], |
| | | data["totalAskVolume"], sell_1_info, data.get("sell")) |
| | | # 炸板 |
| | | if sell_1_info and sell_1_info[1] > 0: |
| | | if RadicalBigOrderThresholdManager().is_need_update(code): |
| | | # 炸板更新数据 |
| | | cls.__sell_thread_pool.submit( |
| | | lambda: radical_buy_data_manager.pull_pre_deal_big_orders(code)) |
| | | |
| | | if data["sell"] and len(data["sell"]) > 1 and data["sell"][1][1] > 0: |
| | | # 出现卖二 |
| | | radical_buy_strategy.clear_data(code, force=True) |
| | | if RadicalBigOrderThresholdManager().is_need_update(code): |
| | | # 炸板更新数据 |
| | | cls.__sell_thread_pool.submit( |
| | | lambda: pull_pre_deal_big_orders(code)) |
| | | |
| | | |
| | | # 设置扫入数据 |
| | | RadicalCodeMarketInfoManager().set_market_info(code, time_str, round(float(limit_up_price), 2), data["buy"][0], |
| | |
| | | # 判断今日扫入的代码数量是否大于阈值 |
| | | radical_buy_setting = BuyMoneyAndCountSetting().get_radical_buy_setting() |
| | | MAX_COUNT = 4 if radical_buy_setting is None else radical_buy_setting[0] |
| | | if not GreenListCodeManager().is_in_cache(code): |
| | | if not WantBuyCodesManager().is_in_cache(code): |
| | | # 加绿不判断板块是否成交 |
| | | if len(deal_codes) >= MAX_COUNT: |
| | | async_log_util.info(logger_l2_radical_buy, f"扫入成交代码个数大于{MAX_COUNT}个:{code}-{deal_codes}") |
| | |
| | | buy_blocks_with_money = [(b, RealTimeKplMarketData.get_jx_block_in_money(b), |
| | | in_blocks.index(b) if b in in_blocks else -1) for b in buy_blocks] |
| | | if result_by_volume[0] != radical_buy_strategy.BUY_MODE_NONE: |
| | | if not GreenListCodeManager().is_in_cache(code): |
| | | if not WantBuyCodesManager().is_in_cache(code): |
| | | # 加绿的不需要判断如下问题 |
| | | if tool.get_now_time_as_int() < 93100: |
| | | radical_buy_data_manager.ExcludeIndexComputeCodesManager.add_code(code) |