Administrator
2024-03-13 02c91a4afceca47e22ffaef219ecaff1004f179c
更改序列化传输方式
4个文件已修改
24 ■■■■■ 已修改文件
huaxin_client/l2_data_manager.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/huaxin/huaxin_delegate_postion_manager.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_listen_manager.py 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_api.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_data_manager.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import json
import logging
import marshal
import multiprocessing
import queue
import threading
@@ -160,7 +161,7 @@
            self.upload_l2_data_task_dict.pop(code)
    def __upload_l2_data(self, code, _queue, datas):
        _queue.put_nowait((code, datas, time.time()))
        _queue.put_nowait(marshal.dumps([code, datas, time.time()]))
    # 处理订单数据并上传
    def __run_upload_order_task(self, code):
l2/huaxin/huaxin_delegate_postion_manager.py
@@ -221,7 +221,7 @@
                        # 下单时间不一致
                        need_update = True
                    if not need_update and real_place_index_data["val"]["num"] != volume:
                    if not need_update and real_place_index_data["val"]["num"] != volume//100:
                        # 下单量不一致
                        need_update = True
@@ -267,7 +267,7 @@
                                    continue
                                if not L2DataUtil.is_limit_up_price_buy(val):
                                    continue
                                if volume != val["num"]:
                                if volume//100 != val["num"]:
                                    continue
                                left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(
                                    code,
l2/l2_data_listen_manager.py
@@ -1,6 +1,7 @@
"""
L2数据监听
"""
import marshal
import multiprocessing
import threading
import time
@@ -33,11 +34,12 @@
        while True:
            # datas_dict = {}
            try:
                if not q.empty():
                    item = q.get()
                    self.my_l2_data_callback.OnL2Order(item[0], item[1], item[2])
                else:
                    time.sleep(0.001)
                # if not q.empty():
                item = q.get()
                item = marshal.loads(item)
                self.my_l2_data_callback.OnL2Order(item[0], item[1], item[2])
                # else:
                #     time.sleep(0.001)
                # while not q.empty():
                #     item = q.get()
@@ -78,6 +80,7 @@
                #     time.sleep(0.01)
                if not q.empty():
                    item = q.get()
                    item = marshal.loads(item)
                    self.my_l2_data_callback.OnL2Transaction(item[0], item[1])
                else:
                    time.sleep(0.005)
third_data/kpl_api.py
@@ -213,6 +213,7 @@
    blocks = []
    try:
        _bks = __getConceptJXBK(code)
        print(_bks)
        if _bks:
            blocks.extend(_bks)
    except:
@@ -220,6 +221,7 @@
    try:
        _bks = __getConceptBK(code)
        print(_bks)
        if _bks:
            blocks.extend(_bks)
    except:
@@ -259,4 +261,4 @@
if __name__ == "__main__":
    print(getCodeBlocks("600822"))
    print(getCodeBlocks("002350"))