LeavesQty (FIX tag 151)
LeavesQty (tag 151) is a Qty field defined in FIX 4.4 and FIX 4.2. It appears in 2 message types and is required in 2 of them.
At a glance
- Tag
- 151
- Name
- LeavesQty
- Datatype
- Qty (float)
- Dialects
- FIX 4.4 and FIX 4.2
- Messages
- 2
What the specification says
FIX 4.4
Quantity open for further execution. If the OrdStatus (39) is Canceled, DoneForTheDay, Expired, Calculated, or Rejected (in which case the order is no longer active) then LeavesQty could be 0, otherwise LeavesQty = OrderQty (38) – CumQty (4). (Prior to FIX 4.2 this field was of type int)
FIX 4.2
Amount of shares open for further execution. If the OrdStatus is Canceled, DoneForTheDay, Expired, Calculated, or Rejected (in which case the order is no longer active) then LeavesQty could be 0, otherwise LeavesQty = OrderQty - CumQty. (Prior to FIX 4.2 this field was of type int)
Descriptions are quoted from the FIX Orchestra sources under the Apache 2.0 licence.
A real message using tag 151
| Tag | Field | Wire value | Meaning |
|---|---|---|---|
| 8 | BeginString | FIX.4.4 | |
| 9 | BodyLength | 133 | |
| 35 | MsgType | 8 | Execution Report |
| 49 | SenderCompID | BOARTEAM | |
| 56 | TargetCompID | COUNTERPARTY | |
| 34 | MsgSeqNum | 2 | |
| 52 | SendingTime | 20240101-12:00:00.000 | |
| 37 | OrderID | ORD-10042 | |
| 17 | ExecID | EXEC-88117 | |
| 150 | ExecType | 0 | New |
| 39 | OrdStatus | 0 | New |
| 54 | Side | 1 | Buy |
| 151 | LeavesQty | 0 | |
| 14 | CumQty | 1000000 | |
| 6 | AvgPx | 1.09215 | |
| 10 | CheckSum | 025 |
Shown with | separators for readability. On the wire FIX uses SOH (0x01), an invisible control byte — and because BodyLength and CheckSum are computed over the actual bytes, the two forms have different checksums. Both are valid and both decode here.
Generated from the FIX 4.4 dictionary and verified at build time: it parses and validates with no issues. Open the decoder to try your own message.
Where tag 151 appears
Requiredness is a property of the message, not of the field: the same tag can be optional in one message and conditionally required in another.
| Message | MsgType | FIX 4.4 | FIX 4.2 | Where in the message |
|---|---|---|---|---|
| ExecutionReport | 8 | Required | Required | directly on the message body |
| ListStatus | N | Required | Required | inside the OrdListStatGrp component |
Wire format
A decimal quantity. Fractional quantities are legal, which is why this is a float family rather than an integer. @boarteam/fix parses the value as a number and reports parse/invalid-float when it does not lex as one; the raw string is kept so precision and trailing zeros are never lost.
Read tag 151 in TypeScript
import { createFixEngine } from "@boarteam/fix";import { dictionary } from "@boarteam/fix-dict-fix44";const fix = createFixEngine(dictionary);const { message, issues } = fix.parse(raw);const field = message.fields[151];field?.name; // "LeavesQty"field?.raw; // the verbatim wire stringfield?.value; // coerced to a numberOther Qty fields
Decode this in your own code
The same engine that produced the decoded example above is an Apache-2.0 npm package with zero runtime dependencies. It runs in Node and in the browser, and parse() returns problems as data instead of throwing.
npm i @boarteam/fix @boarteam/fix-dict-fix44