public interface Client
The client provides the following lifecycle methods.
reconnect(): to reconnect to the serverreconnect(ClientParameters): to reconnect to a server
that is different from the one the client was originally connected
to.The client provides the following set of services that communicate with the server.
sendOrder(OrderSingle),
sendOrder(OrderReplace), sendOrder(OrderCancel),
sendOrderRaw(FIXOrder)receive reportsreceive broker status updatesfetch past reports getEquityPositionAsOf(Date, Equity) fetch equity position} getAllEquityPositionsAsOf(Date) fetch all open equity positions} fetch all visible open ordersgetOptionPositionAsOf(java.util.Date, Option) fetch option position} getOptionPositionsAsOf(java.util.Date, String[]) fetch option positions} getAllOptionPositionsAsOf(java.util.Date) fetch all open option positions} getCurrencyPositionAsOf(Date, Currency) fetch currency positions} getAllCurrencyPositionsAsOf(java.util.Date) fetch all open currency positions} getFuturePositionAsOf(Date, Future) fetch future positions} getAllFuturePositionsAsOf(java.util.Date) fetch all open future positions} | Modifier and Type | Method and Description |
|---|---|
void |
addBrokerStatusListener(BrokerStatusListener listener)
Adds a broker status listener, which receives all the
broker status changes sent out by the server.
|
void |
addExceptionListener(ExceptionListener inListener)
Adds an exception listener.
|
void |
addReport(FIXMessageWrapper inReport,
BrokerID inBrokerID,
Hierarchy inHierarchy)
Adds the given report to the system data flow.
|
void |
addReportListener(ReportListener inListener)
Adds a report listener.
|
void |
addServerStatusListener(ServerStatusListener listener)
Adds a server connection status listener, which receives all
the server connection status changes.
|
void |
close()
Closes the connection to the server.
|
void |
deleteReport(ExecutionReportImpl inReport)
Removes the given report from the persistent report store.
|
OrderID |
findRootOrderIdFor(OrderID inOrderID)
Find the root order ID for the order chain of the given order ID.
|
Map<PositionKey<Currency>,BigDecimal> |
getAllCurrencyPositionsAsOf(Date inDate)
Returns all open currency positions based on reports,
generated and received on or before the supplied date in UTC.
|
Map<PositionKey<Equity>,BigDecimal> |
getAllEquityPositionsAsOf(Date inDate)
Returns all open equity positions based on reports,
generated and received on or before the supplied date in UTC.
|
Map<PositionKey<Future>,BigDecimal> |
getAllFuturePositionsAsOf(Date inDate)
Returns all open future positions based on reports,
generated and received on or before the supplied date in UTC.
|
Map<PositionKey<Option>,BigDecimal> |
getAllOptionPositionsAsOf(Date inDate)
Returns the aggregate position of each option (option,account,actor)
tuple based on all reports received for each option instrument on or before
the supplied date in UTC and which are visible to the given user.
|
BrokersStatus |
getBrokersStatus()
Returns the server's broker status.
|
BigDecimal |
getCurrencyPositionAsOf(Date inDate,
Currency inCurrency)
Returns the position of the supplied currency based on reports,
generated and received on or before the supplied date in UTC.
|
BigDecimal |
getEquityPositionAsOf(Date inDate,
Equity inEquity)
Returns the position of the supplied equity based on reports,
generated and received on or before the supplied date in UTC.
|
BigDecimal |
getFuturePositionAsOf(Date inDate,
Future inFuture)
Returns the position of the supplied future based on reports,
generated and received on or before the supplied date in UTC.
|
Date |
getLastConnectTime()
Returns the last time the client was successfully connected
or reconnected to the server.
|
List<ReportBaseImpl> |
getOpenOrders()
Gets all open orders visible to the current user.
|
BigDecimal |
getOptionPositionAsOf(Date inDate,
Option inOption)
Gets the current aggregate position for the option instrument based on
execution reports received on or before the supplied date in UTC, and which
are visible to the given user.
|
Map<PositionKey<Option>,BigDecimal> |
getOptionPositionsAsOf(Date inDate,
String... inRootSymbols)
Returns the aggregate position of each option
(option,account,actor)
tuple based on all reports received for each option instrument on or before
the supplied date in UTC, and which are visible to the given user.
|
Collection<String> |
getOptionRoots(String inUnderlying)
Returns the collection of known option roots for the underlying symbol.
|
ClientParameters |
getParameters()
Returns the parameters that client is using to connect to the server.
|
ReportBase[] |
getReportsSince(Date inDate)
Returns all the reports (execution report and order cancel rejects)
generated and received by the server since the supplied date in UTC.
|
String |
getUnderlying(String inOptionRoot)
Returns the underlying symbol for the supplied option root, if
a mapping is found for it.
|
Properties |
getUserData()
Gets the user data associated with the current user.
|
UserInfo |
getUserInfo(UserID id,
boolean useCache)
Returns the information of the user with the given ID.
|
boolean |
isCredentialsMatch(String inUsername,
char[] inPassword)
Returns true if the supplied user name, password match the
credentials used to connect to the server.
|
boolean |
isServerAlive()
Returns true if client has a live connection to the server.
|
void |
reconnect()
Disconnects the connection to the server and reconnects back
using the same properties as were supplied when creating this
instance.
|
void |
reconnect(ClientParameters inParameters)
Disconnects the connection to the server and reconnects back
using the properties supplied to this method.
|
void |
removeBrokerStatusListener(BrokerStatusListener listener)
Removes a broker status listener that was previously added
via
addBrokerStatusListener(BrokerStatusListener). |
void |
removeExceptionListener(ExceptionListener inListener)
Removes exception listener that was previously added via
addExceptionListener(java.beans.ExceptionListener). |
void |
removeReportListener(ReportListener inListener)
Removes a report listener that was previously added via
addReportListener(ReportListener). |
void |
removeServerStatusListener(ServerStatusListener listener)
Removes a server connection status listener that was previously
added via
addServerStatusListener(ServerStatusListener). |
Instrument |
resolveSymbol(String inSymbol)
Resolves the given symbol to an
Instrument. |
void |
sendOrder(OrderCancel inOrderCancel)
Sends the supplied order to the server.
|
void |
sendOrder(OrderReplace inOrderReplace)
Sends the supplied order to the server.
|
void |
sendOrder(OrderSingle inOrderSingle)
Sends the supplied order to the server.
|
void |
sendOrderRaw(FIXOrder inFIXOrder)
Sends the supplied FIX Message Order to the server.
|
void |
setUserData(Properties inProperties)
Sets the user data associated with the current user.
|
void sendOrder(OrderSingle inOrderSingle) throws ConnectionException, OrderValidationException
inOrderSingle - The order to send.ConnectionException - if there were connection errors sending
the order out to the server.OrderValidationException - if the order didn't have complete
or consistent data to be sent to the server.void sendOrder(OrderReplace inOrderReplace) throws ConnectionException, OrderValidationException
inOrderReplace - The order to send.ConnectionException - if there were connection errors sending
the order out to the server.OrderValidationException - if the orders didn't have complete
or consistent data to be sent to the server.void sendOrder(OrderCancel inOrderCancel) throws ConnectionException, OrderValidationException
inOrderCancel - The order to send.ConnectionException - if there were connection errors sending
the order out to the server.OrderValidationException - if the orders didn't have complete
or consistent data to be sent to the server.void sendOrderRaw(FIXOrder inFIXOrder) throws ConnectionException, OrderValidationException
When supplying raw FIX Message, a brokerID has to be supplied
inFIXOrder - the raw FIX Order to send.ConnectionException - if there were connection errors sending
the order to the server.OrderValidationException - if the supplied message was not of a
type that's supported by the system.ReportBase[] getReportsSince(Date inDate) throws ConnectionException
inDate - The date in UTC. Cannot be null.ConnectionException - if there were connection errors fetching
data from the server.BigDecimal getEquityPositionAsOf(Date inDate, Equity inEquity) throws ConnectionException
inDate - the date in UTC. Cannot be null.inEquity - The equity. Cannot be null.ConnectionException - if there were connection errors fetching
data from the server.Map<PositionKey<Equity>,BigDecimal> getAllEquityPositionsAsOf(Date inDate) throws ConnectionException
inDate - the date in UTC. Cannot be null.ConnectionException - if there were connection errors fetching
data from the server.BigDecimal getFuturePositionAsOf(Date inDate, Future inFuture) throws ConnectionException
inDate - the date in UTC. Cannot be null.inFuture - The future. Cannot be null.ConnectionException - if there were connection errors fetching
data from the server.Map<PositionKey<Future>,BigDecimal> getAllFuturePositionsAsOf(Date inDate) throws ConnectionException
inDate - the date in UTC. Cannot be null.ConnectionException - if there were connection errors fetching
data from the server.BigDecimal getOptionPositionAsOf(Date inDate, Option inOption) throws ConnectionException
Buy trades result in positive positions. All other kinds of trades result in negative positions.
inDate - the date in UTC. Cannot be null.inOption - the option instrumentConnectionException - if there were errors retrieving the
position.Map<PositionKey<Option>,BigDecimal> getAllOptionPositionsAsOf(Date inDate) throws ConnectionException
Buy trades result in positive positions. All other kinds of trades result in negative positions.
inDate - the date in UTC. Cannot be null.ConnectionException - if there were errors retrieving the
position map.Map<PositionKey<Option>,BigDecimal> getOptionPositionsAsOf(Date inDate, String... inRootSymbols) throws ConnectionException
Buy trades result in positive positions. All other kinds of trades result in negative positions.
inDate - the date in UTC. Cannot be null.inRootSymbols - the list of option root symbols.ConnectionException - if there were errors retrieving the
position map.BigDecimal getCurrencyPositionAsOf(Date inDate, Currency inCurrency) throws ConnectionException
inDate - the date in UTC. Cannot be null.inCurrency - The currency. Cannot be null.ConnectionException - if there were connection errors fetching
data from the server.Map<PositionKey<Currency>,BigDecimal> getAllCurrencyPositionsAsOf(Date inDate) throws ConnectionException
inDate - the date in UTC. Cannot be null.ConnectionException - if there were connection errors fetching
data from the server.String getUnderlying(String inOptionRoot) throws ConnectionException
The mapping is retrieved from the server the first time an
option root symbol is specified. The value returned by the server is
cached on the client for all subsequent invocations for the
same root symbol. All the cached values are cleared when the client
is closed.
inOptionRoot - The option root symbol.ConnectionException - if there were errors retrieving the
underlying symbol.Collection<String> getOptionRoots(String inUnderlying) throws ConnectionException
The mapping is retrieved from the server the first time an
underlying symbol is specified. The value returned by the server is
cached on the client for all subsequent invocations for the
same underlying symbol. All the cached values are cleared when the client
is closed.
inUnderlying - The underlying symbol.ConnectionException - if there were errors retrieving the
option roots.void addReportListener(ReportListener inListener)
If the same listener is added more than once, it will receive notifications as many times as it's been added.
The listeners are notified in the reverse order of their addition.
inListener - The listener instance that should be supplied
the reports.void removeReportListener(ReportListener inListener)
addReportListener(ReportListener). If the listener
was added more than once, only its most recently added occurrence
will be removed.inListener - The listener instance that should no longer
be receiving the reports.void addBrokerStatusListener(BrokerStatusListener listener)
If the same listener is added more than once, it will receive notifications as many times as it has been added.
The listeners are notified in the reverse order of their addition.
listener - The listener which should be supplied the
broker status changes.void removeBrokerStatusListener(BrokerStatusListener listener)
addBrokerStatusListener(BrokerStatusListener).
If the listener was added more than once, only its most recently added instance will be removed.
listener - The listener which should stop receiving
broker status changes.void addServerStatusListener(ServerStatusListener listener)
If the same listener is added more than once, it will receive notifications as many times as it has been added.
The listeners are notified in the reverse order of their addition.
listener - The listener which should be supplied the
server connection status changes.void removeServerStatusListener(ServerStatusListener listener)
addServerStatusListener(ServerStatusListener).
If the listener was added more than once, only its most recently added instance will be removed.
listener - The listener which should stop receiving server
connection status changes.void addExceptionListener(ExceptionListener inListener)
The listeners are notified only when connectivity issues are
encountered when sending or receiving messages, ie. when any of
the send*() methods are invoked, or when the
client receives a message and encounters errors processing it
before delivering it to ReportListener or BrokerStatusListener, or when client heartbeats cannot reach
the server.
If the same listener is added more than once, it will receive notifications as many times as it's been added.
The listeners are notified in the reverse order of their addition.
inListener - the listener instance.void removeExceptionListener(ExceptionListener inListener)
addExceptionListener(java.beans.ExceptionListener). The
listener will stop receiving exception notifications after this
method returns.
If the listener was added more than once, only its most
recently added occurrence will be removed.inListener - The exception listener that should no longervoid close()
void reconnect()
throws ConnectionException
ConnectionException - if there were errors reconnecting.void reconnect(ClientParameters inParameters) throws ConnectionException
inParameters - The parameters to use when reconnecting to the
server. These parameters are stored so that subsequent invocations
of reconnect() will use these parameters instead of the
ones that were supplied when creating this instance.ConnectionException - if there were errors reconnecting.ClientParameters getParameters()
Date getLastConnectTime()
BrokersStatus getBrokersStatus() throws ConnectionException
ConnectionException - Thrown if the operation cannot be
completed.UserInfo getUserInfo(UserID id, boolean useCache) throws ConnectionException
All cached values are cleared when the client is closed.
id - The user ID.useCache - True if the local cache should be used.ConnectionException - Thrown if the operation cannot be
completed.boolean isCredentialsMatch(String inUsername, char[] inPassword)
This method returns false if the client is not connected to the server.
inUsername - the usernameinPassword - the passwordboolean isServerAlive()
void setUserData(Properties inProperties) throws ConnectionException
inProperties - a Properties valueConnectionException - if an error occurs connecting to the serverProperties getUserData() throws ConnectionException
Properties valueConnectionException - if an error occurs connecting to the servervoid addReport(FIXMessageWrapper inReport, BrokerID inBrokerID, Hierarchy inHierarchy) throws ConnectionException
Reports added this way will be added to the system data bus. Reports will be persisted and become part of the system record. All clients will receive this report.
This will affect reported positions
.inReport - a FIXMessageWrapper valueinBrokerID - a BrokerID valueinHierarchy - a Hierarchy valueConnectionException - if an error occurs connecting to the servervoid deleteReport(ExecutionReportImpl inReport) throws ConnectionException
Reports removed this way will not be added to the system data bus and no clients will receive this report.
This will affect reported positions
.inReport - an ExecutionReportImpl valueConnectionException - if an error occurs connecting to the serverInstrument resolveSymbol(String inSymbol) throws ConnectionException
Instrument.inSymbol - a String valueInstrument valueConnectionException - if an error occurs connecting to the serverList<ReportBaseImpl> getOpenOrders() throws ConnectionException
List<ReportBaseImpl> valueConnectionException - if an error occurs connecting to the serverCopyright © 2015. All Rights Reserved.