Files
Encelado/DesktopBot/Documents/Alpaca/fix-messages.md
T
2026-06-09 18:29:41 +02:00

2920 lines
59 KiB
Markdown

# FIX Specification
This document describes the implementation of the FIX 4.2 protocol used by Alpaca to enable order entry via FIX.
Version 1.1.0
## Supported Message Types
| Message | MsgType | Description |
| --------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------- |
| [Logon](#logon-a) | A | Sent by FIX client to authenticate and establish the FIX session |
| [Heartbeat](#heartbeat-0) | 0 | Sent by either client or server at preset interval within the working FIX session |
| [Test Request](#test-request-1) | 1 | Sent to force a heartbeat from the opposing application |
| [Resend Request](#resend-request-2) | 2 | To request retransmission of messages which were missed |
| [Reject](#reject-3) | 3 | Response to a message that could not be processed |
| [Sequence Reset](#sequence-reset-4) | 4 | To reset the FIX session sequence number |
| [Logout](#logout-5) | 5 | To safely disconnect the connected FIX session |
| [New Order - Single](#new-order---single-d) | D | To submit a new single order (equity or single-leg option) |
| [New Order - Multileg](#new-order---multileg-ab) | AB | To submit a new multi-leg order (e.g. option spreads, covered calls) |
| [Execution Report](#execution-report-8) | 8 | Sent whenever the state of the order changes |
| [Order Cancel Request](#order-cancel-request-f) | F | To request cancellation of an order (single-leg or multileg) |
| [Order Cancel/Replace Request](#order-cancelreplace-request-g) | G | To request modification of a single-leg order |
| [Multileg Order Cancel/Replace Request](#multileg-order-cancelreplace-request-ac) | AC | To request modification of a multi-leg order |
| [Order Cancel Reject](#order-cancel-reject-9) | 9 | Sent if a cancel or cancel/replace request (F, G, or AC) could not be executed |
## Message Header
All messages should contain the following tags in the header:
| Tag | Field | Mandatory | Description |
| --- | ------------ | --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| 8 | BeginString | Y | FIX.4.2 |
| 9 | BodyLength | Y | Size of the message body in bytes |
| 34 | MsgSeqNum | Y | Message sequence number |
| 35 | MsgType | Y | Message type, should be one of the types supported in this doc |
| 49 | SenderCompID | Y | Provided by Alpaca, must be present in all FIX messages. This will be returned as TargetCompID (56) in all FIX messages to clients |
| 52 | SendingTime | Y | UTC timestamp of message transmission. Precision supported: Millis, Micros, Nanos |
| 56 | TargetCompID | Y | Provided by Alpaca, must be present in all FIX messages. This will be returned as SenderCompID (49) in all FIX messages to clients |
## Message Trailer
All messages should contain the following tags in the trailer:
| Tag | Field | Mandatory | Description |
| --- | -------- | --------- | ------------------------------------------------------------------------------------------------------ |
| 10 | CheckSum | Y | Last field in the messages with trailing `<SOH>`. Value calculated by the FIX engine from message data |
## Logon (A)
| Tag | Field | Mandatory | Description |
| :-- | :-------------- | :-------- | :----------------------------------------------------- |
| 35 | MsgType | Y | A - For Logon |
| 98 | EncryptMethod | Y | 0 - None, only accepted value |
| 108 | HeartBtInt | Y | Must be set to `30` for 30 seconds |
| 141 | ResetSeqNumFlag | N | Y - Resets both sender and target sequence number to 1 |
**Example FIX Message**
```text Logon (A)
|8=FIX.4.2|9=73|35=A|34=1|49=SENDER|52=20240524-16:02:42.003|56=ALPACA|98=0|108=30|141=Y|10=131|
```
## Heartbeat (0)
Sent by either client or server if no message has been received since the last heartbeat interval. This is also sent in response to a Test Request (1).
| Tag | Field | Mandatory | Description |
| --- | --------- | --------- | ---------------------------------------------------------------------- |
| 35 | MsgType | Y | 0 - For Heartbeat |
| 112 | TestReqID | N | Required only when Heartbeat is sent in response to a Test Request (1) |
**Example FIX Message**
```text Heartbeat
|8=FIX.4.2|9=91|35=0|49=SENDER|56=ALPACA|34=2|52=20230330-16:52:321.029|10=049|
```
## Test Request (1)
May be sent by either client or server, to force a Heartbeat (0) from the other party.
| Tag | Field | Mandatory | Description |
| --- | --------- | --------- | -------------------------------------------------------- |
| 35 | MsgType | Y | 1 - For Test Request |
| 112 | TestReqID | Y | Identifier to be returned in the resulting Heartbeat (0) |
**Example FIX Message**
```text Test Request
|8=FIX.4.2|9=91|35=1|49=SENDER|56=ALPACA|34=2|52=20230330-16:52:321.029|112=TEST|10=049|
```
## Resend Request (2)
Sent to request retransmission of messages which were missed.
| Tag | Field | Mandatory | Description |
| --- | ---------- | --------- | ----------------------------------------------- |
| 35 | MsgType | Y | 2 - For Resend Request |
| 7 | BeginSeqNo | Y | Beginning sequence number of requested messages |
| 16 | EndSeqNo | Y | Ending sequence number of requested messages |
**Example FIX Message**
```text Resend Request
|8=FIX.4.2|9=66|7=9|16=36|34=12|35=2|49=SENDER|52=20230627-14:10:21.769|56=ALPACA|10=126|
```
## Reject (3)
Sent when a message is rejected or cannot be processed by the FIX server.
<Table align={["left","left","left","left"]}>
<thead>
<tr>
<th>
Tag
</th>
<th>
Field
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
35
</td>
<td>
MsgType
</td>
<td>
Y
</td>
<td>
3 - For Reject
</td>
</tr>
<tr>
<td>
45
</td>
<td>
RefSeqNum
</td>
<td>
Y
</td>
<td>
Sequence number of the rejected message
</td>
</tr>
<tr>
<td>
58
</td>
<td>
Text
</td>
<td>
N
</td>
<td>
Reason for rejection
</td>
</tr>
<tr>
<td>
371
</td>
<td>
RefTagID
</td>
<td>
N
</td>
<td>
The tag number of the FIX field being referenced
</td>
</tr>
<tr>
<td>
372
</td>
<td>
RefMsgType
</td>
<td>
N
</td>
<td>
The MsgType (35) of the FIX message being referenced
</td>
</tr>
<tr>
<td>
373
</td>
<td>
SessionRejectReason
</td>
<td>
N
</td>
<td>
Reject reason codes.\
0 - Invalid tag number\
1 - Required tag missing\
2 - Tag not defined for this message type\
3 - Unsupported Message Type\
4 - Tag specified without a value\
5 - Value is incorrect (out of range) for this tag\
6 - Incorrect data format for value\
9 - CompID problem\
10 - SendingTime accuracy problem\
11 - Invalid MsgType
</td>
</tr>
</tbody>
</Table>
**Example FIX Message**
```text Reject
|8=FIX.4.2|9=0134|35=3|34=44196|49=ALPACA|56=TARGET|52=20230330-20:18:38.039|58=0005 Tag specified without a value|45=44196|371=11|372=8|373=4|10=092|
```
## Sequence Reset (4)
Sent to reset the incoming sequence number on the other side. The sequence reset should be used only to increase the sequence number. Any request to decrease the sequence number will result in a Reject (3) message.
<Table align={["left","left","left","left"]}>
<thead>
<tr>
<th>
Tag
</th>
<th>
Field
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
35
</td>
<td>
MsgType
</td>
<td>
Y
</td>
<td>
4 - For Sequence Reset
</td>
</tr>
<tr>
<td>
36
</td>
<td>
NewSeqNo
</td>
<td>
Y
</td>
<td>
New sequence number
</td>
</tr>
<tr>
<td>
123
</td>
<td>
GapFillFlag
</td>
<td>
N
</td>
<td>
N - Sequence reset to recover from an out-of-sequence condition, MsgSeqNum(34) is ignored\
Y - Gap fill message, MsgSeqNum(34) field must be valid
</td>
</tr>
</tbody>
</Table>
**Example FIX Message**
```text Sequence Reset
|8=FIX.4.2|9=61|34=12|35=4|36=9|49=SENDER|52=20230627-14:14:51.732|56=ALPACA|10=156|
```
## Logout (5)
May be sent by either client or server, to terminate the session. The other party would respond with a confirming Logout message as an acknowledgement.
| Tag | Field | Mandatory | Description |
| --- | ------- | --------- | -------------- |
| 35 | MsgType | Y | 5 - For Logout |
**Example FIX Message**
```text Logout
|8=FIX.4.2|9=56|34=12|35=5|49=SENDER|52=20230627-14:16:50.690|56=ALPACA|10=197|
```
## New Order - Single (D)
Sent by the client to submit a new single order.
<Table align={["left","left","left","left"]}>
<thead>
<tr>
<th>
Tag
</th>
<th>
Field
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
35
</td>
<td>
MsgType
</td>
<td>
Y
</td>
<td>
D - For New Order - Single
</td>
</tr>
<tr>
<td>
1
</td>
<td>
Account
</td>
<td>
Y
</td>
<td>
Account number
</td>
</tr>
<tr>
<td>
11
</td>
<td>
ClOrdID
</td>
<td>
Y
</td>
<td>
Unique identifier of the order assigned by the client (must be no longer than 48 characters)
</td>
</tr>
<tr>
<td>
12
</td>
<td>
Commission
</td>
<td>
N
</td>
<td>
Commission to collect from the account holder
</td>
</tr>
<tr>
<td>
13
</td>
<td>
CommType
</td>
<td>
N
</td>
<td>
1 - per share\
2 - percentage, 5% should be represented as .05\
3 - absolute
</td>
</tr>
<tr>
<td>
18
</td>
<td>
ExecInst
</td>
<td>
N
</td>
<td>
1 - Not held\
5 - Held
</td>
</tr>
<tr>
<td>
21
</td>
<td>
HandlInst
</td>
<td>
Y
</td>
<td>
1 - Automated execution with no broker intervention, only accepted value
</td>
</tr>
<tr>
<td>
38
</td>
<td>
OrderQty
</td>
<td>
N
</td>
<td>
Number of shares to trade, required if CashOrderQty (152) is not set
</td>
</tr>
<tr>
<td>
40
</td>
<td>
OrdType
</td>
<td>
Y
</td>
<td>
1 - Market\
2 - Limit\
3 - Stop\
4 - Stop limit\
5 - Market on close\
B - Limit on close
</td>
</tr>
<tr>
<td>
44
</td>
<td>
Price
</td>
<td>
N
</td>
<td>
Required for Limit `40=2` and Stop Limit `40=4` orders
</td>
</tr>
<tr>
<td>
54
</td>
<td>
Side
</td>
<td>
Y
</td>
<td>
1 - Buy\
2 - Sell
</td>
</tr>
<tr>
<td>
55
</td>
<td>
Symbol
</td>
<td>
Y
</td>
<td>
Ticker symbol
</td>
</tr>
<tr>
<td>
59
</td>
<td>
TimeInForce
</td>
<td>
Y
</td>
<td>
0 - Day (day)\
1 - Good Till Cancel (gtc)\
2 - At the Opening (opg)\
3 - Immediate or Cancel (ioc)\
4 - Fill or Kill (fok)\
7 - At the Close (cls)
</td>
</tr>
<tr>
<td>
60
</td>
<td>
TransactTime
</td>
<td>
Y
</td>
<td>
UTC timestamp of order creation by client
</td>
</tr>
<tr>
<td>
77
</td>
<td>
OpenClose
</td>
<td>
N
</td>
<td>
Indicates whether the resulting position from the trade would be an opening or closing position.\
O - Open\
C - Close
</td>
</tr>
<tr>
<td>
99
</td>
<td>
StopPx
</td>
<td>
N
</td>
<td>
Required for Stop `40=3` and Stop Limit `40=4` orders
</td>
</tr>
<tr>
<td>
109
</td>
<td>
ClientID
</td>
<td>
N
</td>
<td>
Sub-account tag for omnibus accounts
</td>
</tr>
<tr>
<td>
152
</td>
<td>
CashOrderQty
</td>
<td>
N
</td>
<td>
Notional value to trade, required if OrderQty (38) is not set
</td>
</tr>
<tr>
<td>
336
</td>
<td>
TradingSessionID
</td>
<td>
N
</td>
<td>
8 - Extended Hours\
Required for extended hours orders only
</td>
</tr>
<tr>
<td>
167
</td>
<td>
SecurityType
</td>
<td>
N
</td>
<td>
CS - Common Stock (default when absent)\
OPT - Option\
Required to be `OPT` to submit a single-leg option order
</td>
</tr>
<tr>
<td>
200
</td>
<td>
MaturityMonthYear
</td>
<td>
N
</td>
<td>
Expiration month and year in `YYYYMM` format.\
Required when `167=OPT`
</td>
</tr>
<tr>
<td>
201
</td>
<td>
PutOrCall
</td>
<td>
N
</td>
<td>
0 - Put\
1 - Call\
Required when `167=OPT`
</td>
</tr>
<tr>
<td>
202
</td>
<td>
StrikePrice
</td>
<td>
N
</td>
<td>
Strike price of the option contract (up to 3 decimal places).\
Required when `167=OPT`
</td>
</tr>
<tr>
<td>
205
</td>
<td>
MaturityDay
</td>
<td>
N
</td>
<td>
Expiration day of month (1-31).\
Required when `167=OPT`
</td>
</tr>
</tbody>
</Table>
**Notes on single-leg option orders**
* When `SecurityType (167) = OPT`, the option contract is identified by the combination of `Symbol (55)` (underlying root, e.g. `AAPL`), `MaturityMonthYear (200)`, `MaturityDay (205)`, `PutOrCall (201)` and `StrikePrice (202)`.
* `OpenClose (77)` should be supplied to disambiguate the position effect (open vs. close). When omitted, position intent is inferred from `Side (54)`: `Buy` → buy-to-open, `Sell` → sell-to-close, `Sell Short (5)` → sell-to-open.
* Option execution reports echo back `SecurityType`, `MaturityMonthYear`, `MaturityDay`, `PutOrCall` and `StrikePrice` along with the standard fields.
**Example FIX Messages**
```text Market order (quantity based)
|8=FIX.4.2|9=139|1=TEST_ACCOUNT|11=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|34=12|35=D|38=10|40=1|49=SENDER|52=20230613-14:01:37.330|54=1|55=SPY|56=ALPACA|59=1|10=030|
```
```text Market order (notional based)
|8=FIX.4.2|9=141|1=TEST_ACCOUNT|11=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|34=12|35=D|40=1|49=SENDER|52=20230613-14:43:47.572|54=1|55=SPY|56=ALPACA|59=0|152=100|10=130|
```
```text Limit order
|8=FIX.4.2|9=149|1=TEST_ACCOUNT|11=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|34=12|35=D|38=10|40=2|44=350.78|49=SENDER|52=20230613-14:45:58.303|54=1|55=SPY|56=ALPACA|59=0|10=005|
```
```text Stop order
|8=FIX.4.2|9=149|1=TEST_ACCOUNT|11=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|34=12|35=D|38=10|40=3|49=SENDER|52=20230613-14:50:51.223|54=1|55=SPY|56=ALPACA|59=0|99=350.78|10=006|
```
```text Stop limit order
|8=FIX.4.2|9=159|1=TEST_ACCOUNT|11=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|34=12|35=D|38=10|40=4|44=350.78|49=SENDER|52=20230613-15:26:35.992|54=1|55=SPY|56=ALPACA|59=0|99=350.78|10=246|
```
```text Extended Hours Order
|8=FIX.4.2|9=149|1=TEST_ACCOUNT|11=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|34=12|35=D|38=10|40=2|44=350.78|49=SENDER|52=20230613-14:45:58.303|54=1|55=SPY|56=ALPACA|59=5|10=005|
```
```text Option order (Buy-to-Open 2 META Jan-17-2025 100 Call @ limit 2.15)
|8=FIX.4.2|9=185|1=TEST_ACCOUNT|11=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|34=12|35=D|38=2|40=2|44=2.15|49=SENDER|52=20240910-14:45:58.303|54=1|55=META|56=ALPACA|59=0|60=20240910-14:45:58.303|77=O|167=OPT|200=202501|201=1|202=100|205=17|10=011|
```
## Execution Report (8)
Sent by the server whenever an order receives an update. Each execution report contains field OrdStatus (39) which is used to convey the current status of the order as understood by Alpaca, as well as fields ExecType (150) and ExecTransType (20) which describe the purpose of the message.
<Table align={["left","left","left","left"]}>
<thead>
<tr>
<th>
Tag
</th>
<th>
Field
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
35
</td>
<td>
MsgType
</td>
<td>
Y
</td>
<td>
8 - For Execution Report
</td>
</tr>
<tr>
<td>
1
</td>
<td>
Account
</td>
<td>
Y
</td>
<td>
Account number
</td>
</tr>
<tr>
<td>
6
</td>
<td>
AvgPx
</td>
<td>
Y
</td>
<td>
Average price of all fills on this order
</td>
</tr>
<tr>
<td>
11
</td>
<td>
ClOrdID
</td>
<td>
Y
</td>
<td>
Unique identifier of the order as assigned by the client
</td>
</tr>
<tr>
<td>
12
</td>
<td>
Commission
</td>
<td>
N
</td>
<td>
Monetary commission value charged on a fill/partial fill
</td>
</tr>
<tr>
<td>
14
</td>
<td>
CumQty
</td>
<td>
Y
</td>
<td>
Filled quantity on the order
</td>
</tr>
<tr>
<td>
15
</td>
<td>
Currency
</td>
<td>
N
</td>
<td>
Account base currency, default USD
</td>
</tr>
<tr>
<td>
17
</td>
<td>
ExecID
</td>
<td>
Y
</td>
<td>
Unique identifier of the execution assigned by Alpaca
</td>
</tr>
<tr>
<td>
19
</td>
<td>
ExecRefID
</td>
<td>
N
</td>
<td>
ExecID (17) of the original execution being canceled or corrected when `20=1` or `20=2`
</td>
</tr>
<tr>
<td>
20
</td>
<td>
ExecTransType
</td>
<td>
Y
</td>
<td>
Transaction type.\
0 - New\
1 - Cancel\
2 - Correct\
3 - Status, for Restated (D) message upon stop trigger
</td>
</tr>
<tr>
<td>
30
</td>
<td>
LastMkt
</td>
<td>
N
</td>
<td>
Market of execution for this fill
</td>
</tr>
<tr>
<td>
31
</td>
<td>
LastPx
</td>
<td>
N
</td>
<td>
Price of this fill
</td>
</tr>
<tr>
<td>
32
</td>
<td>
LastShares
</td>
<td>
N
</td>
<td>
Quantity traded on this fill
</td>
</tr>
<tr>
<td>
37
</td>
<td>
OrderID
</td>
<td>
Y
</td>
<td>
Unique identifier of the order assigned by Alpaca
</td>
</tr>
<tr>
<td>
38
</td>
<td>
OrderQty
</td>
<td>
N
</td>
<td>
Either CashOrderQty (152) or OrderQty (38) is provided
</td>
</tr>
<tr>
<td>
39
</td>
<td>
OrdStatus
</td>
<td>
Y
</td>
<td>
Identifies current status of order.\
0 - New\
1 - Partially filled\
2 - Filled\
3 - Done for day\
4 - Canceled\
5 - Replaced\
6 - Pending Cancel\
8 - Rejected\
A - Pending New\
C - Expired\
E - Pending Replace
</td>
</tr>
<tr>
<td>
40
</td>
<td>
OrdType
</td>
<td>
N
</td>
<td>
Same as specified on the order.\
1 - Market\
2 - Limit\
3 - Stop\
4 - Stop limit\
5 - Market on close\
B - Limit on close
</td>
</tr>
<tr>
<td>
41
</td>
<td>
OrigClOrdID
</td>
<td>
N
</td>
<td>
ClOrdID (11) of the original order in cancel and cancel/replace requests
</td>
</tr>
<tr>
<td>
44
</td>
<td>
Price
</td>
<td>
N
</td>
<td>
Sent when specified on the order
</td>
</tr>
<tr>
<td>
54
</td>
<td>
Side
</td>
<td>
Y
</td>
<td>
1 - Buy\
2 - Sell
</td>
</tr>
<tr>
<td>
55
</td>
<td>
Symbol
</td>
<td>
Y
</td>
<td>
Ticker symbol
</td>
</tr>
<tr>
<td>
58
</td>
<td>
Text
</td>
<td>
N
</td>
<td>
Contains reject reason when `150=8`
</td>
</tr>
<tr>
<td>
59
</td>
<td>
TimeInForce
</td>
<td>
N
</td>
<td>
Same as specified on the order.\
0 - Day (day)\
1 - Good Till Cancel (gtc)\
2 - At the Opening (opg)\
3 - Immediate or Cancel (ioc)\
4 - Fill or Kill (fok)\
7 - At the Close (cls)
</td>
</tr>
<tr>
<td>
60
</td>
<td>
TransactTime
</td>
<td>
N
</td>
<td>
Server time in UTC when execution occurred, nanoseconds precision
</td>
</tr>
<tr>
<td>
99
</td>
<td>
StopPx
</td>
<td>
N
</td>
<td>
Sent when specified on the order
</td>
</tr>
<tr>
<td>
150
</td>
<td>
ExecType
</td>
<td>
Y
</td>
<td>
Describes the type of execution report.\
0 - New\
1 - Partial fill\
2 - Fill\
3 - Done for day\
4 - Canceled\
5 - Replaced\
6 - Pending Cancel, ack for Order Cancel Request (F)\
8 - Rejected\
A - Pending New\
C - Expired\
D - Restated, for stop price triggers\
E - Pending Replace, ack for Order Cancel/Replace Request (G)
</td>
</tr>
<tr>
<td>
151
</td>
<td>
LeavesQty
</td>
<td>
Y
</td>
<td>
Unfilled quantity on the order. When order is closed (filled, done for day, canceled, replaced, rejected, expired) value could be 0
</td>
</tr>
<tr>
<td>
152
</td>
<td>
CashOrderQty
</td>
<td>
N
</td>
<td>
Either CashOrderQty (152) or OrderQty (38) is provided. Specifies the notional amount conveyed on the order
</td>
</tr>
<tr>
<td>
378
</td>
<td>
ExecRestatementReason
</td>
<td>
N
</td>
<td>
Populated when ExecType (150) = Restated (D).\
100 - Stop triggered, for stop and stop limit orders
</td>
</tr>
<tr>
<td>
77
</td>
<td>
OpenClose
</td>
<td>
N
</td>
<td>
Position effect of the execution.\
O - Open\
C - Close\
Always populated on leg execution reports for multileg orders
</td>
</tr>
<tr>
<td>
167
</td>
<td>
SecurityType
</td>
<td>
N
</td>
<td>
CS - Common Stock\
OPT - Option\
MLEG - Multileg Instrument (parent execution reports of multileg orders)
</td>
</tr>
<tr>
<td>
200
</td>
<td>
MaturityMonthYear
</td>
<td>
N
</td>
<td>
Populated for option executions (`167=OPT`)
</td>
</tr>
<tr>
<td>
201
</td>
<td>
PutOrCall
</td>
<td>
N
</td>
<td>
Populated for option executions (`167=OPT`).\
0 - Put\
1 - Call
</td>
</tr>
<tr>
<td>
202
</td>
<td>
StrikePrice
</td>
<td>
N
</td>
<td>
Populated for option executions (`167=OPT`)
</td>
</tr>
<tr>
<td>
205
</td>
<td>
MaturityDay
</td>
<td>
N
</td>
<td>
Populated for option executions (`167=OPT`)
</td>
</tr>
<tr>
<td>
442
</td>
<td>
MultiLegReportingType
</td>
<td>
N
</td>
<td>
Set only on executions emitted from multileg parent orders.\
2 - Individual leg of a multi-leg security (one execution report per leg)\
3 - Multi-leg security (parent-level execution report)
</td>
</tr>
<tr>
<td>
654
</td>
<td>
LegRefID
</td>
<td>
N
</td>
<td>
Identifier of the leg this execution report corresponds to.\
Populated on leg execution reports (`442=2`); matches the LegRefID supplied on the parent order
</td>
</tr>
<tr>
<td>
555
</td>
<td>
NoLegs
</td>
<td>
N
</td>
<td>
Number of legs in the NoLegs repeating group.\
Populated on parent execution reports (`442=3`). See [New Order - Multileg (AB)](#new-order---multileg-ab) for repeating group fields
</td>
</tr>
</tbody>
</Table>
**Notes on execution reports for multileg orders**
Each state transition for a multileg parent order produces:
* One execution report per leg with `MultiLegReportingType (442) = 2` (Individual leg). Leg execution reports carry the leg's `LegRefID (654)`, `Side (54)`, `OrderQty (38) = parent_qty * LegRatioQty`, option tags (when the leg is an option) and `OpenClose (77)` for the leg's position effect.
* Optionally, one parent-level execution report with `MultiLegReportingType (442) = 3` and `SecurityType (167) = MLEG`. Parent execution reports include the `NoLegs (555)` repeating group describing all legs and use the parent's `ClOrdID (11)` and `OrderID (37)`. Whether parent-level execution reports are sent is agreed at session onboarding.
For fills, leg-level `LastPx (31)` and `LastShares (32)` reflect the per-leg execution, while the parent execution report's `LastPx (31)` reflects the net spread price (sum of buy-leg prices minus sum of sell-leg prices, scaled by leg ratios) and `LastShares (32)` reflects the number of completed spread units.
**Example FIX Messages**
```text Pending New
|8=FIX.4.2|9=216|1=TEST_ACCOUNT|17=694bc450-3ca6-461e-8566-f977dcec9e2d|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=A|40=1|49=ALPACA|52=20230615-18:14:29.702|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:14:29.702|150=A|151=10|10=088|
```
```text New
|8=FIX.4.2|9=216|1=TEST_ACCOUNT|17=694bc450-3ca6-461e-8566-f977dcec9e2d|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=0|40=1|49=ALPACA|52=20230615-18:14:45.263|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:14:45.263|150=0|151=10|10=054|
```
```text Partial Fill
|8=FIX.4.2|9=251|1=TEST_ACCOUNT|6=350.78|14=5|15=USD|17=694bc450-3ca6-461e-8566-f977dcec9e2d|31=350.78|32=5|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=1|40=1|49=ALPACA|52=20230615-18:15:00.622|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:15:00.622|150=1|151=5|10=185|
```
```text Fill
|8=FIX.4.2|9=253|1=TEST_ACCOUNT|6=350.78|14=10|15=USD|17=694bc450-3ca6-461e-8566-f977dcec9e2d|31=350.78|32=10|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=2|40=1|49=ALPACA|52=20230615-18:15:21.920|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:15:21.920|150=2|151=0|10=024|
```
```text Pending Replace
|8=FIX.4.2|9=216|1=TEST_ACCOUNT|17=694bc450-3ca6-461e-8566-f977dcec9e2d|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=E|40=1|49=ALPACA|52=20230615-18:26:53.971|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:26:53.971|150=E|151=10|10=112|
```
```text Replaced
|8=FIX.4.2|9=256|1=TEST_ACCOUNT|17=694bc450-3ca6-461e-8566-f977dcec9e2d|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=5|40=1|41=56fcd203-7a97-430d-b14c-b0d9a7f59f2f|49=ALPACA|52=20230615-18:15:38.108|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:15:38.108|150=5|151=10|10=144|
```
```text Pending Cancel
|8=FIX.4.2|9=216|1=TEST_ACCOUNT|17=694bc450-3ca6-461e-8566-f977dcec9e2d|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=6|40=1|49=ALPACA|52=20230615-18:24:50.191|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:24:50.191|150=6|151=10|10=060|
```
```text Canceled
|8=FIX.4.2|9=216|1=TEST_ACCOUNT|17=694bc450-3ca6-461e-8566-f977dcec9e2d|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=4|40=1|49=ALPACA|52=20230615-18:17:45.813|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:17:45.813|150=4|151=10|10=070|
```
```text Rejected
|8=FIX.4.2|9=227|1=TEST_ACCOUNT|17=694bc450-3ca6-461e-8566-f977dcec9e2d|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=8|40=1|49=ALPACA|52=20230615-18:15:51.825|54=1|55=SPY|56=SENDER|59=0|60=20230615-18:15:51.825|103=Price too low|150=8|10=191|
```
```text Option Fill (META Jan-17-2025 100 Call)
|8=FIX.4.2|9=296|1=TEST_ACCOUNT|6=2.15|14=2|15=USD|17=694bc450-3ca6-461e-8566-f977dcec9e2d|31=2.15|32=2|34=12|35=8|37=c5bfc5f6-163d-450e-bb4a-fb25188cde8e|39=2|40=2|44=2.15|49=ALPACA|52=20240910-14:46:01.220|54=1|55=META|56=SENDER|59=0|60=20240910-14:46:01.220|77=O|150=2|151=0|167=OPT|200=202501|201=1|202=100|205=17|10=189|
```
```text Multileg Leg Execution Report (call leg, partial fill)
|8=FIX.4.2|9=320|1=TEST_ACCOUNT|6=79.25|11=PARENT_CLORDID|14=1|15=USD|17=4d6a8e2d-b86a-4ab9-9d3b-3a4dc6f5fa1c|31=79.25|32=1|34=18|35=8|37=ORDER_ID|39=1|40=2|44=10.5|49=ALPACA|52=20240910-15:00:00.001|54=1|55=AAPL|56=SENDER|59=0|60=20240910-15:00:00.001|77=O|150=1|151=1|167=OPT|200=202501|201=1|202=100|205=17|442=2|654=0|10=180|
```
```text Multileg Parent Execution Report (filled spread)
|8=FIX.4.2|9=412|1=TEST_ACCOUNT|6=77.75|11=PARENT_CLORDID|14=2|15=USD|17=2bbf38f6-89f1-4f25-bb70-9f1e3ad7c1aa|31=77.75|32=2|34=22|35=8|37=ORDER_ID|39=2|40=2|44=10.5|49=ALPACA|52=20240910-15:00:05.500|56=SENDER|59=0|60=20240910-15:00:05.500|150=2|151=0|167=MLEG|442=3|555=2|600=AAPL|608=OC|611=20250117|612=100|624=1|623=1|564=O|654=0|600=AAPL|608=OP|611=20250117|612=100|624=2|623=1|564=O|654=1|10=224|
```
## Order Cancel Request (F)
Sent by the client to request cancellation of an order. The same message type is used to cancel both single-leg (equity/option) and multi-leg orders. For multileg orders, `SecurityType (167)` should be set to `MLEG` and `Symbol (55)` should be the underlying root symbol of the parent order.
| Tag | Field | Mandatory | Description |
| --- | ------------ | --------- | ------------------------------------------------------------------------------ |
| 35 | MsgType | Y | F - For Order Cancel Request |
| 1 | Account | Y | Account number |
| 11 | ClOrdID | Y | Unique identifier of cancel request assigned by the client |
| 41 | OrigClOrdID | Y | ClOrdID (11) of the order to be canceled as assigned by the client |
| 54 | Side | Y | As specified on the order to be canceled |
| 55 | Symbol | Y | As specified on the order to be canceled (underlying root symbol for multileg) |
| 60 | TransactTime | Y | UTC timestamp when cancel request was initiated |
| 167 | SecurityType | N | `OPT` for option orders, `MLEG` for multileg orders |
To acknowledge this message, an Execution Report (8) with `150=6` is sent immediately followed by an Execution Report (8) with `150=4` or an Order Cancel Reject (9) message. Sometimes an Order Cancel Reject (9) message might be sent directly without sending an Execution Report (8) with `150=6`. For multileg orders, the acknowledgements are generated for each leg (`442=2`) and, when enabled, at the parent level (`442=3`).
**Example FIX Messages**
```text Cancel Request
|8=FIX.4.2|9=190|35=F|34=5|49=SENDER|52=20240524-16:02:44.709|56=ALPACA|1=account1|11=b165965d-0c9d-467e-a174-ee30f3fe6dbe|41=b5db0b8e-bbc1-4906-aff8-c58d18ba3398|54=1|55=AAPL|60=20240524-16:02:44.709206406|10=226|
```
## Order Cancel/Replace Request (G)
Sent by the client to request modification of a single-leg (equity or single-leg option) order. To modify a multi-leg order, use [Multileg Order Cancel/Replace Request (AC)](#multileg-order-cancelreplace-request-ac) instead.
| Tag | Field | Mandatory | Description |
| --- | ------------ | --------- | -------------------------------------------------------------------------------------------------------- |
| 35 | MsgType | Y | G - For Order Cancel/Replace Request |
| 1 | Account | Y | Account number |
| 11 | ClOrdID | Y | Unique identifier of the replacement order assigned by the client (must be no longer than 48 characters) |
| 21 | HandlInst | Y | 1 - Automated execution with no broker intervention, only accepted value |
| 38 | OrderQty | N | Modified quantity for the order |
| 40 | OrdType | Y | As specified on the original order |
| 41 | OrigClOrdID | Y | ClOrdID (11) of the order to be modified as assigned by the client |
| 44 | Price | N | Modified price for the order |
| 54 | Side | Y | As specified on the original order |
| 55 | Symbol | Y | As specified on the original order |
| 59 | TimeInForce | N | Modified time in force for the order |
| 60 | TransactTime | Y | UTC timestamp when cancel/replace request was initiated |
| 99 | StopPx | N | Modified stop price for the order |
**Example FIX Messages**
```text Cancel/Replace Request
|8=FIX.4.2|9=212|35=G|34=21|49=SENDER|52=20240524-16:16:58.956|56=ALPACA|1=account1|11=45169819-088a-4089-9758-f28e830e95f0|21=3|40=2|41=f001f209-2c3e-42e3-9ab1-10e74ee39fe5|44=1.50000|54=1|55=AAPL|60=20240524-16:16:58.956849295|10=173|
```
## Order Cancel Reject (9)
Sent by the server if the Order Cancel Request (F) or Order Cancel/Replace Request (G) message could not be honored. Some common reject scenarios include:
* when order is already filled or closed
* when a previous Order Cancel Request (F) or Order Cancel/Replace Request (G) is pending for this order
<Table align={["left","left","left","left"]}>
<thead>
<tr>
<th>
Tag
</th>
<th>
Field
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
35
</td>
<td>
MsgType
</td>
<td>
Y
</td>
<td>
9 - For Order Cancel Reject
</td>
</tr>
<tr>
<td>
1
</td>
<td>
Account
</td>
<td>
Y
</td>
<td>
Account number
</td>
</tr>
<tr>
<td>
11
</td>
<td>
ClOrdID
</td>
<td>
Y
</td>
<td>
Unique identifier of cancel or cancel/replace request as assigned by the client
</td>
</tr>
<tr>
<td>
37
</td>
<td>
OrderID
</td>
<td>
Y
</td>
<td>
Unique identifier of the order as assigned by Alpaca for which the cancel or cancel/replace request was rejected
</td>
</tr>
<tr>
<td>
39
</td>
<td>
OrdStatus
</td>
<td>
Y
</td>
<td>
Order status after this cancel reject is applied
</td>
</tr>
<tr>
<td>
41
</td>
<td>
OrigClOrdID
</td>
<td>
Y
</td>
<td>
ClOrdID (11) of the order for which the cancel or cancel/replace request was rejected
</td>
</tr>
<tr>
<td>
58
</td>
<td>
Text
</td>
<td>
N
</td>
<td>
Reject reason
</td>
</tr>
<tr>
<td>
60
</td>
<td>
TransactTime
</td>
<td>
N
</td>
<td>
Server time in UTC when cancel or replace reject occurred
</td>
</tr>
<tr>
<td>
102
</td>
<td>
CxlRejReason
</td>
<td>
N
</td>
<td>
Code to identify reason for cancel rejection.\
0 - Too late to cancel\
1 - Unknown order\
2 - Broker Option\
3 - Order already in Pending Cancel or Pending Replace status
</td>
</tr>
<tr>
<td>
434
</td>
<td>
CxlRejResponseTo
</td>
<td>
Y
</td>
<td>
1 - Response to Order Cancel Request (F)\
2 - Response to Order Cancel/Replace Request (G)
</td>
</tr>
</tbody>
</Table>
**Example FIX Messages**
```text Cancel Reject
|8=FIX.4.2|9=220|35=9|34=18|49=ALPACA|52=20240524-16:02:46.215|56=SENDER|1=account1|11=a7860828-4dc5-4f8f-bfb1-8fbca8855c88|37=f50af678-bba4-44ea-9b23-0fc452ed4921|39=6|41=2c017b79-a843-4146-a2b7-3bf83af89482|58=TOO_LATE_TO_CANCEL|434=1|10=116|
```
```text Cancel/Replace Reject
|8=FIX.4.2|9=198|35=9|34=45|49=ALPACA|52=20240524-16:16:59.085|56=SENDER|1=account1|11=5cdf9082-067b-4497-a90c-f5e8c666409b|37=UNKNOWN|39=8|41=c7feaf5a-54d2-458d-8ab2-9b2f337a28ec|58=replace pending for order|434=2|10=179|
```
## New Order - Multileg (AB)
Sent by the client to submit a new multi-leg order such as an option spread, straddle, strangle, or covered call. Although the FIX session operates on `BeginString=FIX.4.2`, the `NewOrderMultileg` message (`35=AB`) and its `NoLegs` repeating group follow the FIX 4.4 specification.
Each leg may be either an option contract or an equity (for strategies that combine equity with options such as covered calls). The order is submitted as a single multileg request, and acknowledgements are returned at both the leg level and (optionally) the parent level — see [Execution Report (8)](#execution-report-8) for details.
<Table align={["left","left","left","left"]}>
<thead>
<tr>
<th>
Tag
</th>
<th>
Field
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
35
</td>
<td>
MsgType
</td>
<td>
Y
</td>
<td>
AB - For New Order Multileg
</td>
</tr>
<tr>
<td>
1
</td>
<td>
Account
</td>
<td>
Y
</td>
<td>
Account number
</td>
</tr>
<tr>
<td>
11
</td>
<td>
ClOrdID
</td>
<td>
Y
</td>
<td>
Unique identifier of the parent order assigned by the client (must be no longer than 64 characters)
</td>
</tr>
<tr>
<td>
18
</td>
<td>
ExecInst
</td>
<td>
N
</td>
<td>
1 - Not held\
5 - Held
</td>
</tr>
<tr>
<td>
21
</td>
<td>
HandlInst
</td>
<td>
Y
</td>
<td>
1 - Automated execution with no broker intervention, only accepted value
</td>
</tr>
<tr>
<td>
38
</td>
<td>
OrderQty
</td>
<td>
Y
</td>
<td>
Number of spread units to trade. Per-leg quantity is `OrderQty * LegRatioQty (623)`
</td>
</tr>
<tr>
<td>
40
</td>
<td>
OrdType
</td>
<td>
Y
</td>
<td>
1 - Market\
2 - Limit\
3 - Stop\
4 - Stop limit\
5 - Market on close\
B - Limit on close
</td>
</tr>
<tr>
<td>
44
</td>
<td>
Price
</td>
<td>
N
</td>
<td>
Net debit/credit price per spread unit. Required for Limit (`40=2`) and Stop Limit (`40=4`) orders
</td>
</tr>
<tr>
<td>
55
</td>
<td>
Symbol
</td>
<td>
Y
</td>
<td>
Underlying root symbol common to all legs (e.g. `AAPL`)
</td>
</tr>
<tr>
<td>
59
</td>
<td>
TimeInForce
</td>
<td>
Y
</td>
<td>
0 - Day (day)\
1 - Good Till Cancel (gtc)\
2 - At the Opening (opg)\
3 - Immediate or Cancel (ioc)\
4 - Fill or Kill (fok)\
7 - At the Close (cls)
</td>
</tr>
<tr>
<td>
60
</td>
<td>
TransactTime
</td>
<td>
Y
</td>
<td>
UTC timestamp of order creation by client
</td>
</tr>
<tr>
<td>
99
</td>
<td>
StopPx
</td>
<td>
N
</td>
<td>
Required for Stop (`40=3`) and Stop Limit (`40=4`) orders
</td>
</tr>
<tr>
<td>
152
</td>
<td>
CashOrderQty
</td>
<td>
N
</td>
<td>
Notional value to trade
</td>
</tr>
<tr>
<td>
167
</td>
<td>
SecurityType
</td>
<td>
N
</td>
<td>
MLEG - Multileg Instrument (recommended)
</td>
</tr>
<tr>
<td>
555
</td>
<td>
NoLegs
</td>
<td>
Y
</td>
<td>
Number of legs in the order. Must be **at least 2**. The repeating group fields below are repeated `NoLegs` times. Side (54) must NOT be supplied at the parent level for multileg orders
</td>
</tr>
<tr>
<td>
→600
</td>
<td>
LegSymbol
</td>
<td>
Y
</td>
<td>
Per-leg symbol. For option legs, the underlying root (e.g. `AAPL`); for equity legs, the equity ticker
</td>
</tr>
<tr>
<td>
→608
</td>
<td>
LegCFICode
</td>
<td>
Y
</td>
<td>
OC - Option Call\
OP - Option Put\
ES - Equity (for strategies like covered calls)
</td>
</tr>
<tr>
<td>
→611
</td>
<td>
LegMaturityDate
</td>
<td>
N
</td>
<td>
Expiration date in `YYYYMMDD` format.\
Required for option legs (`LegCFICode = OC` or `OP`)
</td>
</tr>
<tr>
<td>
→612
</td>
<td>
LegStrikePrice
</td>
<td>
N
</td>
<td>
Strike price of the option leg.\
Required for option legs (`LegCFICode = OC` or `OP`)
</td>
</tr>
<tr>
<td>
→623
</td>
<td>
LegRatioQty
</td>
<td>
Y
</td>
<td>
Ratio of this leg relative to the parent OrderQty. Must be positive. Per-leg quantity = `OrderQty * LegRatioQty`
</td>
</tr>
<tr>
<td>
→624
</td>
<td>
LegSide
</td>
<td>
Y
</td>
<td>
1 - Buy\
2 - Sell
</td>
</tr>
<tr>
<td>
→654
</td>
<td>
LegRefID
</td>
<td>
Y
</td>
<td>
Client-assigned per-leg identifier, unique within the order (max 32 characters). Echoed back on every leg execution report
</td>
</tr>
<tr>
<td>
→564
</td>
<td>
LegPositionEffect
</td>
<td>
N
</td>
<td>
O - Open\
C - Close\
Combined with `LegSide` to derive the per-leg position intent. When omitted, intent is inferred from `LegSide` (Buy → open, Sell → close)
</td>
</tr>
</tbody>
</Table>
**Notes**
* Multileg orders that include `Side (54)` at the parent level, have fewer than 2 legs, or are missing any required leg field are rejected with a Business Message Reject (code 9001).
* Each leg's execution report echoes the `LegRefID (654)` supplied on the order, so leg-level acknowledgements can be correlated with the originating leg.
* MOC (`40=5`) and LOC (`40=B`) order types are equivalent to submitting `OrdType` Market / Limit with `TimeInForce (59) = 7` (At the Close).
**Example FIX Message**
```text Multileg Limit (long call vertical: buy 100C @ ask, sell 105C @ bid, net debit limit 10.50)
|8=FIX.4.2|9=350|35=AB|34=42|49=SENDER|52=20240910-15:00:00.000|56=ALPACA|1=account1|11=spread-001|21=1|38=2|40=2|44=10.5|55=AAPL|59=0|60=20240910-15:00:00.000|167=MLEG|555=2|600=AAPL|654=0|608=OC|611=20250117|612=100|624=1|623=1|564=O|600=AAPL|654=1|608=OC|611=20250117|612=105|624=2|623=1|564=O|10=147|
```
## Multileg Order Cancel/Replace Request (AC)
Sent by the client to request modification of a multi-leg order. Like [New Order - Multileg (AB)](#new-order---multileg-ab), the message body follows the FIX 4.4 specification while the session remains on `BeginString=FIX.4.2`.
The replacement message must re-supply the complete `NoLegs` repeating group. Replacing a multileg order will produce a `Pending Replace` (`150=E`) and then a `Replaced` (`150=5`) execution report for each leg, and (when enabled) at the parent level.
<Table align={["left","left","left","left"]}>
<thead>
<tr>
<th>
Tag
</th>
<th>
Field
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
35
</td>
<td>
MsgType
</td>
<td>
Y
</td>
<td>
AC - For Multileg Order Cancel/Replace Request
</td>
</tr>
<tr>
<td>
1
</td>
<td>
Account
</td>
<td>
Y
</td>
<td>
Account number
</td>
</tr>
<tr>
<td>
11
</td>
<td>
ClOrdID
</td>
<td>
Y
</td>
<td>
Unique identifier of the replacement order assigned by the client (must be no longer than 64 characters)
</td>
</tr>
<tr>
<td>
21
</td>
<td>
HandlInst
</td>
<td>
Y
</td>
<td>
1 - Automated execution with no broker intervention, only accepted value
</td>
</tr>
<tr>
<td>
38
</td>
<td>
OrderQty
</td>
<td>
N
</td>
<td>
Modified spread quantity for the order
</td>
</tr>
<tr>
<td>
40
</td>
<td>
OrdType
</td>
<td>
Y
</td>
<td>
As specified on the original order
</td>
</tr>
<tr>
<td>
41
</td>
<td>
OrigClOrdID
</td>
<td>
Y
</td>
<td>
ClOrdID (11) of the parent order being modified
</td>
</tr>
<tr>
<td>
44
</td>
<td>
Price
</td>
<td>
N
</td>
<td>
Modified net price per spread unit
</td>
</tr>
<tr>
<td>
55
</td>
<td>
Symbol
</td>
<td>
Y
</td>
<td>
Underlying root symbol (as on the original order)
</td>
</tr>
<tr>
<td>
59
</td>
<td>
TimeInForce
</td>
<td>
N
</td>
<td>
Modified time in force for the order
</td>
</tr>
<tr>
<td>
60
</td>
<td>
TransactTime
</td>
<td>
Y
</td>
<td>
UTC timestamp when cancel/replace request was initiated
</td>
</tr>
<tr>
<td>
99
</td>
<td>
StopPx
</td>
<td>
N
</td>
<td>
Modified stop price for the order
</td>
</tr>
<tr>
<td>
167
</td>
<td>
SecurityType
</td>
<td>
N
</td>
<td>
MLEG - Multileg Instrument (recommended)
</td>
</tr>
<tr>
<td>
555
</td>
<td>
NoLegs
</td>
<td>
Y
</td>
<td>
Re-supply the full leg list (≥ 2 legs). Side (54) must NOT be supplied at the parent level. See [New Order - Multileg (AB)](#new-order---multileg-ab) for the repeating group fields (`600`, `608`, `611`, `612`, `623`, `624`, `654`, `564`)
</td>
</tr>
</tbody>
</Table>
**Notes**
* Submitting a Multileg Cancel/Replace while a previous replace is still pending for the same `OrigClOrdID` is rejected with an [Order Cancel Reject (9)](#order-cancel-reject-9) (`text=replace pending for order`).
* The `NoLegs` group is validated with the same rules as the new-order message; rejections are returned via Business Message Reject (code 9001).
**Example FIX Message**
```text Multileg Cancel/Replace (raise net limit from 10.50 to 11.00)
|8=FIX.4.2|9=370|35=AC|34=58|49=SENDER|52=20240910-15:05:00.000|56=ALPACA|1=account1|11=spread-001-rep|21=1|38=2|40=2|41=spread-001|44=11.0|55=AAPL|60=20240910-15:05:00.000|167=MLEG|555=2|600=AAPL|654=0|608=OC|611=20250117|612=100|624=1|623=1|564=O|600=AAPL|654=1|608=OC|611=20250117|612=105|624=2|623=1|564=O|10=189|
```
## Version History
<Table align={[null,"left",null]}>
<thead>
<tr>
<th>
Version
</th>
<th>
Date
</th>
<th>
Change
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
0.1.0
</td>
<td>
08/05/2024
</td>
<td>
Document Creation
</td>
</tr>
<tr>
<td>
0.1.1
</td>
<td>
24/05/2024
</td>
<td>
Changed FIX version to FIX.4.2\
Removed ApplVerID (1128) from Message Header\
Added ClOrdID (11) and OrigClOrdID (41) as required in Order Cancel Request (F) and Order Cancel/Replace Request (G)\
Removed OrderID (37) from Order Cancel Request (F) and Order Cancel/Replace Request (G)\
Added OrderQty (38) to Order Cancel/Replace Request (G)\
Updated FIX examples
</td>
</tr>
<tr>
<td>
0.1.2
</td>
<td>
12/06/2024
</td>
<td>
Removed Account (1) and RawData (96) from Logon (A) message\
Added RefTagID (371), RefMsgType (372) and SessionRejectReason (373) to Reject (3) message\
Added HandlInst (21), TransactTime (60) and OpenClose (77) to New Order - Single (D)\
Added 1 (per share) as an accepted value for CommType (13) in New Order - Single (D)\
Updated AvgPx (6) to mandatory in Execution Report (8)\
Added Commission (12), ExecRefID (19), ExecTransType (20), LastMkt (30), OrderQty (38) and CashOrderQty (152) to Execution Report (8)\
Removed OrdRejReason (103) from Execution Report (8)\
Updated possible values for ExecType (150) in Execution Report (8)
</td>
</tr>
<tr>
<td>
1.0.0
</td>
<td>
13/06/2024
</td>
<td>
Added Side (54), Symbol (55) and TransactTime (60) to Order Cancel Request (F)\
Added OrderID (37) to Order Cancel Reject (9)\
Added HandlInst (21), OrdType (40), Side (54), Symbol (55) and TransactTime (60) to Order Cancel/Replace Request (G)
</td>
</tr>
<tr>
<td>
1.0.1
</td>
<td>
04/09/2024
</td>
<td>
Added Market on close (5) and Limit on close (B) as values for OrdType (40) on New Order - Single (D)\
Added At the Close (7) as a value for TimeInForce (59) on New Order - Single (D)
</td>
</tr>
<tr>
<td>
1.0.2
</td>
<td>
08/10/2024
</td>
<td>
Added Restated (D) as value for ExecType (150) on Execution Report (8)\
Added ExecRestatementReason (378) to Execution Report (8)\
Added Status (3) as value for ExecTransType (20) on Execution Report (8)\
Added TransactTime (60) to Order Cancel Reject (9)
</td>
</tr>
<tr>
<td>
1.0.3
</td>
<td>
14/01/2025
</td>
<td>
Added Good Till Crossing (5) as a value for TimeInForce (59) on New Order - Single (D)\
Added ClientID (109) to New Order - Single (D)
</td>
</tr>
<tr>
<td>
1.0.4
</td>
<td>
03/04/2025
</td>
<td>
Removed Good Till Crossing (5) as a valid value for TimeInForce (59) on New Order - Single (D)\
Added TradingSessionID (336) to New Order - Single (D)
</td>
</tr>
<tr>
<td>
1.1.0
</td>
<td>
11/05/2026
</td>
<td>
Added Options L3 support:\
Added SecurityType (167), MaturityMonthYear (200), PutOrCall (201), StrikePrice (202) and MaturityDay (205) to New Order - Single (D) for single-leg option orders\
Added SecurityType (167), MaturityMonthYear (200), PutOrCall (201), StrikePrice (202), MaturityDay (205), OpenClose (77), MultiLegReportingType (442), LegRefID (654) and NoLegs (555) to Execution Report (8)\
Added SecurityType (167) to Order Cancel Request (F) to support cancellation of multileg and option orders\
Added New Order - Multileg (AB) message with the NoLegs (555) repeating group (LegSymbol 600, LegCFICode 608, LegMaturityDate 611, LegStrikePrice 612, LegRatioQty 623, LegSide 624, LegRefID 654, LegPositionEffect 564)\
Added Multileg Order Cancel/Replace Request (AC) message
</td>
</tr>
</tbody>
</Table>