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

Method interpret

packages/ibkr/src/decoder/base.ts:42–65  ·  view source on GitHub ↗

* Dispatch a text-protocol message. * Mirrors: ibapi/decoder.py interpret()

(fields: string[], msgId?: number)

Source from the content-addressed store, hash-verified

40 * Mirrors: ibapi/decoder.py interpret()
41 */
42 interpret(fields: string[], msgId?: number): void {
43 if (msgId === undefined) {
44 msgId = parseInt(fields[0] || '0', 10)
45 }
46 if (msgId === 0) return
47
48 const handler = this.msgId2textHandler.get(msgId)
49 if (!handler) {
50 this.wrapper.error(NO_VALID_ID, currentTimeMillis(), UNKNOWN_ID.code(), UNKNOWN_ID.msg(), '')
51 return
52 }
53
54 try {
55 handler(this, fields[Symbol.iterator]())
56 } catch (e) {
57 if (e instanceof BadMessage) {
58 this.wrapper.error(
59 NO_VALID_ID, currentTimeMillis(),
60 BAD_MESSAGE.code(), BAD_MESSAGE.msg() + fields.join(','), '',
61 )
62 }
63 throw e
64 }
65 }
66
67 /**
68 * Dispatch a protobuf-encoded message.

Callers 1

onMessageMethod · 0.45

Calls 6

getMethod · 0.65
errorMethod · 0.65
currentTimeMillisFunction · 0.50
handlerFunction · 0.50
codeMethod · 0.45
msgMethod · 0.45

Tested by

no test coverage detected