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

Function make_msg

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

adds the length prefix

(msgId:int, useRawIntMsgId: bool, text: str)

Source from the content-addressed store, hash-verified

23 return msg
24
25def make_msg(msgId:int, useRawIntMsgId: bool, text: str) -> bytes:
26 """adds the length prefix"""
27 if useRawIntMsgId:
28 text = msgId.to_bytes(4, 'big') + str.encode(text)
29 else:
30 text = str.encode(make_field(msgId) + text)
31
32 msg = struct.pack(f"!I{len(text)}s", len(text), text)
33 return msg
34
35def make_initial_msg(text: str) -> bytes:
36 """adds the length prefix"""

Callers

nothing calls this directly

Calls 2

make_fieldFunction · 0.85
encodeMethod · 0.65

Tested by

no test coverage detected