| | |
| | | import psutil |
| | | import requests |
| | | |
| | | from api import low_suction_data_pusher |
| | | from code_attribute import global_data_loader |
| | | from huaxin_client import l2_client_test, l1_subscript_codes_manager |
| | | from log_module.log import logger_local_huaxin_l2_transaction_big_order, logger_system, \ |
| | |
| | | from third_data.custom_block_in_money_manager import CodeInMoneyManager, BlockInMoneyRankManager |
| | | from third_data.history_k_data_manager import HistoryKDataManager |
| | | from third_data.history_k_data_util import HistoryKDatasUtils |
| | | from trade.buy_radical.block_special_codes_manager import BlockSpecialCodesManager |
| | | from utils import tool, middle_api_protocol, global_util |
| | | import urllib.parse as urlparse |
| | | from urllib.parse import parse_qs |
| | |
| | | codes = set() |
| | | last_trade_day = HistoryKDatasUtils.get_latest_trading_date(1)[0] |
| | | for code in zylt_volume_map: |
| | | if code == '601288': |
| | | print("") |
| | | volume = zylt_volume_map.get(code) |
| | | # 今日涨停价要突破昨日最高价 |
| | | k_bars = HistoryKDataManager().get_history_bars(code, last_trade_day) |
| | | if k_bars and 30e8 <= k_bars[0]["close"] * volume * tool.get_limit_up_rate(code) <= 300e8: |
| | | # 自由流通市值在30亿-300亿以上 |
| | | if k_bars and 10e8 <= k_bars[0]["close"] * volume * tool.get_limit_up_rate(code) <= 300e8: |
| | | # 自由流通市值在10亿-300亿以上 |
| | | limit_up_price = round(tool.get_limit_up_rate(code) * k_bars[0]["close"], 2) |
| | | if limit_up_price > k_bars[0]["high"]: |
| | | if limit_up_price > k_bars[0]["high"] or True: |
| | | # 今日涨停价要突破昨日最高价 |
| | | codes.add(code) |
| | | # 获取辨识度的票 |
| | | special_codes = BlockSpecialCodesManager().get_origin_code_blocks_dict().keys() |
| | | if special_codes: |
| | | codes |= set(special_codes) |
| | | return codes |
| | | except Exception as e: |
| | | logger_system.exception(e) |
| | |
| | | def __save_accurate_big_order(big_accurate_order_queue): |
| | | while True: |
| | | try: |
| | | data = big_accurate_order_queue.get() |
| | | logger_local_huaxin_l2_transaction_accurate_big_order.info(f"{data}") |
| | | datas = [] |
| | | while not big_accurate_order_queue.empty(): |
| | | data = big_accurate_order_queue.get() |
| | | datas.append(data) |
| | | if datas: |
| | | low_suction_data_pusher.push_big_order(datas) |
| | | for data in datas: |
| | | logger_local_huaxin_l2_transaction_accurate_big_order.info(f"{data}") |
| | | except: |
| | | pass |
| | | |
| | | |
| | | def run(): |
| | | special_codes = __get_special_codes() |
| | |
| | | for i in range(cpu_count): |
| | | process = multiprocessing.Process(target=l2_client_test.run, |
| | | args=( |
| | | codes[i * page_size:(i + 1) * page_size], big_order_queue, big_accurate_order_queue, special_codes,)) |
| | | codes[i * page_size:(i + 1) * page_size], big_order_queue, |
| | | big_accurate_order_queue, special_codes,)) |
| | | |
| | | process.start() |
| | | # 绑核运行 |
| | | psutil.Process(process.pid).cpu_affinity([i]) |
| | | threading.Thread(target=__run_upload_big_order_task, args=(big_order_upload_queue,), daemon=True).start() |
| | | threading.Thread(target=__save_accurate_big_order, args=(big_accurate_order_queue,), daemon=True).start() |
| | | |
| | | |
| | | while True: |
| | | try: |
| | |
| | | __upload_data("jingxuan_rank", json.dumps(fins)) |
| | | __upload_data("jingxuan_rank_out", json.dumps(fouts)) |
| | | __upload_codes_in_money() |
| | | try: |
| | | low_suction_data_pusher.push_block_in(in_list) |
| | | except: |
| | | pass |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | finally: |