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 | A | Sent by FIX client to authenticate and establish the FIX session |
| Heartbeat | 0 | Sent by either client or server at preset interval within the working FIX session |
| Test Request | 1 | Sent to force a heartbeat from the opposing application |
| Resend Request | 2 | To request retransmission of messages which were missed |
| Reject | 3 | Response to a message that could not be processed |
| Sequence Reset | 4 | To reset the FIX session sequence number |
| Logout | 5 | To safely disconnect the connected FIX session |
| New Order - Single | D | To submit a new single order (equity or single-leg option) |
| New Order - Multileg | AB | To submit a new multi-leg order (e.g. option spreads, covered calls) |
| Execution Report | 8 | Sent whenever the state of the order changes |
| Order Cancel Request | F | To request cancellation of an order (single-leg or multileg) |
| Order Cancel/Replace Request | G | To request modification of a single-leg order |
| Multileg Order Cancel/Replace Request | AC | To request modification of a multi-leg order |
| Order Cancel Reject | 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
|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
|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
|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
|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.
Tag | Field | Mandatory | Description |
|---|---|---|---|
35 | MsgType | Y | 3 - For Reject |
45 | RefSeqNum | Y | Sequence number of the rejected message |
58 | Text | N | Reason for rejection |
371 | RefTagID | N | The tag number of the FIX field being referenced |
372 | RefMsgType | N | The MsgType (35) of the FIX message being referenced |
373 | SessionRejectReason | N | Reject reason codes. |
Example FIX Message
|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.
Tag | Field | Mandatory | Description |
|---|---|---|---|
35 | MsgType | Y | 4 - For Sequence Reset |
36 | NewSeqNo | Y | New sequence number |
123 | GapFillFlag | N | N - Sequence reset to recover from an out-of-sequence condition, MsgSeqNum(34) is ignored |
Example FIX Message
|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
|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.
Tag | Field | Mandatory | Description |
|---|---|---|---|
35 | MsgType | Y | D - For New Order - Single |
1 | Account | Y | Account number |
11 | ClOrdID | Y | Unique identifier of the order assigned by the client (must be no longer than 48 characters) |
12 | Commission | N | Commission to collect from the account holder |
13 | CommType | N | 1 - per share |
18 | ExecInst | N | 1 - Not held |
21 | HandlInst | Y | 1 - Automated execution with no broker intervention, only accepted value |
38 | OrderQty | N | Number of shares to trade, required if CashOrderQty (152) is not set |
40 | OrdType | Y | 1 - Market |
44 | Price | N | Required for Limit |
54 | Side | Y | 1 - Buy |
55 | Symbol | Y | Ticker symbol |
59 | TimeInForce | Y | 0 - Day (day) |
60 | TransactTime | Y | UTC timestamp of order creation by client |
77 | OpenClose | N | Indicates whether the resulting position from the trade would be an opening or closing position. |
99 | StopPx | N | Required for Stop |
109 | ClientID | N | Sub-account tag for omnibus accounts |
152 | CashOrderQty | N | Notional value to trade, required if OrderQty (38) is not set |
336 | TradingSessionID | N | 8 - Extended Hours |
167 | SecurityType | N | CS - Common Stock (default when absent) |
200 | MaturityMonthYear | N | Expiration month and year in |
201 | PutOrCall | N | 0 - Put |
202 | StrikePrice | N | Strike price of the option contract (up to 3 decimal places). |
205 | MaturityDay | N | Expiration day of month (1-31). |
Notes on single-leg option orders
- When
SecurityType (167) = OPT, the option contract is identified by the combination ofSymbol (55)(underlying root, e.g.AAPL),MaturityMonthYear (200),MaturityDay (205),PutOrCall (201)andStrikePrice (202). OpenClose (77)should be supplied to disambiguate the position effect (open vs. close). When omitted, position intent is inferred fromSide (54):Buy→ buy-to-open,Sell→ sell-to-close,Sell Short (5)→ sell-to-open.- Option execution reports echo back
SecurityType,MaturityMonthYear,MaturityDay,PutOrCallandStrikePricealong with the standard fields.
Example FIX Messages
|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||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||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||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||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||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||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.
Tag | Field | Mandatory | Description |
|---|---|---|---|
35 | MsgType | Y | 8 - For Execution Report |
1 | Account | Y | Account number |
6 | AvgPx | Y | Average price of all fills on this order |
11 | ClOrdID | Y | Unique identifier of the order as assigned by the client |
12 | Commission | N | Monetary commission value charged on a fill/partial fill |
14 | CumQty | Y | Filled quantity on the order |
15 | Currency | N | Account base currency, default USD |
17 | ExecID | Y | Unique identifier of the execution assigned by Alpaca |
19 | ExecRefID | N | ExecID (17) of the original execution being canceled or corrected when |
20 | ExecTransType | Y | Transaction type. |
30 | LastMkt | N | Market of execution for this fill |
31 | LastPx | N | Price of this fill |
32 | LastShares | N | Quantity traded on this fill |
37 | OrderID | Y | Unique identifier of the order assigned by Alpaca |
38 | OrderQty | N | Either CashOrderQty (152) or OrderQty (38) is provided |
39 | OrdStatus | Y | Identifies current status of order. |
40 | OrdType | N | Same as specified on the order. |
41 | OrigClOrdID | N | ClOrdID (11) of the original order in cancel and cancel/replace requests |
44 | Price | N | Sent when specified on the order |
54 | Side | Y | 1 - Buy |
55 | Symbol | Y | Ticker symbol |
58 | Text | N | Contains reject reason when |
59 | TimeInForce | N | Same as specified on the order. |
60 | TransactTime | N | Server time in UTC when execution occurred, nanoseconds precision |
99 | StopPx | N | Sent when specified on the order |
150 | ExecType | Y | Describes the type of execution report. |
151 | LeavesQty | Y | Unfilled quantity on the order. When order is closed (filled, done for day, canceled, replaced, rejected, expired) value could be 0 |
152 | CashOrderQty | N | Either CashOrderQty (152) or OrderQty (38) is provided. Specifies the notional amount conveyed on the order |
378 | ExecRestatementReason | N | Populated when ExecType (150) = Restated (D). |
77 | OpenClose | N | Position effect of the execution. |
167 | SecurityType | N | CS - Common Stock |
200 | MaturityMonthYear | N | Populated for option executions ( |
201 | PutOrCall | N | Populated for option executions ( |
202 | StrikePrice | N | Populated for option executions ( |
205 | MaturityDay | N | Populated for option executions ( |
442 | MultiLegReportingType | N | Set only on executions emitted from multileg parent orders. |
654 | LegRefID | N | Identifier of the leg this execution report corresponds to. |
555 | NoLegs | N | Number of legs in the NoLegs repeating group. |
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'sLegRefID (654),Side (54),OrderQty (38) = parent_qty * LegRatioQty, option tags (when the leg is an option) andOpenClose (77)for the leg's position effect. - Optionally, one parent-level execution report with
MultiLegReportingType (442) = 3andSecurityType (167) = MLEG. Parent execution reports include theNoLegs (555)repeating group describing all legs and use the parent'sClOrdID (11)andOrderID (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
|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||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||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||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||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||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||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||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||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||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||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||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
|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) 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
|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
Tag | Field | Mandatory | Description |
|---|---|---|---|
35 | MsgType | Y | 9 - For Order Cancel Reject |
1 | Account | Y | Account number |
11 | ClOrdID | Y | Unique identifier of cancel or cancel/replace request as assigned by the client |
37 | OrderID | Y | Unique identifier of the order as assigned by Alpaca for which the cancel or cancel/replace request was rejected |
39 | OrdStatus | Y | Order status after this cancel reject is applied |
41 | OrigClOrdID | Y | ClOrdID (11) of the order for which the cancel or cancel/replace request was rejected |
58 | Text | N | Reject reason |
60 | TransactTime | N | Server time in UTC when cancel or replace reject occurred |
102 | CxlRejReason | N | Code to identify reason for cancel rejection. |
434 | CxlRejResponseTo | Y | 1 - Response to Order Cancel Request (F) |
Example FIX Messages
|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||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) for details.
Tag | Field | Mandatory | Description |
|---|---|---|---|
35 | MsgType | Y | AB - For New Order Multileg |
1 | Account | Y | Account number |
11 | ClOrdID | Y | Unique identifier of the parent order assigned by the client (must be no longer than 64 characters) |
18 | ExecInst | N | 1 - Not held |
21 | HandlInst | Y | 1 - Automated execution with no broker intervention, only accepted value |
38 | OrderQty | Y | Number of spread units to trade. Per-leg quantity is |
40 | OrdType | Y | 1 - Market |
44 | Price | N | Net debit/credit price per spread unit. Required for Limit ( |
55 | Symbol | Y | Underlying root symbol common to all legs (e.g. |
59 | TimeInForce | Y | 0 - Day (day) |
60 | TransactTime | Y | UTC timestamp of order creation by client |
99 | StopPx | N | Required for Stop ( |
152 | CashOrderQty | N | Notional value to trade |
167 | SecurityType | N | MLEG - Multileg Instrument (recommended) |
555 | NoLegs | Y | Number of legs in the order. Must be at least 2. The repeating group fields below are repeated |
→600 | LegSymbol | Y | Per-leg symbol. For option legs, the underlying root (e.g. |
→608 | LegCFICode | Y | OC - Option Call |
→611 | LegMaturityDate | N | Expiration date in |
→612 | LegStrikePrice | N | Strike price of the option leg. |
→623 | LegRatioQty | Y | Ratio of this leg relative to the parent OrderQty. Must be positive. Per-leg quantity = |
→624 | LegSide | Y | 1 - Buy |
→654 | LegRefID | Y | Client-assigned per-leg identifier, unique within the order (max 32 characters). Echoed back on every leg execution report |
→564 | LegPositionEffect | N | O - Open |
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 submittingOrdTypeMarket / Limit withTimeInForce (59) = 7(At the Close).
Example FIX Message
|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), 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.
Tag | Field | Mandatory | Description |
|---|---|---|---|
35 | MsgType | Y | AC - For Multileg 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 64 characters) |
21 | HandlInst | Y | 1 - Automated execution with no broker intervention, only accepted value |
38 | OrderQty | N | Modified spread quantity for the order |
40 | OrdType | Y | As specified on the original order |
41 | OrigClOrdID | Y | ClOrdID (11) of the parent order being modified |
44 | Price | N | Modified net price per spread unit |
55 | Symbol | Y | Underlying root symbol (as 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 |
167 | SecurityType | N | MLEG - Multileg Instrument (recommended) |
555 | NoLegs | Y | Re-supply the full leg list (≥ 2 legs). Side (54) must NOT be supplied at the parent level. See New Order - Multileg (AB) for the repeating group fields ( |
Notes
- Submitting a Multileg Cancel/Replace while a previous replace is still pending for the same
OrigClOrdIDis rejected with an Order Cancel Reject (9) (text=replace pending for order). - The
NoLegsgroup is validated with the same rules as the new-order message; rejections are returned via Business Message Reject (code 9001).
Example FIX Message
|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
Version | Date | Change |
|---|---|---|
0.1.0 | 08/05/2024 | Document Creation |
0.1.1 | 24/05/2024 | Changed FIX version to FIX.4.2 |
0.1.2 | 12/06/2024 | Removed Account (1) and RawData (96) from Logon (A) message |
1.0.0 | 13/06/2024 | Added Side (54), Symbol (55) and TransactTime (60) to Order Cancel Request (F) |
1.0.1 | 04/09/2024 | Added Market on close (5) and Limit on close (B) as values for OrdType (40) on New Order - Single (D) |
1.0.2 | 08/10/2024 | Added Restated (D) as value for ExecType (150) on Execution Report (8) |
1.0.3 | 14/01/2025 | Added Good Till Crossing (5) as a value for TimeInForce (59) on New Order - Single (D) |
1.0.4 | 03/04/2025 | Removed Good Till Crossing (5) as a valid value for TimeInForce (59) on New Order - Single (D) |
1.1.0 | 11/05/2026 | Added Options L3 support: |
Updated 5 days ago