developers:fixapi:ocoorder

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
developers:fixapi:ocoorder [2025/09/12 01:50] – removed - external edit (Unknown date) 127.0.0.1developers:fixapi:ocoorder [2025/09/12 01:50] (current) – ↷ Page moved and renamed from developers:fixapi.ocoorder to developers:fixapi:ocoorder chad
Line 1: Line 1:
 +===== OCO (One Cancels Other) Order =====
 +
 +An **OCO (One Cancels Other)** order consists of:  
 +  * A buy limit order below the market **and** a buy stop order above the market, **or**  
 +  * A sell limit order above the market **and** a sell stop order below the market.  
 +
 +When one order gets filled, the other is cancelled.  
 +If one is partially filled, the volume on the other is reduced accordingly.
 +
 +An OCO Order is submitted with the **New Order List** (Tag 35=E) message.  
 +Following are the most relevant tags to build an OCO Order:
 +
 +^ Tag ^ Field ^ Description ^
 +| 1385=1 | ContingencyType | Specifier of OCO order type |
 +| 44     | Price | Price of Limit component. Must be below last traded price for Buys and above for Sells. |
 +| 99     | Stop Price | Price of Stop component. Must be above last traded price for Buys and below for Sells. |
 +| 48     | SecurityID | Market for which the order is sent |
 +| 55     | Symbol | Contract for which the order is sent |
 +| 207    | SecurityExchange | Exchange for which the order is sent |
 +
 +----
 +
 +**Additional Notes**  
 +  * OCO orders can also be **GTC**, **StopLimit**, or **Trailing**.  
 +  * **Activation** is **not supported** with OCO orders.  
 +  * The Limit component can be either:  
 +    - Limit Order (**Tag 40=2**)  
 +    - Market-if-Touched (**Tag 40=J**)  
 +  * OCO orders are **not** intended for scenarios where both orders are placed very close together (e.g., consecutive prices or best bid/best offer). In active markets, both components may be filled.  
 +  * All OCO components must be for the **same account** and **same market**.
 +
 +----
 +
 +**Sample**
 +
 +In this example, a **buy OCO order** is submitted at:  
 +  * Limit Component Price = **157850** (Tag 44 = 157850)  
 +  * Stop Component Price = **157900** (Tag 99 = 157900)  
 +
 +The **Stop** component is filled, and the **Limit** component is subsequently cancelled.
 +
 +OCO Order
 +<code>
 +>> 4/26/2013 9:17:40 AM   [FIXNEWORDERLIST] 34=1871|49=T4Example|56=T4|50=Account1|52=20130426-14:17:40.583|66=fnl-635025646605836934|1385=1|433=1|68=2|11=oco-1-635025646605836934|1=Account1|54=1|38=1|48=CME_20130600_ESM3|55=ES|207=CME_Eq|40=2|44=157850|59=0|21=2|60=20130426-14:17:40.583|11=oco-2-635025646605836934|1=Account1|54=1|38=1|48=CME_20130600_ESM3|55=ES|207=CME_Eq|40=3|99=157900|59=0|21=2|60=20130426-14:17:40.583|
 +[FIXNEWORDERLIST]
 +[MsgSeqNum] 34 = 1871
 +[SenderCompID] 49 = T4Example
 +[TargetCompID] 56 = T4
 +[SenderSubID] 50 = Account1
 +[SendingTime] 52 = 20130426-14:17:40.583
 +[ListID] 66 = fnl-635025646605836934
 +[ContingencyType] 1385 = 1 (OCO)
 +[ListExecInstType] 433 = 1 (IMMEDIATE)
 +[TotNoOrders] 68 = 2
 +[ClOrdID] 11 = oco-1-635025646605836934
 +[Account] 1 = Account1
 +[Side] 54 = 1 (BUY)
 +[OrderQty] 38 = 1
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[OrdType] 40 = 2 (LIMIT)
 +[Price] 44 = 157850
 +[TimeInForce] 59 = 0 (DAY)
 +[HandlInst] 21 = 2 (AUTOMATED_EXECUTION_ORDER_PUBLIC_BROKER_INTERVENTION_OK)
 +[TransactTime] 60 = 20130426-14:17:40.583
 +[ClOrdID] 11 = oco-2-635025646605836934
 +[Account] 1 = Account1
 +[Side] 54 = 1 (BUY)
 +[OrderQty] 38 = 1
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[OrdType] 40 = 3 (STOP)
 +[StopPx] 99 = 157900
 +[TimeInForce] 59 = 0 (DAY)
 +[HandlInst] 21 = 2 (AUTOMATED_EXECUTION_ORDER_PUBLIC_BROKER_INTERVENTION_OK)
 +[TransactTime] 60 = 20130426-14:17:40.583
 +</code>
 +OCO Order Response - Limit Component Working
 +<code>
 +<< 4/26/2013 9:17:40 AM  [fixexecutionreport] 34=130733|49=T4|56=T4Example|50=T4FIX|52=20130426-14:17:40.677|143=US,IL|1=Account1|11=oco-1-635025646605836934|66=fnl-635025646605836934|17=48323.6446981231_ESM3.6350256466290500006.1.77A1CE19|150=0|37=77A1CE19-9041-4620-80AB-40BFABB45048|39=0|48=CME_20130600_ESM3|55=ES|207=CME_Eq|200=201306|59=0|107=E-mini S&P 500 Jun13|54=1|167=FUT|38=1|40=2|44=157850|60=20130426-14:17:42.905|21=1|204=0|1385=1|
 +[FIXEXECUTIONREPORT]
 +[MsgSeqNum] 34 = 130733
 +[SenderCompID] 49 = T4
 +[TargetCompID] 56 = T4Example
 +[SenderSubID] 50 = T4FIX
 +[SendingTime] 52 = 20130426-14:17:40.677
 +[TargetLocationID] 143 = US,IL
 +[Account] 1 = Account1
 +[ClOrdID] 11 = oco-1-635025646605836934
 +[ListID] 66 = fnl-635025646605836934
 +[ExecID] 17 = 48323.6446981231_ESM3.6350256466290500006.1.77A1CE19
 +[ExecType] 150 = 0 (NEW)
 +[OrderID] 37 = 77A1CE19-9041-4620-80AB-40BFABB45048
 +[OrdStatus] 39 = 0 (NEW)
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[MaturityMonthYear] 200 = 201306
 +[TimeInForce] 59 = 0 (DAY)
 +[SecurityDesc] 107 = E-mini S&P 500 Jun13
 +[Side] 54 = 1 (BUY)
 +[SecurityType] 167 = FUT (FUTURE)
 +[OrderQty] 38 = 1
 +[OrdType] 40 = 2 (LIMIT)
 +[Price] 44 = 157850
 +[TransactTime] 60 = 20130426-14:17:42.905
 +[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
 +[CustomerOrFirm] 204 = 0 (CUSTOMER)
 +[ContingencyType] 1385 = 1 (OCO)
 +</code>
 +OCO Order Response - Stop Component Working
 +<code>
 +<< 4/26/2013 9:17:40 AM  [fixexecutionreport] 34=130735|49=T4|56=T4Example|50=T4FIX|52=20130426-14:17:40.880|143=US,IL|1=Account1|11=oco-2-635025646605836934|66=fnl-635025646605836934|17=48324.6446981232_ESM3.6350256466290900006.1.824FCFDB|150=0|37=824FCFDB-D4D3-4207-B4A9-2FF07C1FE813|39=0|48=CME_20130600_ESM3|55=ES|207=CME_Eq|200=201306|59=0|107=E-mini S&P 500 Jun13|54=1|167=FUT|38=1|40=3|99=157900|60=20130426-14:17:42.909|21=1|204=0|1385=1|
 +[FIXEXECUTIONREPORT]
 +[MsgSeqNum] 34 = 130735
 +[SenderCompID] 49 = T4
 +[TargetCompID] 56 = T4Example
 +[SenderSubID] 50 = T4FIX
 +[SendingTime] 52 = 20130426-14:17:40.880
 +[TargetLocationID] 143 = US,IL
 +[Account] 1 = Account1
 +[ClOrdID] 11 = oco-2-635025646605836934
 +[ListID] 66 = fnl-635025646605836934
 +[ExecID] 17 = 48324.6446981232_ESM3.6350256466290900006.1.824FCFDB
 +[ExecType] 150 = 0 (NEW)
 +[OrderID] 37 = 824FCFDB-D4D3-4207-B4A9-2FF07C1FE813
 +[OrdStatus] 39 = 0 (NEW)
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[MaturityMonthYear] 200 = 201306
 +[TimeInForce] 59 = 0 (DAY)
 +[SecurityDesc] 107 = E-mini S&P 500 Jun13
 +[Side] 54 = 1 (BUY)
 +[SecurityType] 167 = FUT (FUTURE)
 +[OrderQty] 38 = 1
 +[OrdType] 40 = 3 (STOP)
 +[StopPx] 99 = 157900
 +[TransactTime] 60 = 20130426-14:17:42.909
 +[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
 +[CustomerOrFirm] 204 = 0 (CUSTOMER)
 +[ContingencyType] 1385 = 1 (OCO)
 +</code>
 +OCO Order Response - Stop Component activated to Limit
 +<code>
 +<< 4/26/2013 9:20:46 AM  [fixexecutionreport] 34=131009|49=T4|56=T4Example|50=T4FIX|52=20130426-14:20:46.286|143=US,IL|1=Account1|11=oco-2-635025646605836934|66=fnl-635025646605836934|17=48324.6446981232_ESM3.6350256484851300006.1.824FCFDB|150=0|37=824FCFDB-D4D3-4207-B4A9-2FF07C1FE813|39=0|48=CME_20130600_ESM3|55=ES|207=CME_Eq|200=201306|59=0|107=E-mini S&P 500 Jun13|54=1|167=FUT|38=1|40=2|44=158200|60=20130426-14:20:48.513|21=1|204=0|1385=1|
 +[FIXEXECUTIONREPORT]
 +[MsgSeqNum] 34 = 131009
 +[SenderCompID] 49 = T4
 +[TargetCompID] 56 = T4Example
 +[SenderSubID] 50 = T4FIX
 +[SendingTime] 52 = 20130426-14:20:46.286
 +[TargetLocationID] 143 = US,IL
 +[Account] 1 = Account1
 +[ClOrdID] 11 = oco-2-635025646605836934
 +[ListID] 66 = fnl-635025646605836934
 +[ExecID] 17 = 48324.6446981232_ESM3.6350256484851300006.1.824FCFDB
 +[ExecType] 150 = 0 (NEW)
 +[OrderID] 37 = 824FCFDB-D4D3-4207-B4A9-2FF07C1FE813
 +[OrdStatus] 39 = 0 (NEW)
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[MaturityMonthYear] 200 = 201306
 +[TimeInForce] 59 = 0 (DAY)
 +[SecurityDesc] 107 = E-mini S&P 500 Jun13
 +[Side] 54 = 1 (BUY)
 +[SecurityType] 167 = FUT (FUTURE)
 +[OrderQty] 38 = 1
 +[OrdType] 40 = 2 (LIMIT)
 +[Price] 44 = 158200
 +[TransactTime] 60 = 20130426-14:20:48.513
 +[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
 +[CustomerOrFirm] 204 = 0 (CUSTOMER)
 +[ContingencyType] 1385 = 1 (OCO)
 +</code>
 +OCO Order Response - Stop Component Filled
 +<code>
 +<< 4/26/2013 9:20:46 AM  [fixexecutionreport] 34=131012|49=T4|56=T4Example|50=T4FIX|52=20130426-14:20:46.489|143=US,IL|1=Account1|11=oco-2-635025646605836934|66=fnl-635025646605836934|17=64229:5559243TN0374282.63502564848513000021.2.824FCFDB|150=F|37=824FCFDB-D4D3-4207-B4A9-2FF07C1FE813|39=2|48=CME_20130600_ESM3|55=ES|207=CME_Eq|200=201306|59=0|107=E-mini S&P 500 Jun13|54=1|167=FUT|38=1|40=2|44=158200|31=157900|32=1|14=1|151=0|60=20130426-14:20:48.626|21=1|204=0|337=TRADE|375=CME000A|1385=1|
 +[FIXEXECUTIONREPORT]
 +[MsgSeqNum] 34 = 131012
 +[SenderCompID] 49 = T4
 +[TargetCompID] 56 = T4Example
 +[SenderSubID] 50 = T4FIX
 +[SendingTime] 52 = 20130426-14:20:46.489
 +[TargetLocationID] 143 = US,IL
 +[Account] 1 = Account1
 +[ClOrdID] 11 = oco-2-635025646605836934
 +[ExecID] 17 = 64229:5559243TN0374282.63502564848513000021.2.824FCFDB
 +[ExecType] 150 = F
 +[OrderID] 37 = 824FCFDB-D4D3-4207-B4A9-2FF07C1FE813
 +[OrdStatus] 39 = 2 (FILLED)
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[MaturityMonthYear] 200 = 201306
 +[TimeInForce] 59 = 0 (DAY)
 +[SecurityDesc] 107 = E-mini S&P 500 Jun13
 +[Side] 54 = 1 (BUY)
 +[SecurityType] 167 = FUT (FUTURE)
 +[OrderQty] 38 = 1
 +[OrdType] 40 = 2 (LIMIT)
 +[Price] 44 = 158200
 +[LastPx] 31 = 157900
 +[LastShares] 32 = 1
 +[CumQty] 14 = 1
 +[LeavesQty] 151 = 0
 +[TransactTime] 60 = 20130426-14:20:48.626
 +[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
 +[CustomerOrFirm] 204 = 0 (CUSTOMER)
 +[ContraTrader] 337 = TRADE
 +[ContraBroker] 375 = CME000A
 +[ContingencyType] 1385 = 1 (OCO)
 +</code>
 +OCO Order Response - Limit Component pending cancel (Risk assessment success)
 +<code>
 +<< 4/26/2013 9:20:46 AM  [fixexecutionreport] 34=131013|49=T4|56=T4Example|50=T4FIX|52=20130426-14:20:46.816|143=US,IL|1=Account1|11=oco-1-635025646605836934|66=fnl-635025646605836934|17=48323.6446981231_ESM3.63502564662905000014.1.77A1CE19|150=6|37=77A1CE19-9041-4620-80AB-40BFABB45048|39=6|48=CME_20130600_ESM3|55=ES|207=CME_Eq|200=201306|59=0|107=E-mini S&P 500 Jun13|54=1|167=FUT|38=0|40=2|44=157850|58=OCO Pull: PullRiskSuccess. Pull passed risk management|60=20130426-14:17:42.783|21=1|204=0|1385=1|
 +[FIXEXECUTIONREPORT]
 +[MsgSeqNum] 34 = 131013
 +[SenderCompID] 49 = T4
 +[TargetCompID] 56 = T4Example
 +[SenderSubID] 50 = T4FIX
 +[SendingTime] 52 = 20130426-14:20:46.816
 +[TargetLocationID] 143 = US,IL
 +[Account] 1 = Account1
 +[ClOrdID] 11 = oco-1-635025646605836934
 +[ListID] 66 = fnl-635025646605836934
 +[ExecID] 17 = 48323.6446981231_ESM3.63502564662905000014.1.77A1CE19
 +[ExecType] 150 = 6 (PENDING_CANCEL)
 +[OrderID] 37 = 77A1CE19-9041-4620-80AB-40BFABB45048
 +[OrdStatus] 39 = 6 (PENDING_CANCEL)
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[MaturityMonthYear] 200 = 201306
 +[TimeInForce] 59 = 0 (DAY)
 +[SecurityDesc] 107 = E-mini S&P 500 Jun13
 +[Side] 54 = 1 (BUY)
 +[SecurityType] 167 = FUT (FUTURE)
 +[OrderQty] 38 = 0
 +[OrdType] 40 = 2 (LIMIT)
 +[Price] 44 = 157850
 +[Text] 58 = OCO Pull: PullRiskSuccess. Pull passed risk management
 +[TransactTime] 60 = 20130426-14:17:42.783
 +[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
 +[CustomerOrFirm] 204 = 0 (CUSTOMER)
 +[ContingencyType] 1385 = 1 (OCO)
 +</code>
 +OCO Order Response - Limit Component pending cancel (submitted to exchange)
 +<code>
 +<< 4/26/2013 9:20:46 AM  [fixexecutionreport] 34=131014|49=T4|56=T4Example|50=T4FIX|52=20130426-14:20:46.832|143=US,IL|1=Account1|11=oco-1-635025646605836934|66=fnl-635025646605836934|17=48325.6446981231_ESM3.63502564662905000016.1.77A1CE19|150=6|37=77A1CE19-9041-4620-80AB-40BFABB45048|39=6|48=CME_20130600_ESM3|55=ES|207=CME_Eq|200=201306|59=0|107=E-mini S&P 500 Jun13|54=1|167=FUT|38=0|40=2|44=157850|58=OCO Pull|60=20130426-14:17:42.905|21=1|204=0|1385=1|
 +[FIXEXECUTIONREPORT]
 +[MsgSeqNum] 34 = 131014
 +[SenderCompID] 49 = T4
 +[TargetCompID] 56 = T4Example
 +[SenderSubID] 50 = T4FIX
 +[SendingTime] 52 = 20130426-14:20:46.832
 +[TargetLocationID] 143 = US,IL
 +[Account] 1 = Account1
 +[ClOrdID] 11 = oco-1-635025646605836934
 +[ListID] 66 = fnl-635025646605836934
 +[ExecID] 17 = 48325.6446981231_ESM3.63502564662905000016.1.77A1CE19
 +[ExecType] 150 = 6 (PENDING_CANCEL)
 +[OrderID] 37 = 77A1CE19-9041-4620-80AB-40BFABB45048
 +[OrdStatus] 39 = 6 (PENDING_CANCEL)
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[MaturityMonthYear] 200 = 201306
 +[TimeInForce] 59 = 0 (DAY)
 +[SecurityDesc] 107 = E-mini S&P 500 Jun13
 +[Side] 54 = 1 (BUY)
 +[SecurityType] 167 = FUT (FUTURE)
 +[OrderQty] 38 = 0
 +[OrdType] 40 = 2 (LIMIT)
 +[Price] 44 = 157850
 +[Text] 58 = OCO Pull
 +[TransactTime] 60 = 20130426-14:17:42.905
 +[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
 +[CustomerOrFirm] 204 = 0 (CUSTOMER)
 +[ContingencyType] 1385 = 1 (OCO)
 +</code>
 +OCO Order Response - Limit Component Cancelled
 +<code>
 +<< 4/26/2013 9:20:46 AM  [fixexecutionreport] 34=131015|49=T4|56=T4Example|50=T4FIX|52=20130426-14:20:46.848|143=US,IL|1=Account1|11=oco-1-635025646605836934|66=fnl-635025646605836934|17=48325.6446981231_ESM3.63502564849076000018.2.77A1CE19|150=4|37=77A1CE19-9041-4620-80AB-40BFABB45048|39=4|48=CME_20130600_ESM3|55=ES|207=CME_Eq|200=201306|59=0|107=E-mini S&P 500 Jun13|54=1|167=FUT|38=0|40=2|44=157850|60=20130426-14:20:49.076|21=1|204=0|1385=1|
 +[FIXEXECUTIONREPORT]
 +[MsgSeqNum] 34 = 131015
 +[SenderCompID] 49 = T4
 +[TargetCompID] 56 = T4Example
 +[SenderSubID] 50 = T4FIX
 +[SendingTime] 52 = 20130426-14:20:46.848
 +[TargetLocationID] 143 = US,IL
 +[Account] 1 = Account1
 +[ClOrdID] 11 = oco-1-635025646605836934
 +[ListID] 66 = fnl-635025646605836934
 +[ExecID] 17 = 48325.6446981231_ESM3.63502564849076000018.2.77A1CE19
 +[ExecType] 150 = 4 (CANCELED)
 +[OrderID] 37 = 77A1CE19-9041-4620-80AB-40BFABB45048
 +[OrdStatus] 39 = 4 (CANCELED)
 +[SecurityID] 48 = CME_20130600_ESM3
 +[Symbol] 55 = ES
 +[SecurityExchange] 207 = CME_Eq
 +[MaturityMonthYear] 200 = 201306
 +[TimeInForce] 59 = 0 (DAY)
 +[SecurityDesc] 107 = E-mini S&P 500 Jun13
 +[Side] 54 = 1 (BUY)
 +[SecurityType] 167 = FUT (FUTURE)
 +[OrderQty] 38 = 0
 +[OrdType] 40 = 2 (LIMIT)
 +[Price] 44 = 157850
 +[TransactTime] 60 = 20130426-14:20:49.076
 +[HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION)
 +[CustomerOrFirm] 204 = 0 (CUSTOMER)
 +[ContingencyType] 1385 = 1 (OCO)
 +</code>
 +Further details on the tags used for this order type are described in the dictionary of the New Order List message.
 +
 +[[developers:legacy_fix_api|T4 FIX API Home]]