Reflector contains a monolithic FIX message parser which interprets sequences of bytes and translates them into possible order actions.
It is compatible with all current FIX protocol versions without needing to differentiate them. It handles all current FIX venues (except RBS RFQ) while rarely differentiating them. It performs deserialization, field parsing, order action interpretation, and constraint/error checking all in one go. It preserves all field locations, so that it can write back to arbitrary fields later if necessary. Since this is a real time application, Reflector does all this without touching the heap.
Every Session Type except DATA requires inspection by the FIX Parser: LOGON, PASS_TKR, PASS_MKR, TAKER, MAKER, & COPY.
The messages within each SessionType are separated further by their direction of transit:
Reflector is only allowed to alter the semantics of outbound FIX messages.
When it alters them, it always alters in the direction of voiding an order action (TAKER), voiding an execution (MAKER), or changing passwords (LOGON, PASS_TKR, PASS_MKR). Reflector shall never change the identity of a quote, order, or execution. On inbound FIX messages, the only fields that Reflector is allowed to alter are Text[58] and Checksum[10]. This is predicated on the assumption that text fields have no semantics.
Parser behaviour necessarily varies depending on the
On the outbound direction of a session in logon state, the only allowed messages are Logon[A] and Logout[5]. Logon[A] messages are inspected. Logout[5] messages are ignored. If any other message is received, the result is session termination. On an outbound Logon[A] message, a credential is deduced and looked up using the ordered triple { ExchangeCode, COMP_ID, SUB_ID }.
If a credential is not found, or if the credential is disabled, or if any risk pools containing the credential is in a UNPLUGGED state, or if password translation is enabled and password match failed, then the session is terminated. Otherwise, the message passes through.
| Flag | Presence | Field | Type |
|---|---|---|---|
| COMP_ID | Required | SenderCompID[49] | STRING |
| SUB_ID | Optional | SenderSubID[50] | STRING |
| PASSWORD | Optional | Password[554] | STRING |
| NEW_PASSWORD | Optional | NewPassword[925] | STRING |
Password translation is an optional feature where the trader is not provided the venue's FIX logon password. Instead, the trader is provisioned a different password of the same length. On logon, Reflector checks for the fake password. Upon matching, it overwrites the fake password with the real password. |
| EBS & Reuters utilize a session-in-session scheme where the inner session must be logged onto using the UserRequest[BE] message. In practice, almost everyone uses the same credentials for the outer and inner sessions. Reflector requires that this be the case, and performs password translation again on the UserRequest[BE] message. Refer below for more details. |
On the inbound direction of a session in logon state, the only allowed messages are Logon[A] and Logout[5]. Logon[A] messages are inspected. Logout[5] messages are ignored. If any other message is received, the result is session termination.
On an inbound Logon[A] message, a credential is deduced and looked up using the ordered triple { ExchangeCode, COMP_ID, SUB_ID }. If a credential is not found, or if the credential is disabled, or if any risk pools containing the credential is in a UNPLUGGED state, the session is terminated. Otherwise, the message passes through, and the session is bound to the credential, inheriting its SessionType.
| Flag | Presence | Field | Type |
|---|---|---|---|
| COMP_ID | Required | SenderCompID[49] | STRING |
| SUB_ID | Optional | SenderSubID[50] | STRING |
EBS & Reuters have a unique password changing process whereby traders must log in to change passwords with a UserRequest[BE] message. The SessionTypes PASS_TKR & PASS_MKR handle this contingency for PBs who do not wish for their clients to know the real logon passwords:
| Message Name | MsgType[35] | Action | Explanation |
|---|---|---|---|
| Logon | A | Drop session | Outbound risk message with risk implications is banned. |
| NewOrderSingle | D | Drop session | Outbound risk message with risk implications is banned. |
| QuoteResponse | AJ | Drop session | Outbound risk message with risk implications is banned. |
| NewOrderList | E | Drop session | Outbound risk message with risk implications is banned. |
| NewOrderMultileg | AB | Drop session | Outbound risk message with risk implications is banned. |
| ExecutionReport | 8 | Drop session | Outbound risk message with risk implications is banned. |
| ExecutionAcknowledgement | BN | Drop session | Outbound risk message with risk implications is banned. |
| Logout | 5 | Change session type |
|
| everything else | - | Change new password |
|
Inbound messages on tcp sessions in password changing mode are completely unscreened with one exception: on detection of Logon[A] message, the stream terminates immediately.
On an outbound taker stream, potential order actions are inspected.
| Message Name | MsgType[35] | Action | Explanation |
|---|---|---|---|
| Logon | A | Drop session | Trader already logged on |
| ExecutionReport | 8 | Drop session | Maker exec submission |
| NewOrderSingle | D | Inspect | New order submission request |
| QuoteResponse | AJ | Inspect | New order submission request |
| OrderCancelReplaceRequest | G | Inspect | Existing order modication request |
| NewOrderList | E | Overwrite | Not yet implemented |
| NewOrderMultileg | AB | Overwrite | Not yet implemented |
| Quote | S | Overwrite | Illegal |
| MassQuote | i | Overwrite | Illegal |
| OrderMassActionRequest | CA | Inspect | Block unsupported actions |
Notably missing from this list is OrderCancelRequest[F]. It is omitted because it has no risk implications. |
| Flag | Presence in D | Presence in AJ | Presence in G | Field | Type |
|---|---|---|---|---|---|
| POSS_DUPE | Optional | Optional | Optional | PossDupFlag[43], PossResend[97] | BOOL |
| SEQ_NUM | Required | Required | Required | MsgSeqNum[34] | INT |
| ACCOUNT | Optional | Optional | Optional | Account[1], PartyRole[452], etc | STRING |
| ALLOC_ACCT | BANNED | BANNED | BANNED | AllocAccount[79] | STRING |
| ORD_TYPE | Required | - | Optional | OrdType[40] | ENUM |
| QUOTE_RESP_TYPE | - | Required | - | QuoteRespType[694] | ENUM |
| ORIG_ORDER_ID | - | - | Optional | OrigClOrdID[41] | STRING |
| ORDER_ID | Required | Optional | Required | ClOrdID[11] | STRING |
| QUOTE_RESP_ID | - | Optional | - | QuoteRespID[693] | STRING |
| SYMBOL | Required | Required | Required | Symbol[55], SecurityID[48] | STRING, INT |
| CURRENCY | Optional | Required | Optional | Currency[15] | STRING |
| SIDE | Required | Required | Required | Side[54] | ENUM |
| CONTRACT_MULTIPLIER | Optional | Optional | Optional | ContractMultiplier[231] | FLOAT |
| PRICE | Optional | Optional | Required | Price[44] | FLOAT |
| PRICE | - | Optional | - | BidPx[132], OfferPx[133] | FLOAT |
| PRICE_TWO | BANNED | BANNED | BANNED | Price2[640] | FLOAT |
| PRICE_TWO | - | BANNED | - | BidPx2[. . . ], OfferPx2[. . .] | FLOAT |
| QUANTITY | Required | Optional | Required | OrderQty[38] | FLOAT |
| QUANTITY | - | Optional | - | BidSize[134], BidSize[135] | FLOAT |
| QUANTITY_TWO | BANNED | BANNED | BANNED | OrderQty2[192] | FLOAT |
| QUANTITY_TWO | - | BANNED | - | BidSize2[. . . ], BidSize2[. . . ] | FLOAT |
| SETTLE_DATE | Optional | Optional | Optional | SettlDate[64] | DATE |
| SETTLE_DATE_TWO | BANNED | BANNED | BANNED | SettlDate2[193] | DATE |
| NUM_LEGS | Optional | Optional | Optional | NoLegs[555] | INT |
On an outbound risk-carrying Taker message, the parser acts as if the following events occur in sequence:
Order state is sent to the Risk Instance for assessment. On failure, order action will be blocked with whichever reason it provides.
When an outbound taker message is found to be illegal, the following taker block procedure is performed:
The only supported MassActionType[1373] is CANCEL[3]. All appearances of that field will be coerced to the supported value.
On an inbound taker stream, Reflector accepts updates (including rejects) to live orders and fill notications.
| Message Name | MsgType[35] | Action | Explanation |
|---|---|---|---|
| Logon | A | Drop session | Trader already logged on |
| NewOrderSingle | D | Drop session | Maker new order |
| QuoteResponse | AJ | Drop session | Maker new order |
| NewOrderList | E | Drop session | Maker new order |
| NewOrderMultileg | AB | Drop session | Maker new order |
| ExecutionReport | 8 | Update | Order update + fill insert |
| TradeCaptureReport | AE | Update | Fill Insert |
| OrderMassCancelReport | r | Update | Order revoke |
| OrderCancelReject | 9 | Nothing | Nothing |
| Reject | 3 | Update | Order revoke |
| BusinessMessageReject | j | Update | Order revoke |
Reflector models live and filled outlays separately. This means that on an ExecutionReport[8], two independent potential updates of separate records could be performed: one to update the state of the live order, another to insert a fill. No attempt is made to track which fill belongs to which order.
A TradeCaptureReport[AE] is a pure fill update, uniquely identiable by its ExecID[17].
A ExecutionReport[8] is a potential TradeCaptureReport[AE], plus a mandatory live order state update; where the fill portion is identified by the same ExecID[17] and the live portion is identified by one or more of ClOrdID[11], OrigClOrdID[41], or QuoteRespID[693].
If Text[58] exists, and Reflector has previously blocked the identified order, then it's content will be replaced by Reflector's ErrorCode.
| Flag | Presence in 8 | Presence in AE | Field | Type |
|---|---|---|---|---|
| POSS_DUPE | Optional | Optional | PossDupFlag[43], PossResend[97] | BOOL |
| SEQ_NUM | Required | Required | MsgSeqNum[34] | INT |
| TEXT | Optional | - | Text[58] | STRING |
| ACCOUNT | Optional | Optional | Account[1], PartyRole[452], etc | STRING |
| ALLOC_ACCT | BANNED | BANNED | AllocAccount[79] | STRING |
| ORD_TYPE | Required | - | OrdType[40] | ENUM |
| ORD_STATUS | Required | - | OrdStatus[39] | ENUM |
| EXEC_TYPE | Required | - | ExecType[190] | ENUM |
| MATCH_STATUS | - | Required | MatchStatus[573] | ENUM |
| ORIG_ORDER_ID | Optional | - | OrigClOrdID[41] | STRING |
| ORDER_ID | Optional | - | ClOrdID[11] | STRING |
| QUOTE_RESP_ID | Optional | - | QuoteRespID[693] | STRING |
| EXEC_ID | Required | Required | ExecID[17] | STRING |
| SYMBOL | Required | Required | Symbol[55], SecurityID[48] | STRING, INT |
| CURRENCY | Optional | Optional | Currency[15] | STRING |
| SIDE | Required | Required | Side[54] | ENUM |
| CONTRACT_MULTIPLIER | Optional | Optional | ContractMultiplier[231] | FLOAT |
| PRICE | Optional | - | Price[44] | FLOAT |
| PRICE_TWO | BANNED | - | Price2[640] | FLOAT |
| QUANTITY | Required | - | OrderQty[38] | FLOAT |
| QUANTITY_TWO | BANNED | - | OrderQty2[192] | FLOAT |
| LEAVES_QUANTITY | Required | - | LeavesQty[151] | FLOAT |
| LEAVES_QUANTITY_TWO | BANNED | - | LeavesQty2[...] | FLOAT |
| LAST_PRICE | Optional | Required | LastPx[31] | FLOAT |
| LAST_PRICE_TWO | BANNED | BANNED | LastPx2[...] | FLOAT |
| LAST_QUANTITY | Optional | Required | LastQty[32] | FLOAT |
| LAST_QUANTITY_TWO | BANNED | BANNED | LastQty2[...] | FLOAT |
| SETTLE_DATE | Optional | Required | SettlDate[64] | DATE |
| SETTLE_DATE_TWO | BANNED | BANNED | SettlDate2[193] | DATE |
| NUM_LEGS | Optional | Optional | NoLegs[555] | INT |
On OrderMassCancelReport[r], on every ClOrdID[11] and OrigClOrdID[41] observed, the corresponding live order is looked up and invalidated. On OrderCancelReject[9], no order actions are taken; but if fields ClOrdID[11] and Text[58] exist, and Reflector has previously blocked an order identified by ClOrdID[11], then the value of Text[58] will be replaced by Reflector's ErrorCode.
| Flag | Presence in 8 | Presence in AE | Field | Type |
|---|---|---|---|---|
| TEXT | - | Optional | Text[58] | STRING |
| ORIG_ORDER_ID | Optional | - | OrigClOrdID[41] | STRING |
| TEXT | Optional | Optional | ClOrdID[11] | STRING |
Reject[3] & BusinessMessageReject[j] are handled in the exact same way. If a corresponding live order is found when RefSeqNum[45] will be looked up, it will be invalidated. Additionally, if Reflector has previously blocked an order identified by RefSeqNum[45], then the value of Text[58], if it exists, will be replaced by Reflector's ErrorCode.
| Flag | Presence in 8 | Presence in AE | Field | Type |
|---|---|---|---|---|
| TEXT | Optional | Optional | Text[58] | STRING |
| REF_SEQ_NUM | Required | Required | RefSeqNum[45] | INT |
On an outbound maker stream, only ExecutionReport[8] & ExecutionAcknowledgement[BN] are meaningful to inspect.
| Message Name | MsgType[35] | Action | Explanation |
|---|---|---|---|
| Logon | A | Drop session | Trader already logged on |
| NewOrderSingle | D | Drop session | Taker order submission |
| QuoteResponse | AJ | Drop session | Taker order submission |
| NewOrderList | E | Drop session | Taker order submission |
| NewOrderMultileg | AB | Drop session | Taker order submission |
| ExecutionReport | 8 | Inspect | New execution request |
| ExecutionAcknowledgement | BN | Inspect | New execution request |
Takers need to deal with both orders and executions (fills). Makers deal with only executions, but must handle the rare case where they could be rolled back.
| Flag | Presence in 8 | Presence in BN | Field | Type |
|---|---|---|---|---|
| POSS_DUPE | Optional | Optional | PossDupFlag[43], PossResend[97] | BOOL |
| SEQ_NUM | Required | Required | MsgSeqNum[34] | INT |
| ACCOUNT | Optional | Optional | Account[1], PartyRole[452], etc | STRING |
| ALLOC_ACCT | BANNED | BANNED | AllocAccount[79] | STRING |
| EXEC_TYPE | Required | - | ExecType[190] | ENUM |
| EXEC_ACK_STATUS | - | Required | ExecAckStatus[1036] | ENUM |
| ORDER_ID | Required | Required | ClOrdID[11] | STRING |
| EXEC_ID | Required | Required | ExecID[17] | STRING |
| SYMBOL | Required | Required | Symbol[55], SecurityID[48] | STRING, INT |
| CURRENCY | Required | Required | Currency[15] | STRING |
| SIDE | Required | Required | Side[54] | ENUM |
| CONTRACT_MULTIPLIER | Optional | Optional | ContractMultiplier[231] | FLOAT |
| PRICE | Optional | Optional | Price[44] | FLOAT |
| PRICE_TWO | BANNED | BANNED | Price2[640] | FLOAT |
| QUANTITY | Optional | Optional | OrderQty[38] | FLOAT |
| QUANTITY_TWO | BANNED | BANNED | OrderQty2[192] | FLOAT |
| LAST_PRICE | Required | Required | LastPx[31] | FLOAT |
| LAST_PRICE_TWO | BANNED | BANNED | LastPx2[...] | FLOAT |
| LAST_QUANTITY | Required | Required | LastQty[32] | FLOAT |
| LAST_QUANTITY_TWO | BANNED | BANNED | LastQty2[...] | FLOAT |
| SETTLE_DATE | Required | Required | SettlDate[64] | DATE |
| SETTLE_DATE_TWO | BANNED | BANNED | SettlDate2[193] | DATE |
| NUM_LEGS | Optional | Optional | NoLegs[555] | INT |
On an outbound maker risk-carrying message, the parser acts as-if the following events occur in sequence:
When an outbound maker execution message is found to be illegal, the following maker block procedure is performed:
Some venues (e.g. Fastmatch & FXall) require special handling. The goal, is to have the venue acknowledge the invalidated execution/message in some way. The venue's response, in decreasing order or preference, should be one of the following:
On an inbound maker stream, we basically check for various ways an outbound accept could be invalidated:
| Message Name | MsgType[35] | Action | Explanation |
|---|---|---|---|
| Logon | A | Drop session | Trader already logged on |
| ExecutionReport | 8 | Update | New order + fill update |
| ExecutionAcknowledgement | BN | Update | Fill update |
| DontKnowTrade | Q | Update | Revoke fill via ExecID[17] |
| OrderTimeOut | OT | Update | Revoke fills via ClOrdID[11] |
| Currenex OrderTimeOut | U3 | Update | Revoke fills via ClOrdID[11] |
| Reject | 3 | Update | Revoke fill via MsgSeqNum[34] |
| BusinessMessageReject | j | Update | Revoke fill via MsgSeqNum[34] |
Some venues use ExecutionReport[8] as new (FXall), those are skipped. Some venues use ExecutionReport[8] as ack, those are inspected. Some venues use ExecutionReport[8] as both new and ack (Hotspot), those are included inspected too. Additionally, if Reflector has previously blocked an execution identified by ExecID[17], then value of Text[58], if it exists, will be replaced by Reflector's ErrorCode.
| Flag | Presence in 8 | Presence in BN | Field | Type |
|---|---|---|---|---|
| POSS_DUPE | Optional | Optional | PossDupFlag[43], PossResend[97] | BOOL |
| TEXT | Optional | Optional | Text[58] | STRING |
| ACCOUNT | Optional | Optional | Account[1], PartyRole[452], etc | STRING |
| ALLOC_ACCT | BANNED | BANNED | AllocAccount[79] | STRING |
| EXEC_TYPE | Required | - | ExecType[190], HSFXTradeStatus[7226] | ENUM |
| EXEC_ACK_STATUS | - | Required | ExecAckStatus[1036] | ENUM |
| ORDER_ID | Required | Required | ClOrdID[11] | STRING |
| EXEC_ID | Required | Required | ExecID[17] | STRING |
| SYMBOL | Required | Required | Symbol[55], SecurityID[48] | STRING, INT |
| CURRENCY | Optional | Optional | Currency[15] | STRING |
| SIDE | Required | Required | Side[54] | ENUM |
| CONTRACT_MULTIPLIER | Optional | Optional | ContractMultiplier[231] | FLOAT |
| PRICE | Optional | Optional | Price[44] | FLOAT |
| PRICE_TWO | BANNED | BANNED | Price2[640] | FLOAT |
| QUANTITY | Optional | Optional | OrderQty[38] | FLOAT |
| QUANTITY_TWO | BANNED | BANNED | OrderQty2[192] | FLOAT |
| LAST_PRICE | Required | Required | LastPx[31] | FLOAT |
| LAST_PRICE_TWO | BANNED | BANNED | LastPx2[...] | FLOAT |
| LAST_QUANTITY | Required | Required | LastQty[32] | FLOAT |
| LAST_QUANTITY_TWO | BANNED | BANNED | LastQty2[...] | FLOAT |
| SETTLE_DATE | Required | Required | SettlDate[64] | DATE |
| SETTLE_DATE_TWO | BANNED | BANNED | SettlDate2[193] | DATE |
| NUM_LEGS | Optional | Optional | NoLegs[555] | INT |
The handling of an inbound maker execution update is both complex (because we are essentially rescinding historic actions) and trivial (because things never actually get modified). For the sake of completeness, Reflector handles the complexity, even though it can never happen. The risk instance, upon processing a maker execution update request, can emit the following warnings:
ExecID[17] will be looked up and execution invalidated if not already invalid. Additionally, if Reflector has previously blocked an execution identified by ExecID[17], then value of Text[58], if it exists, will be replaced by Reflector's ErrorCode.
| Flag | Presence | Field | Type |
|---|---|---|---|
| TEXT | Optional | Text[58] | STRING |
| EXEC_ID | Required | ExecID[17] | STRING |
ClOrdID[11] will be looked up and every associated execution invalidated. For Currenex only, U3 will be looked up instead of OT.
| Flag | Presence in OT | Presence in U3 | Field | Type |
|---|---|---|---|---|
| ORDER_ID | Required | Required | ClOrdID[11] | STRING |
Reject[3] & BusinessMessageReject[j] are handled in the exact same way. If a corresponding execution is found when RefSeqNum[45] will be looked up, it will be invalidated. Additionally, if Reflector has previously blocked an execution identified by RefSeqNum[45], then the value of Text[58], if it exists, will be replaced by Reflector's ErrorCode.
| Flag | Presence in 8 | Presence in AE | Field | Type |
|---|---|---|---|---|
| TEXT | Optional | Optional | Text[58] | STRING |
| REF_SEQ_NUM | Required | Required | RefSeqNum[45] | INT |
SessionType::COPY denotes special sessions reserved for dropcopy fill injection into Reflector.
Dealt currency status is tricky to determine because traders and venues alike tend to omit the Currency[15] field. This is fine when the intention is to convey the base ccy order that it defaults to anyway, but sometimes the field is similarly omitted for a term ccy order, for example when this is established in a previous message or a different (quote) stream.
For this reason, new order requests on taker sessions that are responding to quotes must populate Currency[15].
On maker sessions, outbound executions must populate Currency[15] too because the inbound NewOrderSingle is similarly unscreened.
| In the inbound direction on both taker and maker sessions, since we are powerless to restrain the venue, Reflector must rely on previouly tested evidence that the venue will populate Currency[15] on a term order confirmation or term execution ack. |
Some customers wish to map to multiple accounts per session, through Account[1] or otherwise. This is supported through Reflector, but it must know the complete set of allowed account tag values and what risk pool they belong to.
On a credential with account multiplexing set up, any order submission with a missing or unknown account tag will be rejected.