Professional Documents
Culture Documents
EMAPI - Rev F
EMAPI - Rev F
This document describes the semantics of the EMAPI protocol and the syntax
of the session related EMAPI messages.
Restricted External
EMAPI Protocol
Rev F April 17, 2009
2 (55)
Cinnober Financial Technology AB
Restricted External
Table of Contents
1
Messages ......................................................................................10
1.1
Message Types....................................................................... 10
1.2
Session ........................................................................................12
2.1
2.2
Session Establishment.............................................................. 12
2.2.1
Pre Logon........................................................................... 12
2.2.2
Logon ............................................................................... 13
2.3
2.4
Change Password.................................................................. 14
2.4.2
2.4.3
On-behalf........................................................................... 15
2.5
2.6
2.7
2.5.1
2.7.1
Introduction ......................................................................... 17
3.1.1
Flows ................................................................................ 17
3.1.2
Subscription Group................................................................ 17
3.1.3
Sequence Number................................................................. 17
3.1.4
Filtering ............................................................................ 17
3.1.5
3.2
Subscription Establishment........................................................ 18
3.3
3.4
3.2.1
3.4.1
3.5
EMAPI Protocol
Rev F April 17, 2009
Subscriptions.................................................................................17
3.1
On-behalf........................................................................... 19
Subscription Recovery.............................................................. 19
3.5.1
3.5.2
3.5.3
3.6
3.7
3.8
3.8.2
Replay .............................................................................. 22
4.2
4.3
4.4
Restricted External
4.5
4.6
4.7
Trading ........................................................................................37
5.1
Orders............................................................................... 37
5.1.2
Quotes .............................................................................. 37
5.2
5.3
5.4
5.3.1
5.5
5.4.1
5.4.2
5.4.3
5.4.4
5.5.2
Order/Quote Key.................................................................. 42
5.6
5.7
5.7.2
5.7.3
5.7.4
5.7.5
Book
46
5.7.6
5.7.7
5.7.10
TradeReportReq/Rsp WaitForOtherSide=false.............................. 49
5.7.11
5.7.12
TradeUpdateReq/Rsp............................................................. 50
5.7.13
RequestForQuoteReq/Rsp (type=PRIVATE).................................... 51
EMAPI Protocol
Rev F April 17, 2009
MarketByLevel ..................................................................... 48
5.7.9
Order Routing................................................................................52
6.1
5.7.8
9.1.2
9.1.3
4 (55)
Cinnober Financial Technology AB
Restricted External
9.2
EMAPI Protocol
Rev F April 17, 2009
5 (55)
Cinnober Financial Technology AB
Restricted External
Intended Audience
The information in this document is aimed towards EMAPI client developers.
Related Documents
Name
Description
TagWire Specification
EMAPITransactions.html
EmapiTransactions.xml
EmapiTransactions.xsd
Author
Comment
Johan
Asplund
EMAPI Protocol
Rev F April 17, 2009
6 (55)
Cinnober Financial Technology AB
Restricted External
Revision State
Author
Comment
Cinnober
EMAPI Protocol
Rev F April 17, 2009
7 (55)
Cinnober Financial Technology AB
Restricted External
Revision State
Author
Comment
Cinnober
Cinnober
EMAPI Protocol
Rev F April 17, 2009
8 (55)
Cinnober Financial Technology AB
Restricted External
Revision State
Author
Comment
Cinnober
Cinnober
Initial version.
Description
Client
Order Book
Server
EMAPI Protocol
Rev F April 17, 2009
9 (55)
Cinnober Financial Technology AB
Restricted External
Messages
All interaction between a Client and a Server is done using messages.
1.1
Message Types
Following types of messages exists:
code:
Ok: Indicates that the Server has completed the processing of the
request successfully.
Server.
Note: ResponseMessage
1.2
Message Header
Each message starts with a header.
Name
Position
Length
Content
magicSign
headerVersion
msgSize
clientTxRef
12
EMAPI Protocol
Rev F April 17, 2009
10 (55)
Cinnober Financial Technology AB
Restricted External
Name
Position
Length
Content
A response sent back by Server will contain
the same value as set in the request.
In the special case the request is a
subscription request all events resulting
from this subscription (as well as the
subscription response) will contain the
same value as set in the subscription
request.
msgType
contentType
16
17
Message type:
compressed
18
EMAPI Protocol
Rev F April 17, 2009
11 (55)
Cinnober Financial Technology AB
Restricted External
Session
All EMAPI interaction between an EMAPI Client and an EMAPI Server is done
inside one or more user sessions (except when establishing a user session (see
section 2.2) and password change may be done outside a session (see section
2.4.1)).
The number of sessions and what session types a user is allowed to use is
provided by the organization responsible for the concerned TRADExpress
installation.
If the Servers are partitioned over several session types (see section 2.1)
and/or subscription groups (see section 3.1.2) a user may need to establish
several user sessions with different Servers.
2.1
private data.
1
private data.
Note:
2.2
Session Establishment
A session is established by performing the steps described in this section.
2.2.1
Pre Logon
Note:
To know which Server that a Client shall use for a user session, a pre logon
step shall be performed by the Client against one of the TCP/IP address
provided by the organization responsible for the concerned TRADExpress
installation.
After performing a TCP/IP connect the Client shall send in an
TaxPreLogonReq. The request contains:
12 (55)
Cinnober Financial Technology AB
Restricted External
2.2.2
by the Server.
Note:
One of the reasons for the pre logon step is to ensure a session load
balancing on the available Servers.
Note:
Logon
To know which Server that a Client shall use for a user session the above pre
logon step is used or if this step is not configured for the concerned
TRADExpress installation the Client shall use the TCP/IP address provided by
the organization responsible for the concerned TRADExpress installation.
After performing a TCP/IP connect the Client shall send in a TaxLogonReq.
The request should be sent immediately after the connect.
The request contains:
ticket: Provided by the pre logon step see above section. N.B. Only
loginStatus:
set to true.
section 2.4.1.
EMAPI Protocol
Rev F April 17, 2009
13 (55)
Cinnober Financial Technology AB
Restricted External
Note:
2.3
Session Surveillance
The Client is responsible for sending TaxHeartbeatReq after logging in. A
suggested interval (in seconds) is specified in TaxLogonRsp (see section
2.2.2).
The request contains:
Note:
Other EMAPI requests that are sent by the Client do not replace the
need to send TaxHeartbeatReq.
The Server starts a heartbeat timer after a successful logon. The timer value
is set to a value that is equal or greater than what is specified in
TaxLogonRsp; maxLostHeartbeats * clientHbtInterval. If this heartbeat
timer expires the Server will terminate the session and the TCP connection.
The Client shall initiate a failover when it does not receive a response to a
TaxHeartbeatReq within a configurable time (should be configured in the
Client).
The Server to failover is provided in the same way as at the initial logon, i.e.
by using the pre logon step (if this step is configured in the TRADExpress
installation) or by using one of the alternative addresses provided by the
organization responsible for the concerned TRADExpress installation.
2.4
Session Processing
This section contains session related information that is not part of
establishment, surveillance, recovery or termination.
2.4.1
Change Password
To change password (e.g. when the LoginStatus field in TaxLogonRsp (see
section 2.2.2) indicates INITIAL_LOGIN or when the password is soon
expiring) the Client shall send in ChangePasswordReq. This request contains:
EMAPI Protocol
Rev F April 17, 2009
14 (55)
Cinnober Financial Technology AB
Restricted External
2.4.2
2.4.3
On-behalf
A user may be configured to send in some requests on-behalf of another user
of the same or other member. When doing so the user sets a member and/or
user field in the request.
2.5
Session Recovery
The session establishment at failover is done in the same way as initial
establishment, see section 2.2.
2.5.1
Outstanding Requests
A session may fail after the Client has sent in some request(s) but before the
Client has received the response(s) to these requests. In such case the Client
shall resend the concerned outstanding requests with the possDup (=possible
duplicate) field set.
Note:
There are some request that do not support possDup because they
relates to the session setup or similar.
When receiving a request with the possDup field set the Server compares the
request with saved requests. Following is compared:
request type
If a request is found, which is equal to the resent request with the possDup
field set, the Server returns the response either immediately if the request
has already been completely served or when the ongoing request has been
completely served. That is, the Server will answer with the same response
EMAPI Protocol
Rev F April 17, 2009
15 (55)
Cinnober Financial Technology AB
Restricted External
Note:
The Client shall only set the possDup field on requests for which the
Client has not received any response on an earlier session
establishment. This due to that the possible duplicate checking in the
Server adds latency to the transaction.
The number of requests the Server keeps for a member and
possDupSessId combination to be used for possible duplicate checking
2.6
Session Termination
To terminate a session TaxLogoutReq shall be sent to the Server.
The response is a ResponseMessage 7 and after that has been received the
TCP connection shall be disconnected.
2.7
2.7.1
EMAPI Protocol
Rev F April 17, 2009
16 (55)
Cinnober Financial Technology AB
Restricted External
Subscriptions
To receive events from a Server a Client must set up subscriptions for the
concerned events and possible replay events.
3.1
Introduction
Following base concepts exists for the subscription/replay functionality.
3.1.1
Flows
TRADExpress sends events on several different flows. The flows that exist
are presented in respective sections that describe the functionality related to
the concerned flows.
For each flow it is defined which event types that may occur.
Note:
A flow can support replay and/or current value. On a flow that supports:
3.1.2
Replay it is possible to replay all earlier events that has happened since
the TRADExpress instance was started see section 3.5.
Subscription Group
On some flows TRADExpress sends events on different subscription groups.
Note:
3.1.3
The subscription groups that exist are provided in reference data - see
section 4.
Sequence Number
Each event has a sequence number that is unique on the concerned flow and
subscription group (if TRADExpress sends events on different subscription
groups for the concerned flow)
The sequence numbers are positive integers and are monotonically increasing
but are not always increasing by one. I.e. there will be gaps in the sequence
numbers (e.g. a user might not be allowed to receive certain events due to
authorization restrictions) 8 .
Note:
3.1.4
There exists one exception to above: Events that deliver the current
value (see section 3.2.1) have a non valid sequence number.
Filtering
A session can choose to only subscribe to events related to certain order
books in a subscription group.
3.1.5
Information in Events
All events contain following information:
8
This is no problem as TCP provides reliable, ordered delivery of a stream of bytes, i.e.
there is no need to detect sequence number gaps as this is already done by TCP.
EMAPI Protocol
Rev F April 17, 2009
17 (55)
Cinnober Financial Technology AB
Restricted External
Note:
3.2
Events that deliver the current value (see section 3.2.1) have a non
valid sequenceNumber.
Subscription Establishment
To subscribe to events the Client sends a TaxSnapshotSubscribeReq. The
request contains:
publish events on any subscription group on the concerned flow this field
shall be set to zero. See also section 3.1.2.
request:
SUBSCRIPTION: The Server will send real time events. Mainly used for
flows that supports replay but may also be used for flows that support
current value (if the Client isnt interested in the current value).
received. If the current value hasnt changed, since last time the Client
fetched the current value, no events will be received inside the current
value framing (see section section 3.2.1).
To make it possible to match the events and framing messages received from
the Server with a subscription the EMAPI header contains a clientTxRef field
(see section 1.2) that is set by the Client in the header of the subscription
request and is returned by the Server in the header of resulting messages
(response, framing and event messages).
Note: TaxSnapshotSubscribeRsp
If the Client intends to receive all events on a flow that supports replay
it must always initiate a replay after/before initiating the subscription
see section 3.5.
EMAPI Protocol
Rev F April 17, 2009
18 (55)
Cinnober Financial Technology AB
Restricted External
Note:
3.2.1
If a Client has subscriptions (during the same time) that interleave, the
Client will receive some events that are identical (except possibly the
txClientRef field in the header).
code: Set to Ok if the Server has successfully delivered all events of the
current value. All other values are indicating that the Server has failed to
deliver all events of the current value.
message: A text description explaining more in detail why the Server has
failed to deliver all events of the current value. N.B. If the code is Ok the
3.3
Subscription Surveillance
The Server sends information about the status for each flow and subscription
group using the SystemStatusEvent message. Following statuses exists:
UNAVAILABLE: The Server can not any longer deliver events for the
3.4
Subscription Processing
This section contains subscription related information that is not part of
establishment, surveillance, recovery or termination.
3.4.1
On-behalf
A user may be configured to be able to subscribe to private events that are
sent to another member. When doing so the user sets a member field in the
TaxSnapshotSubscribeReq.
3.5
Subscription Recovery
To recover events that have been sent by the Server during times when the
Client hasnt had any subscription, the Client requests the Server to replay
events.
Note:
EMAPI Protocol
Rev F April 17, 2009
19 (55)
Cinnober Financial Technology AB
Restricted External
To replay events (on a flow that supports replay) the Client sends a
TaxReplayReq. The request contains:
Zero - if the Client hasnt received any events (e.g. at Client startup).
The sequence number of the last received event when the Client has
received events earlier (e.g. if the Client is recovering after a
failover).
3.5.1
Replay Framing
A TaxReplayStartEvent message precedes any events that are replayed. This
message contains:
3.5.2
code: Set to Ok if the Server has successfully replayed all events. All other
message: A text description explaining more in detail why the Server has
failed to replay all events. N.B. If the code is Ok the string will be Ok.
values are indicating that the Server has failed to replay all events.
Replay Sequences
It is configurable per TRADExpress installation how many events that can be
replayed as a result of one Client request.
If the number of events to be delivered is greater than this configuration the
Server will only deliver this configured number of events and set the
nextSequence field in the TaxReplayStartEvent message.
10
EMAPI Protocol
Rev F April 17, 2009
Restricted External
The Client shall then initiate a new replay setting the sequenceNumber field
in the TaxReplayReq message to the value of the field nextSequence in the
TaxReplayStartEvent message.
Note:
3.5.3
If the nextSequence field isnt set the Server has replayed all the
events that it knew of at the time when the replay was requested.
Synchronize Subscription/Replay
To avoid handling too much live and replayed data at the same time the
Client could:
1. Replay events until the nextSequence field isnt set in the
TaxReplayEndEvent message.
2. Setup the subscription.
3. If the lastPublishedSeqNo field in subscription response is greater than
the last sequence number received in the earlier replay, another replay is
initiated to get the missing events.
Restrictions
It is recommended to only replay from zero at client start up and during
extreme Client situations (e.g. Client is restarted clean). That is, if a Client
may be required to perform replay(s) it must:
3.6
Subscription Termination
To terminate a subscription TaxRemoveSubscriptionReq shall be sent to the
Server. This message contains:
3.7
Event Flows
Events on these flows are not published on any subscription groups (see also
section 3.1.2).
Flow
Current
Value/ Replay
SYSTEM_STATUS_FLOW
Current Value
3.8
SystemStatusEvent
3.8.1
11
EMAPI Protocol
Rev F April 17, 2009
Server
TaxSnapshotSubscribeReq --------------->|
TaxSnapshotSubscribeRsp ----------------|
|
TaxStartSnapshot
----------------|
<CurrentValue>Event
----------------|
Restricted External
|<--------------|<--------------:
:
|<--------------|<--------------|<--------------:
3.8.2
<CurrentValue>Event
<CurrentValue>Event
TaxEndSnapshot
<RealTime>Event
<RealTime>Event
----------------|
----------------|
:
:
----------------|
----------------|
----------------|
:
Replay
Client
Server
|---------------- TaxReplayReq
--------------->|
|<--------------- TaxReplayRsp
----------------|
|
|
|<--------------- TaxReplayStartEvent
----------------|
|<--------------- <Replayed>Event
----------------|
|<--------------- <Replayed>Event
----------------|
|<--------------- <Replayed>Event
----------------|
:
:
:
:
|<--------------- TaxReplayEndEvent
----------------|
|
|
|---------------- TaxReplayReq
--------------->|
|
* New replay based on information received in
|
|
previous TaxReplayEndEvent.
|
|
|
|<--------------- TaxReplayRsp
----------------|
|
|
|<--------------- TaxReplayStartEvent
----------------|
|<--------------- <Replayed>Event
----------------|
|<--------------- <Replayed>Event
----------------|
|<--------------- <Replayed>Event
----------------|
:
:
:
:
|<--------------- TaxReplayRsp
----------------|
EMAPI Protocol
Rev F April 17, 2009
22 (55)
Cinnober Financial Technology AB
Restricted External
Reference Data
The reference data is a set to static and semi-static data that contains the
necessary information for the trading system to operate.
The Reference Data Model is the object model used by servers in the trading
system. The reference data is also distributed to trading clients and it is
therefore necessary for a client to be aware of the reference data model.
This chapter describes the Reference Data Model. The model is divided into
three parts:
Members and Users. This section describes the relation between Members
and Users in the system.
Trading data and Trading rules. This part describes orderbooks, ticksize
tables and trading schedules.
Markets and Instruments. This part describes how the orderbooks relates
to instruments and markets. The division of orderbooks into Markets, Lists
and Segments are specific to the actual installation of the trading system.
4.1
Event Flows
Events on these flows are not published on any subscription groups (see also
section 3.1.2).
4.2
Flow
Current
Value/ Replay
Description
PUBLIC_GLOBAL_REFERENCE_DATA_FLOW
Current Value
Reference data
events.
4.3
EMAPI Protocol
Rev F April 17, 2009
23 (55)
Cinnober Financial Technology AB
Restricted External
4.4
4.5
Key Attribute is the attribute name within the object that is (can be)
used as key for this object type.
ServerGroup
AAA_TRADING
TAX_GRP_4
User
ServerProcess
CARL_TRADER
TAX2
UserPropertiesCategory
ServiceProfile
window_1
ALL_INSTRUMENTS
UserProperty
ServiceProfileEntry
Z4
PROFILE_1
24 (55)
Cinnober Financial Technology AB
Restricted External
EMAPI Protocol
Rev F April 17, 2009
25 (55)
Cinnober Financial Technology AB
Restricted External
Member
memberId:
AAA_TRADING*
memberType:
TRADING_AND_CLEARING
assiciatedMemberId:
serverGroupId:
TAX_GRP_2
tradingAccessProfileList:
subscriptionAccessProfileList:
User
userId:
CARL_TRADER*
AAA_TRADING
memberId
serverGroupId:
tradingAccessProfileList:
subscriptionAccessProfileList:
UserPropertiesCategory
categoryId: window_1
userId
CARL_TRADER
UserProperty
propertyId: Z4
userPropertiesCategoryId: window_1
Figure 2 Object relation for Members and Users.
Key Attribute
Unique Id
parentReference
Member
memberId
yes
null
User
userId
yes
memberId
UserPropertiesCategory
categoryId
no
userId
UserProperty
propertyId
no
userPropertyCategoryId
ServerGroup
The ServerGroup defines a group of servers. Each server is defined in the
child ServerProcess object. Each ServerProcess object may define a
serverType and which set of partitions that are handled by the
serverProcessId server. The set of partitions may be set to all, indicating
that the server can handle requests for all partitions (i.e concurrent server).
The serverProcessId contains the name of a system gateway process,
TAX1 for example.
The ServerGroup/ServerProcess objects are typically used to define a group
of gateway servers and are for load balancing. In this case, a Member/User is
assigned a ServerGroup that is used when connecting to the trading system.
ServerGroup
serverGruopId: TAX_GRP_4*
ServerProcess
serverProcessId: TAX7
serverGroupId:
TAX_GRP4
EMAPI Protocol
Rev F April 17, 2009
26 (55)
Cinnober Financial Technology AB
Restricted External
Key Attribute
Unique Id
parentReference
ServerGroup
serverGroupId
yes
null
ServerProcess
name
no
serverGroupId
ServiceProfile
The ServiceProfile object contains an id and a collection of
ServiceProfileEntry child objects. The ServiceProfile holds information
on which flows a Member/User that references this profile is allowed to
subscribe to.
A ServiceProfile is referenced ById from a Member or User.
The ServiceProfieEntry contains information on information which
orderbooks that are available within this ServiceProfileEntry.
The totally allowed information flow(s) and available orderbooks for a
ServiceProfile is the sum of the information flows for all
ServiceProfileEntry childs.
ServiceProfile
serviceProfileId: ALL_INSTRUMENTS*
ServiceProfileEntry
profileEntryId: CFT_STOCK
parentId:
ALL_INSTRUMENTS
4.6
Object
Key Attribute
Unique Id
parentReference
ServiceProfile
serviceProfileId
yes
null
ServiceProfileEntry
profileEntryId
no
parentId
EMAPI Protocol
Rev F April 17, 2009
27 (55)
Cinnober Financial Technology AB
Restricted External
OrderBookRuleGroup
OrderBookRuleGroupParameters
TradingSchedule
XCFT_L1_S1_1
SYSTEM_DEFAULT
NORMAL
OrderBookRoutingStrategy
SubscriptionGroup
orderInsert
47
StateTransition
PRE_OPEN
ProcessingSequence
OrderBook
TickSizeTable
AllowedRequestsGroup
PRE_OPEN
611
EUR
346
ProcessingSequenceOrderBookId
CombinationDefinitionLeg
TickSizeTableR ow
AllowedRequestsGroupRow
611
712
0-100
cancelOrder
EUR
Figure 5 Overview of the relations between orderboos and other trading related objects.
EMAPI Protocol
Rev F April 17, 2009
28 (55)
Cinnober Financial Technology AB
Restricted External
OrderBookRoutingStrategy
ProcessingSequence
serviceId:
orderInsert
orderbookRuleGroupId: XCFT_L1_S1_1
stateName:
PRE_OPEN
orderbookRuleGroupId: XCFT_L1_S1_1
OrderBook
orderBookId:
611*
orderbookRuleGroupId: XCFT_L1_S1_1
instrumentId: SE0000108656_ISIN_SEK_XCFT_DARK
subscriptionGroup:
tickSizeTableId:
orderbookParameters:
curreny:
ProcessingSequenceOrderBookId
orderBookId:
611
processingSequenceId: PRE_OPEN
CombinationDefinitionLeg
legOrderBookId: 712
orderBookId:
611
Key Attribute
Unique Id
parentReference
OrderBookRuleGroup
orderBookRuleGroupId
yes
null
OrderBookRoutingStrat
egy
serviceId
no
orderBookRuleGroupId
ProcessingSequence
stateName
no
orderBookRuleGroupId
OrderBook
orderBookId
yes
orderBookRuleGroupId
CombinationDefinition
Leg
legOrderBookId
no
orderBookId
TradingSchedule
Defines the cycle that an order book moves through during the trading
sessions. Example: Closed->Pre-call->Open
Each order book rule group is associated with the following schedules:
EMAPI Protocol
Rev F April 17, 2009
29 (55)
Cinnober Financial Technology AB
Restricted External
TradingSchedule
tradingScheduleId: 5*
displayName: NORMAL
StateTransition
name:
PRE_OPEN
5
tradingScheduleId:
allowedRequestsGroupId: 89
Figure 7 TradingSchedule andStateTransitions for that schedule.
Key Attribute
Unique Id
parentReference
TradingSchedule
tradingScheduleId
yes
null
StateTransition
name
no
tradingScheduleId
SubscriptionGroup
A subscription group contains a collection of order books. When subscribing
for market data, subscriptions are setup using the identities of
SubscriptionGroups. The subscription group is the smallest unit for which it
is possible to enter a subscription. A SubscriptionGroup is also the smallest
unit that can be used for requesting retransmissions/recovery of market data
(i.e. all orderbooks within the requested subscription group will be retrieved).
Order books belonging to one OrderBookRule group may belong to different
subscription groups and subscription group can contain order books from
several order book rule groups.
SubscriptionGroup
subscriptionGroupId: 432*
Figure 8 SubscriptionGroup.
Key Attribute
Unique Id
parentReference
SubscriptionGroup
subscriptionGroupId
yes
null
TickSizeTable
The tick-size table defines the smallest price increment on orders/ quotes.
Since the price increment varies with the price a table is needed.
TickSizeTable
tickSizeTableId: 77*
displayName:
EUR
TickSizeTableRow
lowerLimit:
100
tickSizeTableId: 77
Figure 9 TickSizeTable and TickSizeTableRow.
EMAPI Protocol
Rev F April 17, 2009
30 (55)
Cinnober Financial Technology AB
Restricted External
Object
Key Attribute
Unique Id
parentReference
TickSizeTable
tickSizeTableId
yes
null
TickSizeTableRow
lowerLimit
no
tickSizeTableId
AllowedRequestsGroup
Defines allowed requests for a certain state transition. This makes it possible
to define state transition based filter governing which requests that are
allowed.
AllowedRequestsGroup
allowedRequestsGroupId: 89*
displayName: PRE_OPEN_REQ
AllowedRequestsGroupRow
request:
cancelOrder
allowedRequestsGroupId: 89
Figure 10 AllowedRequestsGroup and AllowedRequestsGroupRow.
Key Attribute
Unique Id
parentReference
AllowedRequestsGroup
allowedRequestsGrou
pId
yes
null
AllowedRequestsGroupR
ow
request
yes
allowedRequestsGrou
pId
Currency
Represents a currency.
Currency
currencyId: EUR*
Figure 11 Currency.
Key Attribute
Unique Id
parentReference
Currency
currencyId
yes
null
EMAPI Protocol
Rev F April 17, 2009
31 (55)
Cinnober Financial Technology AB
Restricted External
DateCollection
dateType: HALF_DAY*
displayName:
EUR
CalendarDate
dateKey: 2008-09-09_CFT_CALENDAR
dateType: HALF_DAY
Key Attribute
Unique Id
parentReference
DateCollection
dateType
yes
null
CalendarDate
dateKey
yes
dateType
OrderBookRuleGroupParameters
The OrderBookRuleGroupParameters object is referenced from the
OrderBookRuleGroup and hold parameters that are common for one or many
OrderBookRuleGroups.
OrderBookRuleGroupParameters
parameterSetId:
SYSTEM_DEFAULT
tradingScheduleId: 5
calendarId:
CFT_CALENDAR
Figure 13 OrderBookRuleGroupParameters.
Key Attribute
Unique Id
parentReference
OrderBookRuleGroupParameters
parameterSetId
yes
null
OrderBookParameters
The OrderBookParameters object is referenced from the OrderBook and hold
parameters that are common for one or many OrderBook.
OrderBookParameters
parameterSetId:
SYSTEM_DEFAULT
Figure 14 OrderBookParameterse.
4.7
Object
Key Attribute
Unique Id
parentReference
OrderBookParameters
parameterSetId
yes
null
EMAPI Protocol
Rev F April 17, 2009
32 (55)
Cinnober Financial Technology AB
Restricted External
The relations between the two object domains can be viewed in the picture
below.
View
Market
XCFt100
XCFT
1
n
1
n
Instrument
ERIC-B
ViewELement
MarketList
EIRC-B, EUR
L1
1
n
1
n
TradableInstrument
TradableInstrument
ERIC-B, SEK
ERIC-B, EUR
Segment
S1
Trading Data
OrderbookRuleGroup
1
n
Orderbook
1
TradingSchedule
TickSizeTable
Orderbook
1
OrderbookRoutingStrategy
Figure 15 Overview figure on how Markets and Instruments relates to OrderBooks and trading
rules.
On each level, a trading rule parameter block may be assigned. The assigned
trading parameters apply to all TradableInstruments within the
Market/MarketList/Segment. It is the parameter block assigned on the
lowest level that is used. All TradableInstruments within a Segment share
the same TradingSchedule.
EMAPI Protocol
Rev F April 17, 2009
33 (55)
Cinnober Financial Technology AB
Restricted External
Market
marketId: XCFT*
orderBookParameterSetId:
orderBookRuleGroupParameterSetId:
1
n
MarketList
internalMarketListId: XCFT_L1*
parentInternalId:
XCFT
marketListId:
L1
orderBookParameterSetId:
orderBookRuleGroupParameterSetId:
1
n
Segment
internalSegmentId: XCFT_L1_S1*
parentInternalId: XCFT_L1
segmentId:
S1
orderBookParameterSetId:
orderBookRuleGroupParameterSetId:
Key Attribute
Unique Id
parentReferenceAttribute
Market
marketId
yes
null
MarketList
internalMarketListId
yes
parentInternalId
Segment
internalSegmentId
yes
parentInternalId
EMAPI Protocol
Rev F April 17, 2009
34 (55)
Cinnober Financial Technology AB
Restricted External
SE0000108656_ISIN*
SE0000108656
ISIN
EQUITY
null
XCFT
ERIC-B
TradableInstrument
internalId:
parentInternalId:
internalSegmentId:
tradableInstrumentId:
tradableInstrumentIdType:
marketId:
marketListId:
segmentId:
currencyId:
orderBookVisibilityType:
subscriptionGroupId:
orderBookId:
SE0000108656_ISIN_SEK_XCFT_DARK*
SE0000108656_ISIN
XCFT_L1_S1
SE0000108656
ISIN
XCFT
L1
S1
SEK
DARK
1
611
Key Attribute
Unique
Id
parentReferenceAttribute
Instrument
internalId
yes
null
TradableInstrument
internalId
yes
parentInternalId
EMAPI Protocol
Rev F April 17, 2009
35 (55)
Cinnober Financial Technology AB
Restricted External
View
viewId:
XCFT100*
marketId: XCFT
1
n
ViewElement
viewElementId:
SE0000108656_ISIN
parentInternalId: XCFT100
internalTradableInstrumentId: SE0000108656_ISIN_SEK_XCFT_DARK
Figure 18 The View and ViewElement. A View references one or many ViewElements which in
turn has a reference to a TradableInstrument.
Key Attribute
Unique
Id
parentReferenceAttribute
View
viewId
yes
null
ViewElement
viewElementId
yes
parentInternalId
EMAPI Protocol
Rev F April 17, 2009
36 (55)
Cinnober Financial Technology AB
Restricted External
Trading
This section describes the trading part of the EMAPI protocol.
5.1
5.1.1
Orders
There are 2 identifiers associated with orders.
Private Order Id (privateOrderId)
Each order is assigned a private order id by the system that is guaranteed to
be unique within the system and over time. The id is provided both in the
interactive response when entering an order and in the private order events.
This id is used when managing the order and when building a private shadow
order book.
Public Order Id (publicOrderId)
In addition, each order is assigned a public order id by the system that is
guaranteed to be unique within the system and over time. The id is provided
both in the public order events and in the private order events.
This id is used when building a public shadow order book and when accepting
orders.
5.1.2
Quotes
There are 4 identifiers associated with quotes.
Quote Replace Id (quoteReplaceId)
The QuoteInsertReq message contains a quote replace id field that is
assigned by the user. Each quote in the QuoteInsertReq is assigned this quote
replace id.
This id is used when managing quotes as described below.
The quotes in a QuoteInsertReq will replace any existing quotes for the
member with the same quote replace id in the order books of the
QuoteInsertReqs quotes.
For an order book (specified in one or more quotes in the QuoteInsertReq)
the process is as follows:
1. Collect all residing members quotes in the order book that have a quote
replace id that matches the one specified in the QuoteInsertReq.
2. For each quote in the QuoteInsertReqs that is designated to the order
book:
a. Primarily reuse an earlier collected quote on the same side of the
order book. The quotes properties will be updated to reflect the new
quote but the quotes orderBook, isBid, quoteReplaceId, quoteId,
privateQuoteId and publicMember will not change.
b. Secondarily insert a new quote.
3. Remove all earlier collected quotes that have not been reused.
The mechanism above provides a tremendous amount of flexibility in terms of
how allowing members to design their quoting strategies.
Note:
EMAPI Protocol
Rev F April 17, 2009
A QuoteInsertReq will never affect any other order books than the
ones that are contained within the transaction.
37 (55)
Cinnober Financial Technology AB
Restricted External
Note:
5.2
Cancel on Logout
All orders with cancelOnLogout set to true and all quotes are cancelled
when the user, which last acted upon the item, does not have any live
sessions on the Server (e.g. when sessions have been terminated due that
Servers heartbeat time has expired (see section 2.3)).
Note:
5.3
This independently if the owning user or if there are other users, that
may act on-behalf of the owning user, do have live sessions in the
Server.
Event Flows
Events on these flows are published on different subscription groups (see also
section 3.1.2).
The events marked suffixed with (*) is not provided in a current value.
Flow
Current
Value/
Replay
PRIVATE_ORDERBOOK_EVENT_FLOW
Current
Value &
Replay
EMAPI Protocol
Rev F April 17, 2009
ChatMessageEventPrivate(*)
MassUpdateEventPrivate(*)
OrderEventPrivate
QuoteEventPrivate
RequestForQuoteEventPrivate(*)
WaitForSSNEvent
38 (55)
Cinnober Financial Technology AB
Restricted External
Flow
Current
Value/
Replay
PUBLIC_ORDERBOOK_EVENT_FLOW
Current
Value &
Replay
MBL_L1_FLOW
MBL_L2_FLOW
PUBLIC_PRICELEVEL_FLOW
PRIVATE_TRADE_FLOW
PUBLIC_TRADE_FLOW
EMAPI Protocol
Rev F April 17, 2009
Current
Value
Current
Value
Current
Value
Replay
Replay
AuctionEvent
ChatMessageEvent(*)
MarketByLevelEvent
OrderBookStateChangeEvent
OrderEvent
QuoteEvent
RequestForQuoteEvent(*)
StateFreezeEvent
WaitForSSNEvent
AuctionEvent
MarketByLevelEvent
OrderBookStateChangeEvent
WaitForSSNEvent
AuctionEvent
MarketByLevelEvent
OrderBookStateChangeEvent
WaitForSSNEvent
AuctionEvent
MarketByLevelEvent
OrderBookStateChangeEvent
WaitForSSNEvent
TradeEventPrivate
WaitForSSNEvent
TradeEvent
WaitForSSNEvent
39 (55)
Cinnober Financial Technology AB
Restricted External
5.3.1
Information in Events
All events on these flows contain following information:
If set to true the event is the last event in a sequence of events that
occurred at the same time. If set to false the event is part of an event
sequence which last event will have this field set to true.
N.B. If there is only one event that occurred at the same time the only
event will have this field set to true.
N.B. It is configurable per TRADExpress installation if events on a certain
public flow are visible as sequences. If events on a public flow aren't
visible as sequences this field will not be set.
Note:
Events that deliver the current value (see section 3.2.1) have non valid
timeOfEvent and sequenceIndicator.
5.4
Note:
Note:
5.4.1
OrderEvent
MarketByLevelEvent
QuoteEvent
OrderBookStateChangeEvent
EMAPI Protocol
Rev F April 17, 2009
40 (55)
Cinnober Financial Technology AB
Restricted External
5.4.2
Note that there are other state event types but these only provide
transient information that need not to be applied to a shadow order
book.
trading session is a classical order driven market. Typical such a market starts
with a morning trading sessions where only MarketByLevelEvent:s are
disseminated, once in continuous trading the individual
OrderEvent/QuoteEvent:s are disseminated instead of the
MarketByLevelEvent:s.
5.4.3
quotes.
Order/Quote Priority
Following orders/quotes properties is used, in the specified order, to decide
the priority of the order/quote amongst orders/quotes in the order book side:
1. Price. If the reference data (see section 4) indicates that an order book
uses:
normal sorting then a higher price implies higher priority for a bid
order/quote and a lower price implies higher priority for an ask
order/quote
reversed sorting then a lower price implies higher priority for a bid
order/quote and a higher price implies higher priority for an ask
order/quote
2. Priority Group (lower value implies higher priority)
3. Priority (lower value implies higher priority)0.
5.4.4
isBid
price
41 (55)
Cinnober Financial Technology AB
Restricted External
5.5
5.5.1
OrderEventPrivate
QuoteEventPrivate
5.5.2
Order/Quote Key
The key to be used for orders/quotes in the public shadow order book are the
ones described in section Private Order Id (privateOrderId) respectively
Private Quote Id (privateQuoteId).
Note:
5.6
Order History
A private order event is tagged with the following attribute describing the
origin of an event.
Source of event, this is either USER or SYSTEM. USER indicates that the
source of the event is an explicit action taken by a user. SYSTEM indicates
that the source of the event is an action taken by the system.
Note that it is quite feasible that an initial USER event triggers a number
of SYSTEM events. This happens for example when a user by an explicit
update make an order so generous so that its matches.
Event type, one of INSERT, UPDATE, CANCEL. These are the base order
event types. The set of event types are unlikely to change in the future
and should thus always be used when building a shadow order book.
Sub event type, this is indicates with a greater level of detail the type of
event. The set of sub event types is likely to increase over time.
SubEventType
TypeOfEvent
SourceOfEvent
Description
RESTORE
INSERT
SYSTEM
EMAPI Protocol
Rev F April 17, 2009
42 (55)
Cinnober Financial Technology AB
Restricted External
SubEventType
TypeOfEvent
SourceOfEvent
Description
INSERT
INSERT
USER
PARTIALLYFILLED
UPDATE
SYSTEM
A partial fill of an
order occurs.
FILLED
UPDATE
SYSTEM
A complete fill of an
order occurred.
MASSUSPEND
UPDATE
USER/SYSTEM
MASSACTIVATED
UPDATE
USER/SYSTEM
MASSCANCEL
CANCEL
USER/SYSTEM
UPDATE
UPDATE
USER
USERDISABLED
CANCEL
SYSTEM
USERDELETED
CANCEL
SYSTEM
USERDISCONNECTED
CANCEL
SYSTEM
EXPIRED
CANCEL
SYSTEM
Order expired.
CANCEL
CANCEL
USER/SYSTEM
SAVEDOVERNIGHT
CANCEL
SYSTEM
WOULDHAVECROSSED
CANCEL
SYSTEM
PRICERECALCULATED
UPDATE
SYSTEM
CANCEL_DUE_TO
_PRICEBAND
CANCEL
SYSTEM
SYSTEM
SYSTEM
Some type of
reference price used
by the order was not
ORDERCONDITION
NO_BASE_PRICE
EMAPI Protocol
Rev F April 17, 2009
CANCEL
43 (55)
Cinnober Financial Technology AB
Restricted External
SubEventType
TypeOfEvent
SourceOfEvent
Description
available. A typical
example is an order
pegged to an external
price reference.
A public order event only contains the TypeOfEvent field and does not
provide any information about SubEventType or SourceOfEvent.
Note:
5.7
The TypeOfEvent field might very well differ between a public and
private event originating from the same matcher event. This is
described in the coming chapters.
Message Sequences
This section contains message sequence examples.
5.7.1
OrderInsertReq/Rsp no Match
Interactive flow
Client
|--------------|<--------------
OrderInsertReq
OrderInsertRsp
Server
--------------->|
----------------|
Private flow
Client
Server
|<------------- OrderEventPrivate (INSERT) ---------------|
Public Flow
Client
|<--------------
5.7.2
OrderEvent
Server
----------------|
OrderCancelReq
OrderCancelRsp
Server
--------------->|
----------------|
Private flow
Client
Server
|<------------- OrderEventPrivate (CANCEL) ---------------|
Public flow
Client
|<--------------
5.7.3
OrderEvent (CANCEL)
Server
----------------|
OrderInsertReq
OrderInsertRsp
Server
--------------->|
----------------|
Private flow
Client
Server
|<------------- OrderEventPrivate (INSERT) ---------------|
|
* Shows order with the full volume
|
|
|
EMAPI Protocol
Rev F April 17, 2009
44 (55)
Cinnober Financial Technology AB
Restricted External
Public flow
N/A
5.7.4
OrderInsertReq
OrderInsertRsp
Server
--------------->|
----------------|
Server
TradeEventPrivate
---------------|
OrderEventPrivate (UPDATE) ---------------|
zero since order is completely traded
|
|
OrderEventPrivate (CANCEL) ---------------|
Public flow
Client
Server
|<------------- TradeEvent
---------------|
|
* The trade against participant A
|
|
|
|<------------- OrderEvent (CANCEL)
---------------|
|
* Participant A:s order is now cancelled
|
|
|
|<------------- TradeEvent
---------------|
|
* The trade against participant B
|
|
|
|<------------- OrderEvent (UPDATE)
---------------|
|
* Participant B:s is updated order since it was only |
EMAPI Protocol
Rev F April 17, 2009
45 (55)
Cinnober Financial Technology AB
Restricted External
5.7.5
partially matched
OrderUpdateReq
OrderUpdateRsp
Server
--------------->|
----------------|
Public flow
Client
Server
|<------------- OrderEvent (CANCEL)
---------------|
|
* Participant A:s order is now cancelled
|
|
|
|<------------- TradeEvent
---------------|
|
* The updated order now matches against the order
|
|
residing in the order book.
|
|
|
|<------------- OrderEvent (UPDATE)
---------------|
|
* Participant B:s is updated order since it was only |
|
partially matched
|
5.7.6
QuoteInsertReq/Rsp no Match
Interactive flow
Client
|--------------|<--------------
QuoteInsertReq
QuoteInsertRsp
Server
--------------->|
----------------|
EMAPI Protocol
Rev F April 17, 2009
Server
----------------|
46 (55)
Cinnober Financial Technology AB
Restricted External
Public flow
Client
|<------------- QuoteEvent
5.7.7
Server
----------------|
QuoteInsertReq
QuoteInsertRsp
Server
--------------->|
----------------|
Public flow
Client
|<------------- TradeEvent
|<------------- OrderEvent (CANCEL)
|<------------- QuoteEvent (INSERT)
5.7.8
Server
---------------|
---------------|
---------------|
OrderInsertReq
OrderInsertRsp
Server
--------------->|
----------------|
47 (55)
Cinnober Financial Technology AB
Restricted External
Public flow
Client
Server
|<------------- TradeEvent
---------------|
|<------------- QuoteEvent (CANCEL)
---------------|
* There is only one public quote event since
the entered order is completely matched and
is never inserted.
5.7.9
MarketByLevel
The below order requests are processed by TRADExpress. The concerned
trading session is configured to publish events on market by level flows (i.e.
MBL_L1_FLOW, MBL_L2_FLOW and PUBLIC_PRICELEVEL_FLOW) so the order
requests will result in MarketByLevelEvent:s sequences on respectively
market by level flow as presented below.
1. Insert at price 100.
2. Insert at price 100.
3. Insert at price 102.
4. Insert at price 98.
5. Cancel at price 100.
6. Cancel at price 102.
7. Cancel at price 98.
8. Cancel at price 100.
Note:
Note: MBL_L2_FLOW
Server
MarketByLevelEvent (INSERT, price 100, vol 10) ---|
|
MarketByLevelEvent (UPDATE, price 100, vol 20) ---|
|
MarketByLevelEvent (CANCEL, price 100)
---|
|
MarketByLevelEvent (INSERT, price 102, vol 10) ---|
|
|
|
|
|
MarketByLevelEvent (CANCEL, price 102)
---|
|
MarketByLevelEvent (INSERT, price 100, vol 10) ---|
|
|
|
MarketByLevelEvent (CANCEL, price 100)
---|
MBL_L2_FLOW
Client
Server
|<--- MarketByLevelEvent (INSERT, price 100, vol 10) ---|
|
|
2.
|<--- MarketByLevelEvent (UPDATE, price 100, vol 20) ---|
1.
EMAPI Protocol
Rev F April 17, 2009
48 (55)
Cinnober Financial Technology AB
Restricted External
3.
4.
5.
6.
7.
8.
|
|<--|
|
|
|<--|
|<--|
|<--|
|<--|
|<---
|
MarketByLevelEvent (INSERT, price 102, vol 10) ---|
|
|
|
MarketByLevelEvent (UPDATE, price 100, vol 10) ---|
|
MarketByLevelEvent (CANCEL, price 102)
---|
|
MarketByLevelEvent (INSERT, price 98, vol 10) ---|
|
MarketByLevelEvent (CANCEL, price 98)
---|
|
MarketByLevelEvent (CANCEL, price 100)
---|
PUBLIC_PRICELEVEL_FLOW
1.
2.
3.
4.
5.
6.
7.
8.
Client
|<--|
|<--|
|<--|
|<--|
|<--|
|<--|
|<--|
|<---
Server
MarketByLevelEvent (INSERT, price 100, vol 10) ---|
|
MarketByLevelEvent (UPDATE, price 100, vol 20) ---|
|
MarketByLevelEvent (INSERT, price 102, vol 10) ---|
|
MarketByLevelEvent (INSERT, price 98, vol 10) ---|
|
MarketByLevelEvent (UPDATE, price 100, vol 10) ---|
|
MarketByLevelEvent (CANCEL, price 102)
---|
|
MarketByLevelEvent (CANCEL, price 98)
---|
|
MarketByLevelEvent (CANCEL, price 100)
---|
TradeReportReq
TradeReportRsp
Server
--------------->|
----------------|
Public flow
Client
|<------------- TradeEvent
EMAPI Protocol
Rev F April 17, 2009
(NEW)
Server
---------------|
49 (55)
Cinnober Financial Technology AB
Restricted External
TradeReportReq
TradeReportRsp
Server
--------------->|
----------------|
TradeReportReq
TradeReportRsp
Server
--------------->|
----------------|
Public flow
Client
|<------------- TradeEvent
(NEW)
Server
---------------|
5.7.12 TradeUpdateReq/Rsp
Interactive flow of participant
Client
EMAPI Protocol
Rev F April 17, 2009
Server
50 (55)
Cinnober Financial Technology AB
Restricted External
|--------------|<--------------
TradeUpdateReq
TradeUpdateRsp
--------------->|
----------------|
Public flow
N/A
RequestForQuoteReq
RequestForQuoteRsp
Server
--------------->|
----------------|
Public flow
N/A
EMAPI Protocol
Rev F April 17, 2009
51 (55)
Cinnober Financial Technology AB
Restricted External
Order Routing
6.1
Event Flows
Events on these flows are published on different subscription groups (see also
section 3.1.2).
Flow
Current Value/
Replay
ORDER_ROUTER_ORDER
ORDER_ROUTER_TRADE
Replay
OrderEventPrivate
OrderBookStateChange-Event
EMAPI Protocol
Rev F April 17, 2009
TradeEventPrivate
52 (55)
Cinnober Financial Technology AB
Restricted External
7.1
Event Flows
Events on these flows are not published on any subscription groups (see also
section 3.1.2).
Flow
Current
Value/
Replay
SYSTEM_EVENTS_FLOW
Current
Value 12
PRIVATE_EVENTS_FLOW
Current
Value 13
MarketMessage
MarketMessage
12
The mechanism used is current value but what is received is actually a replay of all
earlier messages.
13
The mechanism used is current value but what is received is actually a replay of all
earlier messages.
EMAPI Protocol
Rev F April 17, 2009
53 (55)
Cinnober Financial Technology AB
Restricted External
8.1
Event Flows
Events on these flows are published on different subscription groups (see also
section 3.1.2).
Flow
Current
Value/ Replay
CONSOLIDATED_FLOW
Replay
INTERNAL_TRADE_FLOW
Replay
Events sent on
PRIVATE_ORDERBOOK_EVENT_
FLOW see section 5.3.
Events sent on
PRIVATE_TRADE_FLOW see
section 5.3.
Heartbeat
EMAPI Protocol
Rev F April 17, 2009
Events sent on
PRIVATE_TRADE_FLOW see
section 5.3.
54 (55)
Cinnober Financial Technology AB
Restricted External
Historical Queries
Clients may request old private order and trade events by submitting a query
for historical data. The TRADExpress system stores old events for a
configurable number of days, and can return messages matching specific
search criteria.
Please note that the data stored depends on the configuration of the
TRADExpress system. It is, for example, possible that the system stores old
trades but not old orders.
In each case, the messages returned are the same as the messages that were
sent on the private event flows.
Messages for the current trading day may also be retrieved by using the
subscription recovery mechanism, although that requires that the sequence
numbers (rather than a selection criteria) be included in the request.
9.1
Query types
9.1.1
Historical Trades
Use the HsQueryTradesReq message to retrieve old trades. TRADExpress will
return TradeEventPrivate messages.
9.1.2
Historical Orders
Use the HsQueryOrdersReq message to retrieve old trades. TRADExpress will
return OrderEventPrivate messages.
9.1.3
Historical RequestForQuotes
Use the HsQueryRFQReq message to retrieve old trades. TRADExpress will
return RequestForQuoteEventPrivate messages.
9.2
EMAPI Protocol
Rev F April 17, 2009
55 (55)
Cinnober Financial Technology AB