...
| Code Block |
|---|
| language | java |
|---|
| title | MarketData Session creation |
|---|
|
/**
* Creates a session for connecting to a particular
* venue gateway over TCP.
*
* @param port specify 0 to have it automatically choose port.
* @param autoRelogon automatically relogons when a disconnection occurs.
*/
MFMarketDataSession newTcpMarketDataSession(MFMarketDataHandler handler,
String venueName,
long venueID,
String username,
String password,
String hostname,
int port,
boolean autoRelogon) throws MFException;
|
| Code Block |
|---|
| language | java |
|---|
| title | PriceDepthBook Session creation |
|---|
|
/**
* Creates a session for connecting to a particular
* venue gateway over TCP.
*
* @param port specify 0 to have it automatically choose port.
* @param reconnectOnDisconnect automatically reconnects when a disconnection occurs.
**/
MFMarketDataSession newTcpMarketDataPriceDepthBookSession(MFPriceDepthBookHandler handler,
String venueName,
long venueID,
String username,
String password,
String hostname,
int port,
boolean reconnectOnDisconnect) throws MFException;
|
Notice that a newTcpMarketDataSession expects a MFMarketDataHandler while newTcpMarketDataPriceDepthBookSession expects a MFPriceDepthBookHandler
As for the newTcpTradingSession() method, both of these market data-related methods take MarketFactory login credentials (username and password), and MarketFactory server address details (hostname and port). The boolean option autoReconnect is used to indicate if the MFClient instance should automatically re-logon when a disconnection of the MFClient from the MarketFactory server occurs.
TradingSessionMFTradingHandler | name | GeneralSessionSequenceDiagram |
|---|
| pagePin | 3 |
|---|
|
onStart()
logon()
onConnect()
onLogonResponse()
callbacks
logout()
logoutResponse()
onDisconnect()
Figure 1.1. – Showing the flow to demonstrate the session lifecycle of a session. Trading is shown, but
MarketData is similar.
The MFClient layer lives in the directory $MFAPI/MFClient/.
MFClient is the central class for managing sessions with MarketFactory. Session objects are generated by the factory methods of MFClient, and are automatically registered with this instance of MFClient.
com.marketfactory.api contains interfaces, while the packages under com.marketfactory.internal
contains the implementations.