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

Function decodeExecutionFromProto

packages/ibkr/src/decoder/execution.ts:88–115  ·  view source on GitHub ↗
(ep: ExecutionProtoType)

Source from the content-addressed store, hash-verified

86}
87
88function decodeExecutionFromProto(ep: ExecutionProtoType): Execution {
89 const execution = new Execution()
90 if (ep.orderId !== undefined) execution.orderId = ep.orderId
91 if (ep.clientId !== undefined) execution.clientId = ep.clientId
92 if (ep.execId !== undefined) execution.execId = ep.execId
93 if (ep.time !== undefined) execution.time = ep.time
94 if (ep.acctNumber !== undefined) execution.acctNumber = ep.acctNumber
95 if (ep.exchange !== undefined) execution.exchange = ep.exchange
96 if (ep.side !== undefined) execution.side = ep.side
97 if (ep.shares !== undefined) execution.shares = new Decimal(ep.shares)
98 if (ep.price !== undefined) execution.price = ep.price
99 if (ep.permId !== undefined) execution.permId = ep.permId
100 if (ep.isLiquidation !== undefined) execution.liquidation = ep.isLiquidation ? 1 : 0
101 if (ep.cumQty !== undefined) execution.cumQty = new Decimal(ep.cumQty)
102 if (ep.avgPrice !== undefined) execution.avgPrice = ep.avgPrice
103 if (ep.orderRef !== undefined) execution.orderRef = ep.orderRef
104 if (ep.evRule !== undefined) execution.evRule = ep.evRule
105 if (ep.evMultiplier !== undefined) execution.evMultiplier = ep.evMultiplier
106 if (ep.modelCode !== undefined) execution.modelCode = ep.modelCode
107 if (ep.lastLiquidity !== undefined) execution.lastLiquidity = ep.lastLiquidity
108 if (ep.isPriceRevisionPending !== undefined) execution.pendingPriceRevision = ep.isPriceRevisionPending
109 if (ep.submitter !== undefined) execution.submitter = ep.submitter
110 if (ep.optExerciseOrLapseType !== undefined) {
111 const entry = Object.values(OptionExerciseType).find((e) => e.value === ep.optExerciseOrLapseType)
112 if (entry) execution.optExerciseOrLapseType = entry
113 }
114 return execution
115}
116
117// ---------------------------------------------------------------------------
118// Public: register all execution handlers

Callers 1

applyExecutionHandlersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected