| | |
| | | # coding=utf-8 |
| | | from __future__ import print_function, absolute_import, unicode_literals |
| | | import logging |
| | | import multiprocessing |
| | | import threading |
| | | import time |
| | | |
| | |
| | | from strategy import kpl_api, data_cache, check_timer, all_K_line, instant_time_market, account_management, \ |
| | | order_methods, local_data_management, kpl_data_manager, market_sentiment_analysis, plate_strength_analysis, \ |
| | | selling_strategy |
| | | from huaxin_client import l2_market_client, l2_client |
| | | from huaxin_client import l2_market_client, l2_client, trade_client |
| | | from log_module import async_log_util, log |
| | | from trade import huaxin_trade_data_update, huaxin_trade_api |
| | | from utils import hx_qc_value_util, huaxin_util, juejin_api, tool |
| | |
| | | # 开启开盘啦 涨停列表 和 全盘个股概念板块 接口线程 |
| | | # 涨停概念线程 |
| | | # threading.Thread(target=plate_strength_analysis.kpl_limit_up_process, daemon=True).start() #该行代码为只运行单一线程不回调数据的方式 |
| | | threading.Thread(target=plate_strength_analysis.kpl_limit_up_process, args=(kpl_limit_up_process,), daemon=True).start() |
| | | threading.Thread(target=plate_strength_analysis.kpl_limit_up_process, args=(kpl_limit_up_process,), |
| | | daemon=True).start() |
| | | |
| | | # # 开盘啦的板块强度下的个股强度回调函数 |
| | | def get_market_sift_plate_its_stock_power_process(market_sift_plate_stock_dict): |
| | |
| | | |
| | | l2_data_callbacks = [] |
| | | |
| | | |
| | | # 订阅持仓L2数据 |
| | | def __subscript_position_l2(): |
| | | """ |
| | |
| | | # 第三步:执行策略的初始设置 |
| | | if __name__ == '__main__': |
| | | log.close_print() |
| | | |
| | | |
| | | class MyMarketDataCallback(l2_market_client.L2MarketDataCallback): |
| | | def on_markets(self, datas): |
| | | """ |
| | |
| | | # redis 数据同步 |
| | | threading.Thread(target=RedisUtils.run_loop, daemon=True).start() |
| | | |
| | | # 策略与交易通信队列 |
| | | queue_strategy_r_trade_w, queue_strategy_w_trade_r, queue_strategy_w_trade_for_query_r = multiprocessing.Queue(), multiprocessing.Queue(), multiprocessing.Queue() |
| | | |
| | | # 不是模拟盘的时候启动交易 |
| | | if not constant.IS_SIMULATED_TRADE: |
| | | multiprocessing.Process(target=trade_client.run, args=( |
| | | queue_strategy_r_trade_w, queue_strategy_w_trade_r, queue_strategy_w_trade_for_query_r,), |
| | | daemon=True).start() |
| | | |
| | | # 启动交易 |
| | | order_methods.run() |
| | | order_methods.run(queue_strategy_r_trade_w, queue_strategy_w_trade_r, queue_strategy_w_trade_for_query_r) |
| | | |
| | | # 运行华鑫增值服务进程,用于获取K线与交易日历 |
| | | threading.Thread(target=hx_qc_value_util.run, daemon=True).start() |