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

Function decodeFloat

packages/ibkr/src/utils.ts:63–73  ·  view source on GitHub ↗
(fields: Iterator<string>, showUnset = false)

Source from the content-addressed store, hash-verified

61}
62
63export function decodeFloat(fields: Iterator<string>, showUnset = false): number {
64 const r = fields.next()
65 if (r.done) throw new BadMessage('no more fields')
66 const s = r.value
67 if (s === INFINITY_STR) return DOUBLE_INFINITY
68 if (showUnset) {
69 if (s === null || s === undefined || s.length === 0) return UNSET_DOUBLE
70 return parseFloat(s)
71 }
72 return parseFloat(s || '0')
73}
74
75export function decodeBool(fields: Iterator<string>): boolean {
76 const r = fields.next()

Callers 15

decodeContractFieldsMethod · 0.85
decodePercentOffsetMethod · 0.85
decodeBoxOrderParamsMethod · 0.85
skipNbboPriceCapMethod · 0.85
decodeVolOrderParamsMethod · 0.85
decodeBasisPointsMethod · 0.85
decodeComboLegsMethod · 0.85
decodeDeltaNeutralMethod · 0.85

Calls 1

nextMethod · 0.80

Tested by

no test coverage detected