Administrator
2024-08-20 83b7e1fd02287afea19f9f65158cb65a0d7bd6c6
L2测试
3个文件已修改
13 ■■■■■ 已修改文件
huaxin_client/l2_client.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin_trade_data_update.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/trade_strategy.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_client.py
@@ -270,7 +270,7 @@
        self.l2_data_upload_manager.add_l2_order_detail(item, 0)
    def OnRtnNGTSTick(self, pTick):
        # logger_debug.info(f"OnRtnNGTSTick: {pTick}")
        logger_debug.info(f"OnRtnNGTSTick: {pTick}")
        # 输出逐笔成交数据
        try:
            if pTick['TickType'] == b'T':
trade/huaxin_trade_data_update.py
@@ -43,6 +43,8 @@
                            huaxin_trade_record_manager.PositionManager.cache(datas)
                            # 获取持仓股的涨停价
                            position_codes = set()
                            # TODO 测试
                            position_codes.add("113565")
                            need_update_codes = []
                            for d in datas:
                                if d["prePosition"] > 0 and tool.is_can_sell_code(d["securityID"]):
trade/trade_strategy.py
@@ -333,12 +333,15 @@
                if not current_price:
                    raise Exception("尚未获取到现价")
                price = round(tool.get_buy_max_price(current_price), 3)
                result = huaxin_trade_api.order(1, code, volume, price, blocking=True, order_ref=order_ref)
                sinfo = f"b_{code}_{int(time.time()*1000)}"
                # 需要立即卖的数据
                # 下单之后需要立即卖出
                cb_data_util.need_sell_sinfos.add(sinfo)
                result = huaxin_trade_api.order(1, code, volume, price, blocking=True, order_ref=order_ref, sinfo = sinfo)
                if result:
                    if result["code"] == 0:
                        sinfo = result["data"]["sinfo"]
                        # 需要立即卖的数据
                        cb_data_util.need_sell_sinfos.add(sinfo)
                        pass
                        # 记录当前的sinfo
                async_log_util.info(logger_trade, f"API可转债买结果: {result}")
                self.send_response(result, client_id, request_id)