MFClient (3.14.0 310 API)
Date: 2018-05-30

com.marketfactory.zerogc.api

## Class MFClient

- java.lang.Object
- - com.marketfactory.zerogc.api.MFClient

- Direct Known Subclasses:
    MFAdmin

      public class MFClient
      extends java.lang.Object

  An API client, which processes a single network connection. There may be more than one client instance, one for each network connection. A client dispatches callbacks on a _handler interface which the client implements. @see MFHandler.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `MFClient.TimeStats`

  - ### Constructor Summary

    Constructors
    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).

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MFClient

          public MFClient(MFString username,
                          MFString password,
                          MFString hostname1,
                          int port1)

      Create a new client object. A new client still needs to be connected (see connect()).
      Parameters:
        `username` - -- the username
        `password` - -- the password
        `hostname1` - -- primary host
        `port1` - -- primary port

    - #### MFClient

          public MFClient(MFString username,
                          MFString password,
                          MFString hostname1,
                          int port1,
                          MFString hostname2,
                          int port2)

      Create a new client object (with failover). A new client still needs to be connected (see connect()).
      Parameters:
        `username` - -- the username
        `password` - -- the password
        `hostname1` - -- primary host
        `port1` - -- primary port
        `hostname2` - secondary host
        `port2` - -- secondary port

  - ### Method Detail

    - #### setUseHeartbeat

          public void setUseHeartbeat(boolean use)

    - #### setDebug

          public void setDebug(boolean debug)

      Deprecated. MF devs only - set the mode using a JVM arg - `Options.MF_DEV_LOG_DEBUG_MESSAGES_JVM_ARG`
      Sets debug mode. Intended for Internal MF Devs only.
      Parameters:
        `debug` - debug mode true or false.

    - #### enableDebugMetrics

          public void enableDebugMetrics(boolean flag)

      Deprecated. this call no longer sends metrics to the server. There is no replacement call as of yet.
      If computed the statistics will be sent to the server periodically.
      Parameters:
        `flag` - true to turn on the debug metrics

    - #### setStickySubscriptions

          public void setStickySubscriptions(boolean sticky)

      Parameters:
        `sticky` - - Enable/Disable sticky subscriptions. Set clearSubscriptionsOnStop=false if subscriptions should persist on stop/start.

    - #### setStickySubscriptions

          public void setStickySubscriptions(boolean sticky,
                                             boolean clearSubscriptionsOnStop)

    - #### isConnected

          public boolean isConnected()

      Returns:
        true if the _channel is _connected.

    - #### connect

          public APIResult connect()

      Connect to the first available server with user credentials.
      Returns:
        APIResult.OK if the connection attempt succeeded. Note: this should not be invoked by _handler.

    - #### close

          public APIResult close()

      Close the connection. (This can only be called this when you're not dispatching.) Note: this should not be invoked by _handler.
      Returns:
        result flag of the close call.

    - #### isRunning

          public boolean isRunning()

      Returns:
        true if the client is currently dispatching events (i.e., you called run()).

    - #### stop

          public APIResult stop()

      Request to stop the event dispatch loop. Does not disconnect the client from the server.
      Returns:
        flag indicating the result of the stop call.

    - #### join

          public APIResult join()

      Block until the client has exited the dispatch loop. Note: this should not be invoked by _handler.
      Returns:
        the enum result of the join call.

    - #### run

          public APIResult run(MFHandler _handler)

      Run a loop that will continuously dispatch incoming messages to a _handler implementation.
      Parameters:
        `_handler` - -- the handler to be run
      Returns:
        This method returns some time after a request to stop is made using stop(), or if an error occurs (e.g. the connection is broken). A zero return value indicates a normal exit via a stop request. If the connection is broken and the client succesfully fails over to a secondary server, this dispatcher does not return; onDisconnect() and onConnect() are invoked to let the handler know that this occurred. If the reconnection attempt is not successful, the dispatcher will return an error code. Every call to run() must be preceded by a successful connect() -- this call is made for you, but only once, when a client is obtained via open(). Note: this should not be invoked by _handler.

    - #### processEvents

          public APIResult processEvents(MFHandler _handler)

      Process all pending events in the reactor, and return as soon as reads/writes have been flushed. This can be used to integrate our API within a GUI toolkit's event processing loop without having to create a secondary thread.
      Parameters:
        `_handler` - -- the handler to be run
      Returns:
        the processing result enum value

    - #### getSignature

          public MFString getSignature()

      Returns:
        Get protocol api signature.

    - #### getSequenceID

          public int getSequenceID(int feedID)

      Get the last received sequenceID.
      Parameters:
        `feedID` - -- the feed id
      Returns:
        -2 if not connected.

    - #### getFeeds

          public APIFeed[] getFeeds()

      Returns:
        After a successful connection is established, you may access the server's list of _feeds, markets. If you have not yet _connected to the server this will return empty.

    - #### getFeedByName

          public APIFeed getFeedByName(java.lang.CharSequence name)

      After a successful connection is established, you may access the server's list of _feeds, markets. This method will return a pointer to the feed of a given name if it exists and NULL if it does not. (this class maintains ownership to the object so do not delete it).
      Parameters:
        `name` - -- the name of the feed
      Returns:
        a pointer to the Feed of the given name or NULL if it does not exist.

    - #### getFeedByID

          public APIFeed getFeedByID(int id)

      After a successful connection is established, you may access the server's list of _feeds, markets. This method will return a pointer to the feed of a given id if it exists and NULL if it does not. (this class maintains ownership to the object so do not delete it).
      Parameters:
        `id` - -- the feed id
      Returns:
        a pointer to the Feed of the given id or NULL if it does not exist.

    - #### getMarketByName

          public APIMarket getMarketByName(APIFeed feed,
                                           java.lang.CharSequence name)

      After a successful connection is established, you may access the server's list of _feeds, markets. This method will return a pointer to the market with a given name within the specified feed if such market exists or NULL if there is no market with the same name.
      Parameters:
        `feed` - -- the feed
        `name` - -- name of the market
      Returns:
        a pointer to the Market with the given name within the given feed or NULL if it does not exist.

    - #### getMarketByID

          public APIMarket getMarketByID(APIFeed feed,
                                         int marketID)

      After a successful connection is established, you may access the server's list of _feeds, markets. This method will return a pointer to the market with a given id within the specified feed if such market exists or NULL if there is no market with the same id.
      Parameters:
        `feed` - -- feed
        `marketID` - -- market id
      Returns:
        a pointer to the Market with the given market id within the given feed or NULL if it does not exist.

    - #### getHostname

          public MFString getHostname()

      Returns:
        the primary/secondary server hostname (whichever one is being used). Does not indicate whether a connection is in progress or successfully established.

    - #### getPort

          public int getPort()

      Returns:
        the primary/secondary server port (whichever one is being used). Does not indicate whether a connection is in progress or successfully established.

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ConfigMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ConnectResponseMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ClientDisconnectMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.TestMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ImHereMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.HeartbeatMessage msg)

    - #### getLastPingTimes

          public java.util.List<PingTime> getLastPingTimes()

      Gets the list of most recently stored PingTime objects from oldest to most recent - if any.
      Note:You must have heartbeats turned on to have pings calculated.

      Refer to `PingHandler.getLastPingTimes()`

      Returns:
        received PingTime objects in order of oldest to most recent

    - #### replay

          public APIResult replay(int feedID,
                                  int fromSequenceID,
                                  int toSequenceID)

      Request replay of order flow events in the range [fromSequenceID, toSequenceID].
      Parameters:
        `feedID` - -- feed id
        `fromSequenceID` - -- the first sequence id
        `toSequenceID` - -- last sequence id. -1 means to the latest seqno
      Returns:
        APIResult.OK if the replay request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### subscribeMD

          public APIResult subscribeMD(int feedID,
                                       int marketID,
                                       MFString clSubID)

      Subscribe to market data updates for a specific feed. onSubscriptionEvent() will be called to notify that the flow of updates is ready. If the subscription is valid, onMarketData() will be called later on. The client subscription ID allows one-to-one message matching.
      Parameters:
        `feedID` - -- feed id
        `marketID` - -- market id
        `clSubID` - -- client subscription id
      Returns:
        APIResult.OK if the subscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### subscribeMD

          public APIResult subscribeMD(int feedID,
                                       int marketID)

      Subscribe to market data updates for a specific feed. onSubscriptionEvent() will be called to notify that the flow of updates is ready. If the subscription is valid, onMarketData() will be called later on.
      Parameters:
        `feedID` - -- feed id
        `marketID` - -- market id
      Returns:
        APIResult.OK if the subscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### subscribeOF

          public APIResult subscribeOF(int feedID,
                                       MFString clSubID)

      Subscribe to trading for a specific feed. onSubscriptionEvent() will be called to notify that the order gateway is ready. If the subscription is valid, it will be possible to submit and cancel orders and receive trading events.
      Parameters:
        `feedID` - -- feed id
        `clSubID` - -- client subscription id
      Returns:
        APIResult.OK if the subscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### subscribeOF

          public APIResult subscribeOF(int feedID)

      Subscribe to trading for a specific feed. onSubscriptionEvent() will be called to notify that the order gateway is ready. If the subscription is valid, it will be possible to submit and cancel orders and receive trading events.
      Parameters:
        `feedID` - -- feed id
      Returns:
        APIResult.OK if the subscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### subscribeAllMD

          public APIResult subscribeAllMD()

      Subscribe to all the market data feeds. This is intended as a test utility; ideally you control which feeds and markets you connect to.
      Returns:
        APIResult.OK if the subscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeMD

          public APIResult unsubscribeMD(int feedID,
                                         int marketID,
                                         MFString clSubID)

      Unsubscribe to market data updates for a specific feed.
      Parameters:
        `feedID` - -- feed id
        `marketID` - -- market id
        `clSubID` - -- client subscription id
      Returns:
        APIResult.OK if the unsubscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeMD

          public APIResult unsubscribeMD(int feedID,
                                         int marketID)

      Unsubscribe to market data updates for a specific feed.
      Parameters:
        `feedID` - -- feed id
        `marketID` - -- market id
      Returns:
        APIResult.OK if the unsubscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeOF

          public APIResult unsubscribeOF(int feedID,
                                         MFString clSubID)

      Unsubscribe to trading for a specific feed.
      Parameters:
        `feedID` - -- feed id
        `clSubID` - -- client subscription id
      Returns:
        APIResult.OK if the unsubscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeOF

          public APIResult unsubscribeOF(int feedID)

      Unsubscribe to trading for a specific feed.
      Parameters:
        `feedID` - -- feed id
      Returns:
        APIResult.OK if the unsubscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeAll

          public APIResult unsubscribeAll()

      Unsubscribe all market data and trading subscriptions. Call this if you want to stop receiving callbacks but don't want to disconnect.
      Returns:
        APIResult.OK if the unsubscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### handle

          public void handle(com.marketfactory.zerogc.api.SubscriptionEventMessage msg)

    - #### registerMarketComb

          public Pair<APIResult,java.lang.Integer> registerMarketComb(int feedID,
                                                                      int[] marketIds)

      Register for a given list of markets on a given feed.
      Parameters:
        `feedID` - -- feed id
        `marketIds` - -- array of market ids
      Returns:
        Pair The first member is APIResult.OK if the comb has been registered. The second member is a unique id to identify the market combination.

    - #### unregisterMarketComb

          public APIResult unregisterMarketComb(int batchDefID)

      Unregister for a given list of markets on a given feed using the id provided in onBatchEvent callback.
      Parameters:
        `batchDefID` - -- the batch definition id
      Returns:
        APIResult.OK if the unregistration request has been sent.

    - #### getCurrentBatchID

          public long getCurrentBatchID()

      To be called from the MFHandler.onMarketData callback.
      Returns:
        batch id for the current MarketView callback.

    - #### getCurrentBatchMarkets

          public FeedMarketID[] getCurrentBatchMarkets()

      To be called from the MFHandler.onMarketData callback.
      Returns:
        batch markets for the current MarketView callback.

    - #### handle

          public void handle(com.marketfactory.zerogc.api.MktDataMessage msg)

    - #### requestSnapshot

          public APIResult requestSnapshot(int feedID,
                                           int marketID)

      Request a market data snapshot for the feed and market ID. (Note that after connecting you should get a snapshot automatically, so this should be used rarely.)
      Parameters:
        `feedID` - -- feed id
        `marketID` - -- market id
      Returns:
        APIResult.OK if the snapshot request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### handle

          public void handle(com.marketfactory.zerogc.api.RequestSnapshotMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.BatchesCompletedMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.LastSequenceIDMessage msg)

    - #### submitOrder

          public void submitOrder(MFString clOrdID,
                                  int feedID,
                                  int marketID,
                                  Side side,
                                  MFFloat amount,
                                  MFFloat price,
                                  OrderType ordType,
                                  TimeInForce tif,
                                  OrderIdPair result)

      Submit an order. Pass in result field to get the result of the operation. This is used so each submitting thread can have its own result without generating garbage
      Parameters:
        `clOrdID` - -- client order id
        `feedID` - -- feed id
        `marketID` - -- market id
        `side` - -- buy or sell
        `amount` - -- order size
        `price` - -- px
        `ordType` - - order type
        `tif` - -- time-in-force
        `result` - -- The first member is APIResult.OK if the order has been sent. The second member is the orderID.

    - #### submitOrder

          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)

      Submit an order. Pass in result field to get the result of the operation. This is used so each submitting thread can have its own result without generating garbage
      Parameters:
        `clOrdID` - -- client order id
        `feedID` - -- feed id
        `marketID` - -- market id
        `side` - -- buy or sell
        `amount` - -- order size
        `price` - -- px
        `ordType` - -- order type
        `tif` - -- time-in-force
        `parameters` - -- additional parameters
        `result` - -- The first member is APIResult.OK if the order has been sent. The second member is the orderID.

    - #### submitOrder

          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)

      Submit an order. Pass in result field to get the result of the operation. This is used so each submitting thread can have its own result without generating garbage
      Parameters:
        `clOrdID` - -- client order id
        `feedID` - -- feed id
        `marketID` - -- market id
        `side` - -- buy or sell
        `amount` - -- order size
        `price` - -- px
        `stopPrice` - -- stop px
        `maxShowAmt` - -- max show amount
        `minFillAmt` - -- minimum fill amount
        `ordType` - -- the order type
        `tif` - -- time-in-force
        `result` - -- The first member is APIResult.OK if the order has been sent. The second member is the orderID.

    - #### submitOrder

          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)

      Submit an order. Pass in result field to get the result of the operation. This is used so each submitting thread can have its own result without generating garbage
      Parameters:
        `clOrdID` - -- client order id
        `feedID` - -- feed id
        `marketID` - -- market id
        `side` - -- buy or sell
        `amount` - -- size of the order
        `price` - -- px of the order
        `stopPrice` - -- stop px
        `maxShowAmt` - -- max show amount
        `ordType` - -- type of order
        `tif` - -- time-in-force
        `parameters` - -- additional parameters
        `result` - -- The first member is APIResult.OK if the order has been sent. The second member is the orderID.

    - #### modifyOrder

          public void modifyOrder(MFString clOrdID,
                                  MFString clNewID,
                                  MFFloat amount,
                                  MFFloat price,
                                  OrderIdPair result)

      Submit modification to an existing order.
      Parameters:
        `clOrdID` - -- the client order id to be replaced
        `clNewID` - -- the new client order id
        `amount` - -- the new amount
        `price` - -- the new price
        `result` - -- The first member is APIResult.OK if the order has been sent. The second member is the orderID.

    - #### cancelOrder

          public APIResult cancelOrder(MFString cxlID,
                                       MFString clOrdID)

      Cancel a previously placed order by client order id ('clOrdID').
      Parameters:
        `cxlID` - -- cancel id
        `clOrdID` - -- client order id to be cancelled.
      Returns:
        APIResult.INVALID_ORDERID if the order cannot be found locally, i.e., if the 'clOrdID' does not correspond to any previously placed order on this client interface.

    - #### cancelOrder

          public APIResult cancelOrder(MFString cxlID,
                                       long orderID)

      Cancel a previously placed order by internal 'orderID'.
      Parameters:
        `cxlID` - -- cancel id
        `orderID` - -- order id to be cancelled.
      Returns:
        APIResult.INVALID_ORDERID if the internal 'orderID' could not be provided.

    - #### cancelOrder

          public APIResult cancelOrder(MFString cxlID,
                                       long orderID,
                                       MFString clOrdID)

      Cancel a previously placed order by providing both internal 'orderID' and clOrdID. APIResult.INVALID_ORDERID if the internal 'orderID' could not be provided.

    - #### cancelAll

          public APIResult cancelAll(int feedID,
                                     MFString cxlID)

      Cancel all the orders on a feed.
      Parameters:
        `feedID` - -- the id of the feed.
        `cxlID` - -- the id of the cancel event.
      Returns:
        the result of this method call.

    - #### cancelAll

          public APIResult cancelAll(MFString cxlID)

      Cancel all the orders, on all feeds.
      Parameters:
        `cxlID` - -- the id of the cancel event.
      Returns:
        the result of this method call.

    - #### allowClientsToConnect

          public APIResult allowClientsToConnect()

      Admin interface: Call this method to allow non-admin API clients to connect.
      Returns:
        the result of allowing clients to connect

    - #### lockUser

          public APIResult lockUser(MFString clRequestID,
                                    MFString username,
                                    boolean locked)

      Admin interface: Lock / unlock user accounts.
      Parameters:
        `clRequestID` - -- the client request id
        `username` - -- user
        `locked` - -- lock the user
      Returns:
        the result of the method call.

    - #### handle

          public void handle(com.marketfactory.zerogc.api.RiskResponseMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.LockResponseMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.OrderReceivedMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.OrderSubmittedMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.OrderRejectedMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.OrderCanceledMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.OrderCancelRejectedMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.DropCopyMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.TradeCaptureMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.OrderDoneMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.QuoteRequestMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.RejectQuoteRequestMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.CancelQuoteMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.MassQuoteMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.MassQuoteAckMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.NewOrderMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.RejectOrderMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.AcceptOrderMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.OrderTimeoutMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.TradeCaptureAckMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.EventReportMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ReplayDoneMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.DateRolloverMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.JsonFromServer msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.RuThereMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.VersionMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.InsertLogMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ClientConnectMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ReplayMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.BatchRegisterMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.BatchUnregisterMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.SubscribeMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.UnsubscribeMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.UnsubscribeAllMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.SubmitOrderMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.CancelOrderMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.CancelAllOrderMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.ModifyOrderMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.LockUserMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.TradeLimitDataMessage msg)

    - #### handle

          public void handle(com.marketfactory.zerogc.api.JsonFromClient msg)

    - #### open

          public static MFClient open(MFString user,
                                      MFString pass,
                                      MFString host,
                                      int port)
                               throws java.io.IOException

      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. Otherwise the new client object is returned;
      Parameters:
        `user` - -- username
        `pass` - -- password
        `host` - -- mf hostname
        `port` - -- mf port
      Returns:
        open and connected MFClient
      Throws:
        `java.io.IOException` - if connection fails

    - #### open

          public static MFClient open(MFString user,
                                      MFString pass,
                                      MFString host,
                                      int port,
                                      boolean useHeartbeat)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### open

          public static MFClient open(MFString user,
                                      MFString pass,
                                      MFString hostname1,
                                      int port1,
                                      MFString hostname2,
                                      int port2)
                               throws java.io.IOException

      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. Otherwise the new client object is returned;
      Parameters:
        `user` - -- username
        `pass` - -- password
        `hostname1` - -- primary host
        `port1` - -- primary port
        `hostname2` - -- secondary host
        `port2` - -- secondary port
      Returns:
        opened and connected MFClient
      Throws:
        `java.io.IOException` - if connection fails

    - #### open

          public static MFClient open(MFString user,
                                      MFString pass,
                                      MFString hostname1,
                                      int port1,
                                      MFString hostname2,
                                      int port2,
                                      boolean useHeartbeat)
                               throws java.io.IOException

      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. Otherwise the new client object is returned;
      Parameters:
        `user` - -- username
        `pass` - -- password
        `hostname1` - -- primary host
        `port1` - -- primary port
        `hostname2` - -- secondary host
        `port2` - -- secondary port
        `useHeartbeat` - -- enable or disable heartbeating
      Returns:
        the new client object is returned;
      Throws:
        `java.io.IOException` - -- if connection fails