|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Client
A client end point that communicates with the server.
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} getOptionPositionAsOf(java.util.Date, Option) fetch option position} getOptionPositionsAsOf(java.util.Date, String[]) fetch option positions} getAllOptionPositionsAsOf(java.util.Date) fetch all open option positions}
| Method Summary | |
|---|---|
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 |
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. |
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 |
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. |
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). |
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. |
| Method Detail |
|---|
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 instrument
ConnectionException - 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.
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 password
boolean isServerAlive()
void setUserData(Properties inProperties)
throws ConnectionException
inProperties - a Properties value
ConnectionException - if an error occurs connecting to the server
Properties getUserData()
throws ConnectionException
Properties value
ConnectionException - if an error occurs connecting to the server
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||