Administrator
2025-06-12 8068d87efa5fa19b563c1226bd90edcfd5ff38f0
main.py
@@ -7,9 +7,12 @@
from api import outside_api_callback
from api.outside_api_command_manager import ApiCommandManager
from db.redis_manager_delegate import RedisUtils
from huaxin_client import l2_market_client, trade_client
from log_module import async_log_util
from log_module.log import logger_debug
from server import data_server
from strategy import strategy_manager
from strategy.env_info import RealTimeEnvInfo
from third_data import hx_qc_value_util
from trade.huaxin import huaxin_trade_api
@@ -24,8 +27,10 @@
                if data.get("type") == 'set_target_codes':
                    # [(代码, 时间戳, 价格, 总交易量, 总交易额, 买5, 卖5)]
                    market_data_list = data["data"]["data"]
                    strategy_manager.low_suction_strtegy.add_ticks(market_data_list)
                    RealTimeEnvInfo().ticks = (tool.get_now_time_str(), len(market_data_list))
            except:
            except Exception as e:
                logger_debug.exception(e)
                time.sleep(0.1)
    queue_l1_w_strategy_r: multiprocessing.Queue = multiprocessing.Queue()
@@ -47,15 +52,23 @@
if __name__ == "__main__":
    # -------启动华鑫增值服务api------
    threading.Thread(target=hx_qc_value_util.run, daemon=True).start()
    time.sleep(10)
    # -----启动data_server-----
    threading.Thread(target=lambda: data_server.run("127.0.0.1", 9008), daemon=True).start()
    # 启动本地日志
    threading.Thread(target=lambda: async_log_util.run_sync(), daemon=True).start()
    # 启动redis同步
    threading.Thread(target=lambda: RedisUtils.run_loop(), daemon=True).start()
    # --------启动本地API接口----------
    manager = ApiCommandManager(middle_api_protocol.SERVER_HOST, middle_api_protocol.SERVER_PORT, outside_api_callback.MyAPICallback())
    manager.run(blocking=False)
    # -------启动华鑫增值服务api------
    threading.Thread(target=hx_qc_value_util.run, daemon=True).start()
    # --------启动交易----------
    huaxin_trade_api.run()