MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / make_msg_proto

Function make_msg_proto

packages/ibkr/ref/source/pythonclient/ibapi/comm.py:19–23  ·  view source on GitHub ↗

adds the length prefix

(msgId: int, protobufData: bytes)

Source from the content-addressed store, hash-verified

17logger = logging.getLogger(__name__)
18
19def make_msg_proto(msgId: int, protobufData: bytes) -> bytes:
20 """adds the length prefix"""
21 byteArray = msgId.to_bytes(4, 'big') + protobufData
22 msg = struct.pack(f"!I{len(byteArray)}s", len(byteArray), byteArray)
23 return msg
24
25def make_msg(msgId:int, useRawIntMsgId: bool, text: str) -> bytes:
26 """adds the length prefix"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected