messenger
Class FXTradingMessenger

java.lang.Object
  extended by messenger.FXTradingMessenger

public class FXTradingMessenger
extends java.lang.Object

Contains methods to execute trades using the server.


Field Summary
static char BUY
          Integer used to specify the buy side of a trade.
static int DEFAULT_PORT_1
           
static int DEFAULT_PORT_2
           
static java.lang.String DEFAULT_SESSION_ID_1
           
static java.lang.String DEFAULT_SESSION_ID_2
           
protected  quickfix.Initiator initiator
           
static char SELL
          Integer used to specify the sell side of a trade.
protected  quickfix.SessionID sessionID
           
 
Constructor Summary
FXTradingMessenger(FXTradingListener listener)
          Constructor which configures the messager for connecting to the server.
FXTradingMessenger(FXTradingListener listener, java.lang.String serverID, int portNumber)
          Constructor which configures the messager specifying session ID and port number.
 
Method Summary
protected  void checkCurrencyPair(java.lang.String currencyPair)
           
protected static void checkForNull(java.lang.Object o)
           
 void connect()
          Start accepting connections.
 void disconnect()
          Stops all sessions, optionally waiting for logout completion.
 void executeTrade(java.lang.String username, java.lang.String clientOrderID, java.lang.String currencyPair, double amount, char type, double price)
          Executes message to the server to execute a trade.
protected  void initialiseFields(messenger.FXConnectionApplication fixApp, java.lang.String targetCompID, int portNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUY

public static final char BUY
Integer used to specify the buy side of a trade.

See Also:
Constant Field Values

SELL

public static final char SELL
Integer used to specify the sell side of a trade.

See Also:
Constant Field Values

DEFAULT_SESSION_ID_1

public static final java.lang.String DEFAULT_SESSION_ID_1
See Also:
Constant Field Values

DEFAULT_SESSION_ID_2

public static final java.lang.String DEFAULT_SESSION_ID_2
See Also:
Constant Field Values

DEFAULT_PORT_1

public static final int DEFAULT_PORT_1
See Also:
Constant Field Values

DEFAULT_PORT_2

public static final int DEFAULT_PORT_2
See Also:
Constant Field Values

initiator

protected quickfix.Initiator initiator

sessionID

protected quickfix.SessionID sessionID
Constructor Detail

FXTradingMessenger

public FXTradingMessenger(FXTradingListener listener)
Constructor which configures the messager for connecting to the server. Requires: listener is not null

Parameters:
listener - Listener for callbacks.

FXTradingMessenger

public FXTradingMessenger(FXTradingListener listener,
                          java.lang.String serverID,
                          int portNumber)
Constructor which configures the messager specifying session ID and port number.

Parameters:
listener - for callbacks
sessionID - session ID
portNumber - port number
Method Detail

executeTrade

public void executeTrade(java.lang.String username,
                         java.lang.String clientOrderID,
                         java.lang.String currencyPair,
                         double amount,
                         char type,
                         double price)
Executes message to the server to execute a trade. Requires: a connection to the server exists,clOrdID is a String, currencyPair is in format XXX/YYY,
amount is > 0 and type is FXTradingMessager.BUY or FXTradingMessager.SELL.

Parameters:
clientOrderID - Client order ID (must be unique to client)
currencyPair - Should be in string format. e.g. GBP/USD
amount - Should be in double format. Specify the amount that user would like to trade.
type - Should be string format. Specify the type of order you would like. E.g BUY
price - The price of the trade.

connect

public void connect()
Start accepting connections.


disconnect

public void disconnect()
Stops all sessions, optionally waiting for logout completion.


initialiseFields

protected void initialiseFields(messenger.FXConnectionApplication fixApp,
                                java.lang.String targetCompID,
                                int portNumber)

checkForNull

protected static void checkForNull(java.lang.Object o)

checkCurrencyPair

protected void checkCurrencyPair(java.lang.String currencyPair)