Administrator
2024-03-28 4b116fdec0f32b32c14ca25a589facb944f98e83
bug修复
1个文件已修改
5个文件已添加
50 ■■■■■ 已修改文件
huaxin_client/l2_data_manager.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test_huaxin.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test_juejin.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test_l2.py 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test_log.py 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test_marshal.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_data_manager.py
@@ -179,12 +179,13 @@
                    # 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:
@@ -196,7 +197,7 @@
            except Exception as e:
                logging.exception(e)
            finally:
                pass
                temp_list.clear()
    # 处理成交数据并上传
    def __run_upload_transaction_task(self, code):
@@ -224,7 +225,7 @@
            except:
                pass
            finally:
                pass
                temp_list.clear()
    def __run_log_task(self, code):
        q: queue.Queue = self.temp_log_queue_dict.get(code)
test/test_huaxin.py
New file
@@ -0,0 +1,6 @@
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)
test/test_juejin.py
New file
@@ -0,0 +1,6 @@
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)
test/test_l2.py
New file
@@ -0,0 +1,14 @@
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()
test/test_log.py
New file
@@ -0,0 +1,8 @@
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()
test/test_marshal.py
New file
@@ -0,0 +1,9 @@
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))