Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
developers:fixapi:flattenorder [2025/09/12 01:48] – removed - external edit (Unknown date) 127.0.0.1 | developers:fixapi:flattenorder [2025/09/12 01:48] (current) – ↷ Page moved and renamed from developers:fixapi.flattenorder to developers:fixapi:flattenorder chad | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Flatten Order ===== | ||
+ | |||
+ | A **Flatten Order** can be used to flatten a current position regardless of what that position is. | ||
+ | The **T4 FIX API** server determines the volume and Buy/Sell parameters. | ||
+ | If a position does not currently exist for the **SecurityID** (Tag 48) of the submitted flatten order, the order is rejected. | ||
+ | |||
+ | A Flatten Order is entered with the **New Order Single** (Tag 35=D) message. | ||
+ | Following are the most relevant tags to build a Flatten Order: | ||
+ | |||
+ | ^ Tag ^ Field ^ Description ^ | ||
+ | | 40=F | OrdType | Specifier of Flatten Order Type | | ||
+ | | 38 | OrderQty | Set to 0 to have the T4 FIX API server determine the volume needed to flatten the position. A finite quantity may also be entered. | | ||
+ | | 54 | Side | Set to 0 (NONE) to have the T4 FIX API server determine whether to Buy or Sell to flatten. A finite side may also be entered. | | ||
+ | | 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 | | ||
+ | | 167 | SecurityType | Security Type (e.g. Futures) of this specific market | | ||
+ | |||
+ | ---- | ||
+ | |||
+ | **OrderQty Considerations** | ||
+ | * **OrderQty = 0** – Allows the API server to bypass certain risk management checks. | ||
+ | - Example: If Max Clip Size = 10 and Max Position = 20, and the current position is long 15, the server can submit a 15-lot sell without being rejected due to the clip size limit. | ||
+ | * **OrderQty > 0** – Acts as a maximum volume to submit. | ||
+ | - Example: If position = long 15 and OrderQty = 12, only a 12-lot order would be submitted. | ||
+ | - Risk management checks will be applied; order may be rejected if it violates limits (e.g. exceeds Max Clip Size). | ||
+ | |||
+ | ---- | ||
+ | |||
+ | **Side Considerations** | ||
+ | * **Side = 0 (NONE)** – Lets the server determine the side needed to flatten. | ||
+ | * **Side = BUY (1) or SELL (2)** – Server will only flatten if the position is in the correct direction. | ||
+ | - Example: If holding a long position and sending a flatten order with **Side = BUY (1)**, the server will reject the order. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | **Sample** | ||
+ | |||
+ | In this example, the Flatten order is submitted by setting **OrdType** (Tag 40) = **F**. | ||
+ | Price (**Tag 44**) is not entered, **Side** (Tag 54) = **0** (NONE), and **OrderQty** (Tag 38) = **0**. | ||
+ | |||
+ | Flatten Order | ||
+ | < | ||
+ | >> 2/22/2013 12:51:28 PM | ||
+ | [FIXNEWORDER] | ||
+ | [MsgSeqNum] 34 = 153 | ||
+ | [SenderCompID] 49 = T4Example | ||
+ | [TargetCompID] 56 = T4 | ||
+ | [SenderSubID] 50 = TraderName | ||
+ | [SendingTime] 52 = 20130222-18: | ||
+ | [Account] 1 = Account1 | ||
+ | [ClOrdID] 11 = fn-634971342882072305 | ||
+ | [SecurityID] 48 = CME_20130300_ZCH3 | ||
+ | [Symbol] 55 = ZC | ||
+ | [SecurityExchange] 207 = CME_C | ||
+ | [Side] 54 = 0 (NONE) | ||
+ | [OrderQty] 38 = 0 | ||
+ | [OrdType] 40 = F (FLATTEN) | ||
+ | [TimeInForce] 59 = 0 (DAY) | ||
+ | [SecurityType] 167 = FUT (FUTURE) | ||
+ | [HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION) | ||
+ | [TransactTime] 60 = 20130222-18: | ||
+ | [CustomerOrFirm] 204 = 0 (CUSTOMER) | ||
+ | </ | ||
+ | Flatten Order Response - Awaiting Trigger | ||
+ | < | ||
+ | << 2/22/2013 12:51:28 PM [fixexecutionreport] 34=536|49=T4|56=T4Example|50=T4FIX|52=20130222-18: | ||
+ | [FIXEXECUTIONREPORT] | ||
+ | [MsgSeqNum] 34 = 536 | ||
+ | [SenderCompID] 49 = T4 | ||
+ | [TargetCompID] 56 = T4Example | ||
+ | [SenderSubID] 50 = T4FIX | ||
+ | [SendingTime] 52 = 20130222-18: | ||
+ | [TargetLocationID] 143 = UK | ||
+ | [Account] 1 = Account1 | ||
+ | [ClOrdID] 11 = fn-634971342882072305 | ||
+ | [ExecID] 17 = 0.634971342895618750.2.1.DF0E0564 | ||
+ | [ExecType] 150 = A (PENDING_NEW) | ||
+ | [OrderID] 37 = DF0E0564-9063-4C02-8F21-071C4DE1C419 | ||
+ | [OrdStatus] 39 = A (PENDING_NEW) | ||
+ | [SecurityID] 48 = CME_20130300_ZCH3 | ||
+ | [Symbol] 55 = ZC | ||
+ | [SecurityExchange] 207 = CME_C | ||
+ | [MaturityMonthYear] 200 = 201303 | ||
+ | [TimeInForce] 59 = 0 (DAY) | ||
+ | [SecurityDesc] 107 = Corn Mar13 | ||
+ | [Side] 54 = 0 (NONE) | ||
+ | [SecurityType] 167 = FUT (FUTURE) | ||
+ | [OrderQty] 38 = 0 | ||
+ | [OrdType] 40 = F (FLATTEN) | ||
+ | [Text] 58 = Flatten Awaiting Trigger | ||
+ | [TransactTime] 60 = 20130222-18: | ||
+ | [HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION) | ||
+ | [CustomerOrFirm] 204 = 0 (CUSTOMER) | ||
+ | </ | ||
+ | Flatten Order Response | ||
+ | < | ||
+ | << 2/22/2013 12:51:28 PM [fixexecutionreport] 34=537|49=T4|56=T4Example|50=T4FIX|52=20130222-18: | ||
+ | [FIXEXECUTIONREPORT] | ||
+ | [MsgSeqNum] 34 = 537 | ||
+ | [SenderCompID] 49 = T4 | ||
+ | [TargetCompID] 56 = T4Example | ||
+ | [SenderSubID] 50 = T4FIX | ||
+ | [SendingTime] 52 = 20130222-18: | ||
+ | [TargetLocationID] 143 = UK | ||
+ | [Account] 1 = Account1 | ||
+ | [ClOrdID] 11 = fn-634971342882072305 | ||
+ | [ExecID] 17 = 48085.7016210353_ZCH3.6349713428968100006.1.DF0E0564 | ||
+ | [ExecType] 150 = 0 (NEW) | ||
+ | [OrderID] 37 = DF0E0564-9063-4C02-8F21-071C4DE1C419 | ||
+ | [OrdStatus] 39 = 0 (NEW) | ||
+ | [SecurityID] 48 = CME_20130300_ZCH3 | ||
+ | [Symbol] 55 = ZC | ||
+ | [SecurityExchange] 207 = CME_C | ||
+ | [MaturityMonthYear] 200 = 201303 | ||
+ | [TimeInForce] 59 = 0 (DAY) | ||
+ | [SecurityDesc] 107 = Corn Mar13 | ||
+ | [Side] 54 = 2 (SELL) | ||
+ | [SecurityType] 167 = FUT (FUTURE) | ||
+ | [OrderQty] 38 = 1 | ||
+ | [OrdType] 40 = 1 (MARKET) | ||
+ | [TransactTime] 60 = 20130222-18: | ||
+ | [HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION) | ||
+ | [CustomerOrFirm] 204 = 0 (CUSTOMER) | ||
+ | </ | ||
+ | Flatten Order Fill | ||
+ | < | ||
+ | << 2/22/2013 12:51:28 PM [fixexecutionreport] 34=538|49=T4|56=T4Example|50=T4FIX|52=20130222-18: | ||
+ | [FIXEXECUTIONREPORT] | ||
+ | [MsgSeqNum] 34 = 538 | ||
+ | [SenderCompID] 49 = T4 | ||
+ | [TargetCompID] 56 = T4Example | ||
+ | [SenderSubID] 50 = T4FIX | ||
+ | [SendingTime] 52 = 20130222-18: | ||
+ | [TargetLocationID] 143 = UK | ||
+ | [Account] 1 = Account1 | ||
+ | [ClOrdID] 11 = fn-634971342882072305 | ||
+ | [ExecID] 17 = 70184: | ||
+ | [ExecType] 150 = F | ||
+ | [OrderID] 37 = DF0E0564-9063-4C02-8F21-071C4DE1C419 | ||
+ | [OrdStatus] 39 = 2 (FILLED) | ||
+ | [SecurityID] 48 = CME_20130300_ZCH3 | ||
+ | [Symbol] 55 = ZC | ||
+ | [SecurityExchange] 207 = CME_C | ||
+ | [MaturityMonthYear] 200 = 201303 | ||
+ | [TimeInForce] 59 = 0 (DAY) | ||
+ | [SecurityDesc] 107 = Corn Mar13 | ||
+ | [Side] 54 = 2 (SELL) | ||
+ | [SecurityType] 167 = FUT (FUTURE) | ||
+ | [OrderQty] 38 = 1 | ||
+ | [OrdType] 40 = 1 (MARKET) | ||
+ | [LastPx] 31 = 69475 | ||
+ | [LastShares] 32 = 1 | ||
+ | [CumQty] 14 = 1 | ||
+ | [LeavesQty] 151 = 0 | ||
+ | [TransactTime] 60 = 20130222-18: | ||
+ | [HandlInst] 21 = 1 (AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION) | ||
+ | [CustomerOrFirm] 204 = 0 (CUSTOMER) | ||
+ | [ContraTrader] 337 = TRADE | ||
+ | [ContraBroker] 375 = CME000A | ||
+ | </ | ||
+ | Further details on the tags used for this order type are described in the dictionary of the New Order Single message. | ||
+ | |||
+ | [[developers: | ||