| | |
| | | from strategy.strategy_variable_factory import DataLoader |
| | | from third_data.history_k_data_manager import TradeDateManager |
| | | from third_data.kpl_block_manager import KPLCodeJXBlocksManager |
| | | from trade import trade_record_log_util |
| | | from utils import socket_util, middle_api_protocol, tool |
| | | |
| | | |
| | |
| | | day = tool.get_now_date_str() |
| | | fdata["history_data"]["kpl_code_jx_blocks_count"] = env_info.get_kpl_code_jx_blocks(day) |
| | | |
| | | |
| | | return {"code": 0, "data": fdata, "msg": "测试结果"} |
| | | |
| | | def __on_update_leading_limit_up_datas(self): |
| | |
| | | codes |= set([x.decode() for x in codes_sz]) |
| | | KPLCodeJXBlocksManager(day, codes).start_download_blocks() |
| | | # 如果在16:00之前采用当前日期 |
| | | |
| | | day = tool.get_now_date_str() |
| | | threading.Thread(target=lambda: update(), daemon=True).start() |
| | | return {"code": 0} |
| | |
| | | elif ctype == 'init_datas': |
| | | # 初始化数据 |
| | | result_json = self.__on_init_data() |
| | | elif ctype == 'get_place_order_records': |
| | | # 获取下单记录 |
| | | datas = trade_record_log_util.get_trade_records(trade_record_log_util.TYPE_PLACE_ORDER) |
| | | result_json = {"code": 0, "data": datas} |
| | | |
| | | self.send_response(result_json, client_id, request_id) |
| | |
| | | |
| | | # 加载买入得分记录 |
| | | def load_trade_recod(code, date=tool.get_now_date_str()): |
| | | path = f"{constant.get_path_prefix()}/logs/gp/trade/trade_record.{date}.log" |
| | | path = f"{constant.get_path_prefix()}/ls_logs/gp/trade/trade_record.{date}.log" |
| | | fdatas = [] |
| | | lines = __load_file_content(path) |
| | | for line in lines: |
| | |
| | | |
| | | # 加载买入得分记录 |
| | | def load_trade_recod_by_type(type_, date=tool.get_now_date_str()): |
| | | path = f"{constant.get_path_prefix()}/logs/gp/trade/trade_record.{date}.log" |
| | | path = f"{constant.get_path_prefix()}/ls_logs/gp/trade/trade_record.{date}.log" |
| | | fdatas = [] |
| | | lines = __load_file_content(path) |
| | | for line in lines: |
| | |
| | | 更新领涨代码信息 |
| | | @return: |
| | | """ |
| | | print("*******更新领涨信息********") |
| | | |
| | | def update(): |
| | | plates = __DataLoader.get_limit_up_reasons_with_plate_code() |
| | | for p in plates: |
| | | print(p) |
| | | __DataLoader.load_plate_codes(p[0], p[1]) |
| | | |
| | | if tool.get_now_time_str() < '16:00:00': |
| | |
| | | day = tool.get_now_date_str() |
| | | schedule.every().day.at("08:05:00").do(lambda: KPLCodeJXBlocksManager(day, codes).start_download_blocks()) |
| | | schedule.every().day.at("08:10:00").do(lambda: update_leading_limit_up_datas()) |
| | | |
| | | while True: |
| | | try: |
| | | schedule.run_pending() |
| | |
| | | outside_api_callback.MyAPICallback()) |
| | | manager.run(blocking=False) |
| | | |
| | | # --------启动交易---------- |
| | | huaxin_trade_api.run() |
| | | |
| | | threading.Thread(target=test, daemon=True).start() |
| | | # test() |
| | | try: |
| | | # --------启动交易---------- |
| | | huaxin_trade_api.run() |
| | | except: |
| | | pass |
| | | |
| | | # ----初始化------------ |
| | | __init() |
| | |
| | | logger_system.exception(e) |
| | | |
| | | # -------启动L2 market订阅------ |
| | | __run_l2_market_subscript() |
| | | logger_system.info("系统结束") |
| | | try: |
| | | __run_l2_market_subscript() |
| | | logger_system.info("系统结束") |
| | | except: |
| | | pass |
| | |
| | | __LowSuctionOriginDataExportManager = LowSuctionOriginDataExportManager(day) |
| | | all_limit_up_list = __LowSuctionOriginDataExportManager.export_limit_up_list() |
| | | fdata["limit_up_list"] = {d[0][:8]: d[1] for d in all_limit_up_list} |
| | | big_order_deals = __LowSuctionOriginDataExportManager.export_big_order_deal(BIG_ORDER_MONEY_THRESHOLD, max_deal_space=3) |
| | | big_order_deals = __LowSuctionOriginDataExportManager.export_big_order_deal(BIG_ORDER_MONEY_THRESHOLD, |
| | | max_deal_space=3) |
| | | if not big_order_deals or IS_BY_BIG_ORDER: |
| | | big_order_deals = __LowSuctionOriginDataExportManager.export_big_order_deal_by(BIG_ORDER_MONEY_THRESHOLD) |
| | | # 转换格式为:{时间: [("代码", (买单号, 量, 金额, 时间, 最终成交价))] |
| | |
| | | "2025-05-30", "2025-06-03"] |
| | | days = ["2025-06-03", "2025-06-04", "2025-06-05", "2025-06-06", "2025-06-09", "2025-06-10", |
| | | "2025-06-11", "2025-06-12", "2025-06-13", "2025-06-16", "2025-06-17", "2025-06-18", "2025-06-19", |
| | | "2025-06-20","2025-06-23"] |
| | | "2025-06-20", "2025-06-23", "2025-06-24"] |
| | | |
| | | # days = ["2025-05-23"] |
| | | |
| | |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | info = PlaceOrderInfo(plates=set({'测试'})) |
| | | print(info.to_dict()) |
| | | add_place_order_log("000333", info) |
| | | datas = get_trade_records(TYPE_PLACE_ORDER) |
| | | print(len(datas)) |