public class MFClient
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
MFClient.TimeStats |
| Constructor and Description |
|---|
MFClient(MFString username,
MFString password,
MFString hostname1,
int port1)
Create a new client object.
|
MFClient(MFString username,
MFString password,
MFString hostname1,
int port1,
MFString hostname2,
int port2)
Create a new client object (with failover).
|
| Modifier and Type | Method and Description |
|---|---|
APIResult |
allowClientsToConnect()
Admin interface: Call this method to allow non-admin API clients to connect.
|
APIResult |
cancelAll(int feedID,
MFString cxlID)
Cancel all the orders on a feed.
|
APIResult |
cancelAll(MFString cxlID)
Cancel all the orders, on all feeds.
|
APIResult |
cancelOrder(MFString cxlID,
long orderID)
Cancel a previously placed order by internal 'orderID'.
|
APIResult |
cancelOrder(MFString cxlID,
long orderID,
MFString clOrdID)
Cancel a previously placed order by providing both internal 'orderID' and clOrdID.
|
APIResult |
cancelOrder(MFString cxlID,
MFString clOrdID)
Cancel a previously placed order by client order id ('clOrdID').
|
APIResult |
close()
Close the connection.
|
APIResult |
connect()
Connect to the first available server with user credentials.
|
void |
enableDebugMetrics(boolean flag)
Deprecated.
this call no longer sends metrics to the server. There is no replacement call as of yet.
|
long |
getCurrentBatchID()
To be called from the MFHandler.onMarketData callback.
|
FeedMarketID[] |
getCurrentBatchMarkets()
To be called from the MFHandler.onMarketData callback.
|
APIFeed |
getFeedByID(int id)
After a successful connection is established, you may access the server's
list of _feeds, markets.
|
APIFeed |
getFeedByName(java.lang.CharSequence name)
After a successful connection is established, you may access the server's
list of _feeds, markets.
|
APIFeed[] |
getFeeds() |
MFString |
getHostname() |
java.util.List<PingTime> |
getLastPingTimes()
Gets the list of most recently stored PingTime objects from oldest to most recent - if any.
|
APIMarket |
getMarketByID(APIFeed feed,
int marketID)
After a successful connection is established, you may access the server's
list of _feeds, markets.
|
APIMarket |
getMarketByName(APIFeed feed,
java.lang.CharSequence name)
After a successful connection is established, you may access the server's
list of _feeds, markets.
|
int |
getPort() |
int |
getSequenceID(int feedID)
Get the last received sequenceID.
|
MFString |
getSignature() |
void |
handle(com.marketfactory.zerogc.api.AcceptOrderMessage msg) |
void |
handle(com.marketfactory.zerogc.api.BatchesCompletedMessage msg) |
void |
handle(com.marketfactory.zerogc.api.BatchRegisterMessage msg) |
void |
handle(com.marketfactory.zerogc.api.BatchUnregisterMessage msg) |
void |
handle(com.marketfactory.zerogc.api.CancelAllOrderMessage msg) |
void |
handle(com.marketfactory.zerogc.api.CancelOrderMessage msg) |
void |
handle(com.marketfactory.zerogc.api.CancelQuoteMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ClientConnectMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ClientDisconnectMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ConfigMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ConnectResponseMessage msg) |
void |
handle(com.marketfactory.zerogc.api.DateRolloverMessage msg) |
void |
handle(com.marketfactory.zerogc.api.DropCopyMessage msg) |
void |
handle(com.marketfactory.zerogc.api.EventReportMessage msg) |
void |
handle(com.marketfactory.zerogc.api.HeartbeatMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ImHereMessage msg) |
void |
handle(com.marketfactory.zerogc.api.InsertLogMessage msg) |
void |
handle(com.marketfactory.zerogc.api.JsonFromClient msg) |
void |
handle(com.marketfactory.zerogc.api.JsonFromServer msg) |
void |
handle(com.marketfactory.zerogc.api.LastSequenceIDMessage msg) |
void |
handle(com.marketfactory.zerogc.api.LockResponseMessage msg) |
void |
handle(com.marketfactory.zerogc.api.LockUserMessage msg) |
void |
handle(com.marketfactory.zerogc.api.MassQuoteAckMessage msg) |
void |
handle(com.marketfactory.zerogc.api.MassQuoteMessage msg) |
void |
handle(com.marketfactory.zerogc.api.MktDataMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ModifyOrderMessage msg) |
void |
handle(com.marketfactory.zerogc.api.NewOrderMessage msg) |
void |
handle(com.marketfactory.zerogc.api.OrderCanceledMessage msg) |
void |
handle(com.marketfactory.zerogc.api.OrderCancelRejectedMessage msg) |
void |
handle(com.marketfactory.zerogc.api.OrderDoneMessage msg) |
void |
handle(com.marketfactory.zerogc.api.OrderReceivedMessage msg) |
void |
handle(com.marketfactory.zerogc.api.OrderRejectedMessage msg) |
void |
handle(com.marketfactory.zerogc.api.OrderSubmittedMessage msg) |
void |
handle(com.marketfactory.zerogc.api.OrderTimeoutMessage msg) |
void |
handle(com.marketfactory.zerogc.api.QuoteRequestMessage msg) |
void |
handle(com.marketfactory.zerogc.api.RejectOrderMessage msg) |
void |
handle(com.marketfactory.zerogc.api.RejectQuoteRequestMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ReplayDoneMessage msg) |
void |
handle(com.marketfactory.zerogc.api.ReplayMessage msg) |
void |
handle(com.marketfactory.zerogc.api.RequestSnapshotMessage msg) |
void |
handle(com.marketfactory.zerogc.api.RiskResponseMessage msg) |
void |
handle(com.marketfactory.zerogc.api.RuThereMessage msg) |
void |
handle(com.marketfactory.zerogc.api.SubmitOrderMessage msg) |
void |
handle(com.marketfactory.zerogc.api.SubscribeMessage msg) |
void |
handle(com.marketfactory.zerogc.api.SubscriptionEventMessage msg) |
void |
handle(com.marketfactory.zerogc.api.TestMessage msg) |
void |
handle(com.marketfactory.zerogc.api.TradeCaptureAckMessage msg) |
void |
handle(com.marketfactory.zerogc.api.TradeCaptureMessage msg) |
void |
handle(com.marketfactory.zerogc.api.TradeLimitDataMessage msg) |
void |
handle(com.marketfactory.zerogc.api.UnsubscribeAllMessage msg) |
void |
handle(com.marketfactory.zerogc.api.UnsubscribeMessage msg) |
void |
handle(com.marketfactory.zerogc.api.VersionMessage msg) |
boolean |
isConnected() |
boolean |
isRunning() |
APIResult |
join()
Block until the client has exited the dispatch loop.
|
APIResult |
lockUser(MFString clRequestID,
MFString username,
boolean locked)
Admin interface: Lock / unlock user accounts.
|
void |
modifyOrder(MFString clOrdID,
MFString clNewID,
MFFloat amount,
MFFloat price,
OrderIdPair result)
Submit modification to an existing order.
|
static MFClient |
open(MFString user,
MFString pass,
MFString host,
int port)
A convenience method which creates a new client object, attempts to
connect to Whisperer, and cleans up and throws an exception if we could
not connect.
|
static MFClient |
open(MFString user,
MFString pass,
MFString host,
int port,
boolean useHeartbeat) |
static MFClient |
open(MFString user,
MFString pass,
MFString hostname1,
int port1,
MFString hostname2,
int port2)
A convenience method which creates a new client object, attempts to
connect to Whisperer, and cleans up and throws an exception if we could
not connect.
|
static MFClient |
open(MFString user,
MFString pass,
MFString hostname1,
int port1,
MFString hostname2,
int port2,
boolean useHeartbeat)
A convenience method which creates a new client object, attempts to
connect to Whisperer, and cleans up and throws an exception if we could
not connect.
|
APIResult |
processEvents(MFHandler handler)
Process all pending events in the reactor, and return as soon as
reads/writes have been flushed.
|
Pair<APIResult,java.lang.Integer> |
registerMarketComb(int feedID,
int[] marketIds)
Register for a given list of markets on a given feed.
|
APIResult |
replay(int feedID,
int fromSequenceID,
int toSequenceID)
Request replay of order flow events in the range [fromSequenceID, toSequenceID].
|
APIResult |
requestSnapshot(int feedID,
int marketID)
Request a market data snapshot for the feed and market ID.
|
APIResult |
run(MFHandler _handler)
Run a loop that will continuously dispatch incoming messages to a
_handler implementation.
|
void |
setDebug(boolean debug)
Deprecated.
MF devs only - set the mode using a JVM arg -
Options.MF_DEV_LOG_DEBUG_MESSAGES_JVM_ARG |
void |
setStickySubscriptions(boolean sticky) |
void |
setStickySubscriptions(boolean sticky,
boolean clearSubscriptionsOnStop) |
void |
setUseHeartbeat(boolean use) |
APIResult |
stop()
Request to stop the event dispatch loop.
|
void |
submitOrder(MFString clOrdID,
int feedID,
int marketID,
Side side,
MFFloat amount,
MFFloat price,
MFFloat stopPrice,
MFFloat maxShowAmt,
MFFloat minFillAmt,
OrderType ordType,
TimeInForce tif,
OrderIdPair result)
Submit an order.
|
void |
submitOrder(MFString clOrdID,
int feedID,
int marketID,
Side side,
MFFloat amount,
MFFloat price,
MFFloat stopPrice,
MFFloat maxShowAmt,
OrderType ordType,
TimeInForce tif,
java.util.ArrayList<KeyValue> parameters,
OrderIdPair result)
Submit an order.
|
void |
submitOrder(MFString clOrdID,
int feedID,
int marketID,
Side side,
MFFloat amount,
MFFloat price,
OrderType ordType,
TimeInForce tif,
java.util.ArrayList<KeyValue> parameters,
OrderIdPair result)
Submit an order.
|
void |
submitOrder(MFString clOrdID,
int feedID,
int marketID,
Side side,
MFFloat amount,
MFFloat price,
OrderType ordType,
TimeInForce tif,
OrderIdPair result)
Submit an order.
|
APIResult |
subscribeAllMD()
Subscribe to all the market data feeds.
|
APIResult |
subscribeMD(int feedID,
int marketID)
Subscribe to market data updates for a specific feed.
|
APIResult |
subscribeMD(int feedID,
int marketID,
MFString clSubID)
Subscribe to market data updates for a specific feed.
|
APIResult |
subscribeOF(int feedID)
Subscribe to trading for a specific feed.
|
APIResult |
subscribeOF(int feedID,
MFString clSubID)
Subscribe to trading for a specific feed.
|
APIResult |
unregisterMarketComb(int batchDefID)
Unregister for a given list of markets on a given feed using the id
provided in onBatchEvent callback.
|
APIResult |
unsubscribeAll()
Unsubscribe all market data and trading subscriptions.
|
APIResult |
unsubscribeMD(int feedID,
int marketID)
Unsubscribe to market data updates for a specific feed.
|
APIResult |
unsubscribeMD(int feedID,
int marketID,
MFString clSubID)
Unsubscribe to market data updates for a specific feed.
|
APIResult |
unsubscribeOF(int feedID)
Unsubscribe to trading for a specific feed.
|
APIResult |
unsubscribeOF(int feedID,
MFString clSubID)
Unsubscribe to trading for a specific feed.
|
public MFClient(MFString username, MFString password, MFString hostname1, int port1)
username - -- the usernamepassword - -- the passwordhostname1 - -- primary hostport1 - -- primary portpublic MFClient(MFString username, MFString password, MFString hostname1, int port1, MFString hostname2, int port2)
username - -- the usernamepassword - -- the passwordhostname1 - -- primary hostport1 - -- primary porthostname2 - secondary hostport2 - -- secondary portpublic void setUseHeartbeat(boolean use)
public void setDebug(boolean debug)
Options.MF_DEV_LOG_DEBUG_MESSAGES_JVM_ARGdebug - debug mode true or false.public void enableDebugMetrics(boolean flag)
flag - true to turn on the debug metricspublic void setStickySubscriptions(boolean sticky)
sticky - - Enable/Disable sticky subscriptions.
Set clearSubscriptionsOnStop=false if subscriptions should persist on stop/start.public void setStickySubscriptions(boolean sticky,
boolean clearSubscriptionsOnStop)
public boolean isConnected()
public APIResult connect()
public APIResult close()
public boolean isRunning()
public APIResult stop()
public APIResult join()
public APIResult run(MFHandler _handler)
_handler - -- the handler to be runpublic APIResult processEvents(MFHandler handler)
handler - -- handler to dispatch events topublic MFString getSignature()
public int getSequenceID(int feedID)
feedID - -- the feed idpublic APIFeed[] getFeeds()
public APIFeed getFeedByName(java.lang.CharSequence name)
name - -- the name of the feedpublic APIFeed getFeedByID(int id)
id - -- the feed idpublic APIMarket getMarketByName(APIFeed feed, java.lang.CharSequence name)
feed - -- the feedname - -- name of the marketpublic APIMarket getMarketByID(APIFeed feed, int marketID)
feed - -- feedmarketID - -- market idpublic MFString getHostname()
public int getPort()
public void handle(com.marketfactory.zerogc.api.ConfigMessage msg)
public void handle(com.marketfactory.zerogc.api.ConnectResponseMessage msg)
public void handle(com.marketfactory.zerogc.api.ClientDisconnectMessage msg)
public void handle(com.marketfactory.zerogc.api.TestMessage msg)
public void handle(com.marketfactory.zerogc.api.ImHereMessage msg)
public void handle(com.marketfactory.zerogc.api.HeartbeatMessage msg)
public java.util.List<PingTime> getLastPingTimes()
Refer to PingHandler.getLastPingTimes()
public APIResult replay(int feedID, int fromSequenceID, int toSequenceID)
feedID - -- feed idfromSequenceID - -- the first sequence idtoSequenceID - -- last sequence id. -1 means to the latest seqnopublic APIResult subscribeMD(int feedID, int marketID, MFString clSubID)
feedID - -- feed idmarketID - -- market idclSubID - -- client subscription idpublic APIResult subscribeMD(int feedID, int marketID)
feedID - -- feed idmarketID - -- market idpublic APIResult subscribeOF(int feedID, MFString clSubID)
feedID - -- feed idclSubID - -- client subscription idpublic APIResult subscribeOF(int feedID)
feedID - -- feed idpublic APIResult subscribeAllMD()
public APIResult unsubscribeMD(int feedID, int marketID, MFString clSubID)
feedID - -- feed idmarketID - -- market idclSubID - -- client subscription idpublic APIResult unsubscribeMD(int feedID, int marketID)
feedID - -- feed idmarketID - -- market idpublic APIResult unsubscribeOF(int feedID, MFString clSubID)
feedID - -- feed idclSubID - -- client subscription idpublic APIResult unsubscribeOF(int feedID)
feedID - -- feed idpublic APIResult unsubscribeAll()
public void handle(com.marketfactory.zerogc.api.SubscriptionEventMessage msg)
public Pair<APIResult,java.lang.Integer> registerMarketComb(int feedID, int[] marketIds)
feedID - -- feed idmarketIds - -- array of market idspublic APIResult unregisterMarketComb(int batchDefID)
batchDefID - -- the batch definition idpublic long getCurrentBatchID()
public FeedMarketID[] getCurrentBatchMarkets()
public void handle(com.marketfactory.zerogc.api.MktDataMessage msg)
public APIResult requestSnapshot(int feedID, int marketID)
feedID - -- feed idmarketID - -- market idpublic void handle(com.marketfactory.zerogc.api.RequestSnapshotMessage msg)
public void handle(com.marketfactory.zerogc.api.BatchesCompletedMessage msg)
public void handle(com.marketfactory.zerogc.api.LastSequenceIDMessage msg)
public void submitOrder(MFString clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, OrderType ordType, TimeInForce tif, OrderIdPair result)
clOrdID - -- client order idfeedID - -- feed idmarketID - -- market idside - -- buy or sellamount - -- order sizeprice - -- pxordType - - order typetif - -- time-in-forceresult - -- The first member is APIResult.OK if the order has been sent.
The second member is the orderID.public void submitOrder(MFString clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, OrderType ordType, TimeInForce tif, java.util.ArrayList<KeyValue> parameters, OrderIdPair result)
clOrdID - -- client order idfeedID - -- feed idmarketID - -- market idside - -- buy or sellamount - -- order sizeprice - -- pxordType - -- order typetif - -- time-in-forceparameters - -- additional parametersresult - -- The first member is APIResult.OK if the order has been sent.
The second member is the orderID.public void submitOrder(MFString clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, MFFloat stopPrice, MFFloat maxShowAmt, MFFloat minFillAmt, OrderType ordType, TimeInForce tif, OrderIdPair result)
clOrdID - -- client order idfeedID - -- feed idmarketID - -- market idside - -- buy or sellamount - -- order sizeprice - -- pxstopPrice - -- stop pxmaxShowAmt - -- max show amountminFillAmt - -- minimum fill amountordType - -- the order typetif - -- time-in-forceresult - -- The first member is APIResult.OK if the order has been sent.
The second member is the orderID.public void submitOrder(MFString clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, MFFloat stopPrice, MFFloat maxShowAmt, OrderType ordType, TimeInForce tif, java.util.ArrayList<KeyValue> parameters, OrderIdPair result)
clOrdID - -- client order idfeedID - -- feed idmarketID - -- market idside - -- buy or sellamount - -- size of the orderprice - -- px of the orderstopPrice - -- stop pxmaxShowAmt - -- max show amountordType - -- type of ordertif - -- time-in-forceparameters - -- additional parametersresult - -- The first member is APIResult.OK if the order has been sent.
The second member is the orderID.public void modifyOrder(MFString clOrdID, MFString clNewID, MFFloat amount, MFFloat price, OrderIdPair result)
clOrdID - -- the client order id to be replacedclNewID - -- the new client order idamount - -- the new amountprice - -- the new priceresult - -- The first member is APIResult.OK if the order has been sent.
The second member is the orderID.public APIResult cancelOrder(MFString cxlID, MFString clOrdID)
cxlID - -- cancel idclOrdID - -- client order id to be cancelled.public APIResult cancelOrder(MFString cxlID, long orderID)
cxlID - -- cancel idorderID - -- order id to be cancelled.public APIResult cancelOrder(MFString cxlID, long orderID, MFString clOrdID)
public APIResult cancelAll(int feedID, MFString cxlID)
feedID - -- the id of the feed.cxlID - -- the id of the cancel event.public APIResult cancelAll(MFString cxlID)
cxlID - -- the id of the cancel event.public APIResult allowClientsToConnect()
public APIResult lockUser(MFString clRequestID, MFString username, boolean locked)
clRequestID - -- the client request idusername - -- userlocked - -- lock the userpublic void handle(com.marketfactory.zerogc.api.RiskResponseMessage msg)
public void handle(com.marketfactory.zerogc.api.LockResponseMessage msg)
public void handle(com.marketfactory.zerogc.api.OrderReceivedMessage msg)
public void handle(com.marketfactory.zerogc.api.OrderSubmittedMessage msg)
public void handle(com.marketfactory.zerogc.api.OrderRejectedMessage msg)
public void handle(com.marketfactory.zerogc.api.OrderCanceledMessage msg)
public void handle(com.marketfactory.zerogc.api.OrderCancelRejectedMessage msg)
public void handle(com.marketfactory.zerogc.api.DropCopyMessage msg)
public void handle(com.marketfactory.zerogc.api.TradeCaptureMessage msg)
public void handle(com.marketfactory.zerogc.api.OrderDoneMessage msg)
public void handle(com.marketfactory.zerogc.api.QuoteRequestMessage msg)
public void handle(com.marketfactory.zerogc.api.RejectQuoteRequestMessage msg)
public void handle(com.marketfactory.zerogc.api.CancelQuoteMessage msg)
public void handle(com.marketfactory.zerogc.api.MassQuoteMessage msg)
public void handle(com.marketfactory.zerogc.api.MassQuoteAckMessage msg)
public void handle(com.marketfactory.zerogc.api.NewOrderMessage msg)
public void handle(com.marketfactory.zerogc.api.RejectOrderMessage msg)
public void handle(com.marketfactory.zerogc.api.AcceptOrderMessage msg)
public void handle(com.marketfactory.zerogc.api.OrderTimeoutMessage msg)
public void handle(com.marketfactory.zerogc.api.TradeCaptureAckMessage msg)
public void handle(com.marketfactory.zerogc.api.EventReportMessage msg)
public void handle(com.marketfactory.zerogc.api.ReplayDoneMessage msg)
public void handle(com.marketfactory.zerogc.api.DateRolloverMessage msg)
public void handle(com.marketfactory.zerogc.api.JsonFromServer msg)
public void handle(com.marketfactory.zerogc.api.RuThereMessage msg)
public void handle(com.marketfactory.zerogc.api.VersionMessage msg)
public void handle(com.marketfactory.zerogc.api.InsertLogMessage msg)
public void handle(com.marketfactory.zerogc.api.ClientConnectMessage msg)
public void handle(com.marketfactory.zerogc.api.ReplayMessage msg)
public void handle(com.marketfactory.zerogc.api.BatchRegisterMessage msg)
public void handle(com.marketfactory.zerogc.api.BatchUnregisterMessage msg)
public void handle(com.marketfactory.zerogc.api.SubscribeMessage msg)
public void handle(com.marketfactory.zerogc.api.UnsubscribeMessage msg)
public void handle(com.marketfactory.zerogc.api.UnsubscribeAllMessage msg)
public void handle(com.marketfactory.zerogc.api.SubmitOrderMessage msg)
public void handle(com.marketfactory.zerogc.api.CancelOrderMessage msg)
public void handle(com.marketfactory.zerogc.api.CancelAllOrderMessage msg)
public void handle(com.marketfactory.zerogc.api.ModifyOrderMessage msg)
public void handle(com.marketfactory.zerogc.api.LockUserMessage msg)
public void handle(com.marketfactory.zerogc.api.TradeLimitDataMessage msg)
public void handle(com.marketfactory.zerogc.api.JsonFromClient msg)
public static MFClient open(MFString user, MFString pass, MFString host, int port) throws java.io.IOException
user - -- usernamepass - -- passwordhost - -- mf hostnameport - -- mf portjava.io.IOException - if connection failspublic static MFClient open(MFString user, MFString pass, MFString host, int port, boolean useHeartbeat) throws java.io.IOException
java.io.IOExceptionpublic static MFClient open(MFString user, MFString pass, MFString hostname1, int port1, MFString hostname2, int port2) throws java.io.IOException
user - -- usernamepass - -- passwordhostname1 - -- primary hostport1 - -- primary porthostname2 - -- secondary hostport2 - -- secondary portjava.io.IOException - if connection failspublic static MFClient open(MFString user, MFString pass, MFString hostname1, int port1, MFString hostname2, int port2, boolean useHeartbeat) throws java.io.IOException
user - -- usernamepass - -- passwordhostname1 - -- primary hostport1 - -- primary porthostname2 - -- secondary hostport2 - -- secondary portuseHeartbeat - -- enable or disable heartbeatingjava.io.IOException - -- if connection fails