Title: PLUS Markets Group plc
1X-stream Client API A walk through the SDK
PLUS Markets Group plc
2Outline
- SDK Navigation
- Overview
- Connection
- Messages
- Retrieving Data
- Performing Actions
- Quoting
- Trade Reporting
3SDK Navigation
- Home Page
- C Examples
- C Examples
- Installation Guide
- Memory Management
- Developers
- API Initialisation
- Connection
- Session Creation
- Login
- Table Download
- Transactions
- API Shutdown
- Business Queries
- Query Request
- QueryReqChoice
- Query Replies
- QueryRepChoice
- Business Transactions
- Transaction Request
- TransReqChoice
- Transaction Replies
- TransRepChoice
- Message Versioning
- Version numbers
- Aliases
4Overview
PLUS X-stream
Connection
ReplyOk/ReplyBad
Client Application
T
Q
Q
T
get_ref()
AmpMiFIDTradeReport
AmpSecBoardRep
AmpSecBoardRep
?
Session Object
?
Connect
AmpSecBoardRep
AmpSecBoardRep
AmpSecBoardReq
AmpSecBoardRep
AmpSecBoardRep
WORK
5Connection
- Initialise the API
- Instanciate Session object from the
SessionFactory - Configuration file supplied as parameter Server
addresses, ports, system identifier, Timeouts,
Quality of service settings - Use a scoped pointer to automatically clean up
- Execute the logon method of the Session object
- Pass the userid and password as parameters
- Do Work
- Retrieve Data Business Queries
- Perform Actions Business Transactions
- Execute the logoff method of the Session object
- Finalise the API
6X-stream TSMR Discovery Timeouts
Servers
Preferred IP Address From Preferred Network From
Local Network Least Loaded ( of Max)
Choose
Socket
Connect Time
Client
7X-stream TSMR Timeouts
First Data Received
Receive
Receive Timeout
Packet Timeout
Character Timeout
Character Timeout
Character Timeout
Character Timeout
Character Timeout
Packet Complete
Start of Packet
8Messages
- Message Types
- Queries (Data presented using a Table metaphor)
- Transactions (Actions presented using request,
reply) - Synchronous
- Fill out message structure
- Send to server / process replies
- Blocking execution
- Asynchronous
- Implement Message Handler
- Register Message Handler
- Non-blocking execution
- Can implement a combined handler that does
multiple messages
9Messages used Synchronously
- Queries
- QueryRequest object for instanciating specific
Queries - query method of the Session object to send to the
server - Iterator object to store the result of the query
method - QueryReply object to store the next replies
(vector of rows) - Transactions
- TransRequest object for instanciating specific
Transactions - transaction method of the Session object to send
to the server - TransReply object to store the result of the
transaction method - Check type of the TransReply for determining
success/failure
10Messages used Asynchronously
- Logon Asynchronously
- Implement a Login subclass of Session_Handler
- Overload the function call operator (operator())
with a function - Checks the success of the login via
Session_.status()-gtphase - Implement a Logoff subclass of Session_Handler
- Overload the function call operator (operator())
with a function - Shuts down the Session
- Create a variable of type Session_Handler_Manager
- Use async_logon method of Session object using
an instance of the previously defined
Session_Handler subclass - For error handling
- All overloading of function call operators
(operator()) should include a polymorph that has
an Exception as the parameter
11Messages used Asynchronously - Queries
- Implement subclass of Iteratorhandler_type
object - Overload the function call operator (operator())
with a function - Processes rows passed into this function in
QueryRepSeq object - Calls sendc_next on the iterator with this as
parameter to the call - Register a new instance of this class with the
Session_Handler used for the asynchronous login - Instanciate and initialise the QueryRequest to be
downloaded - Instanciate an Iterator from the result of a call
to Session.query() with the QueryRequest as the
parameter - Call the sendc_next method of Iterator with the
new Session_Handler instance created previously - Overloaded function operator is called when new
data arrives
12Messages used Asynchronously - Transactions
- Implement subclass of Session_Handler object
- Overload the function call operator (operator())
with a function - Processes result passed into this function in
TransReply object - Register a new instance of this class with the
Session_Handler used for the asynchronous login - Instanciate and initialise the TransRequest to be
executed - Instanciate a new instance of the Session_Handler
subclass - Call the async_transaction method of Session with
the TransRequest and Session_Handler instances - Overloaded function operator is called when the
result to the transaction arrives.
13Retrieving Data Tables and Permissions
- Query messages can be thought of as Views on the
underlying X-stream Tables - Query Request message names are of the form
AmpltViewgtReq - Query Reply message names are of the form
AmpltViewgtRep - Each QueryReply message can be thought of as row
- Underlying Tables
- Do not map exactly to the Views presented in the
API messages - Views may be overlapping
- Permission Model
- Restricts which rows a given client can see
- Controls the content of specific fields within a
given row
14Retrieving Data Data Model
SecClass
Debt, Index, Future, Option, IRD,
Strategy
Equity,
Firm
Exchange, Member, Issuer
Instr
Ordinary, Preference, etc
User
Security
FR12320094501
Quote/ Order
NegDeal
Trade
DE00001564765
UK00000112112
UK00001234511
ONGBP/UK00000112112
SecBoard
OFFGBP/UK00000112112
AmpBoardReq
OFFEUR/FR12320094501
AmpSecBoardReq
OFFEUR/DE00001564765
Order Book
AmpOrderMarketMaker
AmpOrderBookReq
AmpFirmReq
Board
ONGBP
AmpUserReq
OFFGBP
AmpNegDealReq
AmpMiFIDTraderReport
ONEUR
OFFEUR
AmpTradeReq
15Retrieving Data Message Structures
- An Iterator represents the flow of new and
updated rows - An QueryRepSeq is a set of specific QueryRep
messages - Each QueryRep message has 3 sections
- Key field(s) that identify the record uniquely
within the Table - AmpFirmRep.firmId
- Statics fields(s) received only once, they dont
change intra-day - AmpFirmRep.statics.firmName, AmpFirmRep.statics.fi
rmType - Dynamics fields(s) that change. Each Reply may
have some or none of these fields defined. - AmpFirmRep.dynamics.firmStatus
- Fields may in turn be a structure within the
ASN.1 syntax - Fields marked as OPTIONAL may or may not be
present
16Performing Actions
- Transactions are atomic requests
- Focused on Business actions
- Create an order, Report a Trade, Enter a Market
Maker Order - May result in many updates across the system
- TransReply holds the result
- Mostly of type AmpReplyOK or AmpReplyBad
- Some have special reply types eg AmpMMReply for
quotes - Permission model
- Limits whether a given user can execute a given
Transaction - Limits the effect of a given Transaction on the
basis of the executing user
17Quoting
- Use AmpOrderMarketMaker
- ordersList for a list of SecBoard
- Security (ISIN) and Board (implies currency)
- Buy Orders / Sell Orders For each side, a set
of - Price, Quantity (other fields exist but are less
relevant here) - Expiry Time
- newOrder should this set replace or add any
already in the system - receivedTimeLimit The order(s) will not be
processed after this time - Reply is of type AmpMMReply
- Overall Reply Code
- List of Reply Codes for specific messages in the
original set. - AmpOrderWithdraw can pull Quotes
18Trade Reporting
- Use AmpMiFIDTradeReport
- Specific fields documented in the API
documentation - Produces records in the NegDeal table
(AmpNegDealRep) - One for each side of the deal. Not important at
this stage. - Produces records in the Trade table
- Private details, own Trades only (AmpTradeRep)
- Public details, all trades public information
(AmpMarketTradeRep)
19Plus Markets Group Standon House 21 Mansell
Street London E1 8AA t. 020 7553 2000 f. 020
7553 2004 www.plusmarketsgroup.com