"""获取扩展行情实时五档报价。""" import struct from ...commands.base import BaseCommand from ..models import ExInstrumentQuote class GetExInstrumentQuoteCmd(BaseCommand[ExInstrumentQuote | None]): """获取单个商品的五档实时行情。""" def __init__(self, market: int, code: str) -> None: self.market = market self.code = code.encode("utf-8") def build_request(self) -> bytes: header = bytes.fromhex("01 01 08 02 02 01 0c 00 0c 00 fa 23") return header + struct.pack(" ExInstrumentQuote | None: if len(body) < 150: return None pos = 0 (market, raw_code) = struct.unpack("