| | |
| | | print("----L2行情登录成功----") |
| | | self.is_login = True |
| | | logger_system.info(f"L2行情登录成功") |
| | | # 初始设置值 |
| | | threading.Thread( |
| | | target=lambda: self.__process_codes_data(self.__get_latest_datas(), from_cache=True, delay=6.0), |
| | | daemon=True).start() |
| | | |
| | | def OnRspSubTransaction(self, pSpecificSecurity, pRspInfo, nRequestID, bIsLast): |
| | | async_log_util.info(logger_local_huaxin_l2_subscript, |
| | |
| | | |
| | | pipe_strategy = None |
| | | |
| | | |
| | | def test_add_codes(queue_r): |
| | | time.sleep(10) |
| | | # if value: |
| | | # if type(value) == bytes: |
| | | # value = value.decode("utf-8") |
| | | # data = json.loads(value) |
| | | # _type = data["type"] |
| | | # if _type == "listen_volume": |
| | | # volume = data["data"]["volume"] |
| | | # code = data["data"]["code"] |
| | | # spi.set_code_special_watch_volume(code, volume) |
| | | # elif _type == "l2_cmd": |
| | | # l2CommandManager.process_command(command_manager.CLIENT_TYPE_CMD_L2, None, data) |
| | | |
| | | time.sleep(2) |
| | | demo_datas = ["603002", |
| | | "002654", |
| | | "603701", |
| | | "002908"] |
| | | queue_r.put_nowait(json.dumps({"type": "l2_cmd", "data": demo_datas})) |
| | | time.sleep(10) |
| | | while True: |
| | | try: |
| | | spi.l2_data_upload_manager.add_l2_order_detail( |
| | | {'SecurityID': '603002', 'Price': 6.35, 'Volume': 275000, 'Side': "1", 'OrderType': '0', |
| | | 'OrderTime': '13000015', |
| | | 'MainSeq': 2, 'SubSeq': 6739147, 'OrderNO': 5512466, 'OrderStatus': 'D'}, 0) |
| | | spi.l2_data_upload_manager.add_l2_order_detail( |
| | | {'SecurityID': '603002', 'Price': 6.35, 'Volume': 200, 'Side': "1", 'OrderType': '0', |
| | | 'OrderTime': '13000015', |
| | | 'MainSeq': 2, 'SubSeq': 6739148, 'OrderNO': 5512467, 'OrderStatus': 'D'}, 0) |
| | | # queue_r.put_nowait(json.dumps({"type": "listen_volume", "data": {"code": "603002", "volume": 100}})) |
| | | time.sleep(0.1) |
| | | spi.l2_data_upload_manager.add_l2_order_detail( |
| | | {'SecurityID': '603002', 'Price': 6.35, 'Volume': 100, 'Side': "1", 'OrderType': '0', |
| | | 'OrderTime': '13000015', |
| | | 'MainSeq': 2, 'SubSeq': 6739148, 'OrderNO': 5512467, 'OrderStatus': 'D'}, 0) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | finally: |
| | | time.sleep(10) |
| | | |
| | | |
| | | def get_subscript_codes(): |
| | | """ |
| | | 获取需要订阅的代码 |
| | |
| | | codes = get_subscript_codes() |
| | | if codes: |
| | | break |
| | | except: |
| | | except Exception as e: |
| | | logger_system.exception(e) |
| | | time.sleep(5) |
| | | logger_system.info(f'可转债正股数量:{len(codes)}') |
| | | if codes: |
| | |
| | | pre_price_dict = get_pre_price(codes) |
| | | if pre_price_dict: |
| | | break |
| | | except: |
| | | except Exception as e: |
| | | logger_system.exception(e) |
| | | time.sleep(5) |
| | | logger_system.info(f'可转债正股昨日收盘价数量:{len(codes)}') |
| | | if pre_price_dict: |