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

Function decodeContractFromProto

packages/ibkr/src/decoder/misc.ts:102–116  ·  view source on GitHub ↗
(cp: ContractProto)

Source from the content-addressed store, hash-verified

100// ---------------------------------------------------------------------------
101
102function decodeContractFromProto(cp: ContractProto): Contract {
103 const contract = new Contract()
104 if (cp.conId !== undefined) contract.conId = cp.conId
105 if (cp.symbol !== undefined) contract.symbol = cp.symbol
106 if (cp.secType !== undefined)
107 if (cp.lastTradeDateOrContractMonth !== undefined) contract.lastTradeDateOrContractMonth = cp.lastTradeDateOrContractMonth
108 if (cp.strike !== undefined) contract.strike = cp.strike
109 if (cp.right !== undefined) contract.right = cp.right
110 if (cp.multiplier !== undefined) contract.multiplier = String(cp.multiplier)
111 if (cp.exchange !== undefined) contract.exchange = cp.exchange
112 if (cp.currency !== undefined) contract.currency = cp.currency
113 if (cp.localSymbol !== undefined) contract.localSymbol = cp.localSymbol
114 if (cp.tradingClass !== undefined) contract.tradingClass = cp.tradingClass
115 return contract
116}
117
118function decodeSoftDollarTierFromProto(p: SoftDollarTierProto): SoftDollarTier {
119 return new SoftDollarTier(

Callers 1

applyMiscHandlersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected