| | |
| | | # self.__upload_l2_data(code, upload_queue, temp_list) |
| | | # self.__upload_l2_order_data(code, temp_list) |
| | | __start_time = time.time() |
| | | last_data = temp_list[-1] |
| | | self.data_callback_distribute_manager.get_distributed_callback(code).OnL2Order(code, temp_list, |
| | | time.time()) |
| | | use_time = time.time() - __start_time |
| | | if use_time > 0.01: |
| | | # 记录10ms以上的数据 |
| | | huaxin_l2_log.info(logger_local_huaxin_l2_error, f"耗时:{use_time}s 结束数据:{temp_list[-1]}") |
| | | huaxin_l2_log.info(logger_local_huaxin_l2_error, f"耗时:{use_time}s 结束数据:{last_data}") |
| | | temp_list = [] |
| | | else: |
| | | if code not in self.temp_order_queue_dict: |
| | |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | finally: |
| | | pass |
| | | temp_list.clear() |
| | | |
| | | # 处理成交数据并上传 |
| | | def __run_upload_transaction_task(self, code): |
| | |
| | | except: |
| | | pass |
| | | finally: |
| | | pass |
| | | temp_list.clear() |
| | | |
| | | def __run_log_task(self, code): |
| | | q: queue.Queue = self.temp_log_queue_dict.get(code) |
New file |
| | |
| | | from trade.huaxin.huaxin_trade_server import TradeServerProcessor |
| | | from trade.sell.sell_rule_manager import TradeRuleManager |
| | | |
| | | if __name__ == "__main__": |
| | | datas = [["002148", 6.7, 0, 24308026, "09:30:09", 6.7, 3998474]] |
| | | rules = TradeServerProcessor.sell(datas) |
New file |
| | |
| | | from third_data.history_k_data_util import HistoryKDatasUtils |
| | | |
| | | if __name__ == "__main__": |
| | | code = "603617" |
| | | datas = HistoryKDatasUtils.get_history_tick_n(code, 60, "open,high,low,close,volume,pre_close,bob,amount") |
| | | print(datas) |
New file |
| | |
| | | import threading |
| | | |
| | | from l2.l2_transaction_data_manager import HuaXinSellOrderStatisticManager |
| | | from log_module import log_export, async_log_util |
| | | |
| | | if __name__ == "__main__": |
| | | code = "603363" |
| | | threading.Thread(target=async_log_util.run_sync, daemon=True).start() |
| | | map_ = log_export.load_huaxin_transaction_map() |
| | | for datas in map_[code]: |
| | | total_sell_info = HuaXinSellOrderStatisticManager.add_transaction_datas(code, datas) |
| | | if total_sell_info[0] > 0 and total_sell_info[1]: |
| | | print(total_sell_info) |
| | | input() |
New file |
| | |
| | | from log_module.async_log_util import huaxin_l2_log |
| | | from log_module.log import logger_local_huaxin_l2_error |
| | | |
| | | if __name__ == "__main__": |
| | | use_time = 0.02 |
| | | temp_list = ["123123"] |
| | | huaxin_l2_log.info(logger_local_huaxin_l2_error, f"耗时:{use_time}s 结束数据:{temp_list[-1]}") |
| | | huaxin_l2_log.run_sync() |
New file |
| | |
| | | import marshal |
| | | import multiprocessing |
| | | |
| | | if __name__ == '__main__': |
| | | bytes = marshal.dumps({"code": 1}) |
| | | queue = multiprocessing.Queue() |
| | | queue.put_nowait(bytes) |
| | | d=queue.get() |
| | | print(marshal.loads(d)) |