MFAdmin (3.14.0 600 API)
Date: 2025-11-24

com.marketfactory.api

## Class MFAdmin

- java.lang.Object
- - com.marketfactory.api.MFClientBase
  - - com.marketfactory.api.MFAdmin

-     public class MFAdmin
      extends MFClientBase

  An admin 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 MFAdminHandler.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.marketfactory.api.MFClientBase

      `MFClientBase.OrderArgs, MFClientBase.PingTime, MFClientBase.RiskLimit, MFClientBase.RiskMarketPosition, MFClientBase.RiskUsage, MFClientBase.TimeStats`

  - ### Field Summary

    - ### Fields inherited from class com.marketfactory.api.MFClientBase

      `_riskLimits, _riskTimestamp, _riskUsages, _tradeLimitDataQueue, _userGroupChains, FEED_ALL, FEED_NULL, MARKET_ALL, SETTL_DATE_CASH, SETTL_DATE_SUM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MFAdmin(java.lang.String _username, java.lang.String _password, java.lang.String _hostname1, int _port1)` Create a new admin object.
    `MFAdmin(java.lang.String _username, java.lang.String _password, java.lang.String _hostname1, int _port1, java.lang.String _hostname2, int _port2)` Create a new admin object (with failover).

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `APIResult` | `allowClientsToConnect()` Admin interface: Call this method to allow monitored API clients to connect.
    `protected APIResult` | `connectOne(java.lang.String host, int port)`
    `protected MFAdminHandler` | `getHandler()`
    `MFClientBase.RiskLimit[]` | `getRiskLimits()` Admin interface: limits registered by server process.
    `MFClientBase.RiskMarketPosition[]` | `getRiskMarketPositions()` Admin interface:
    `long` | `getRiskTimestamp()`
    `MFClientBase.RiskUsage[]` | `getRiskUsage()`
    `java.util.Map<java.lang.String,java.lang.String[]>` | `getUserGroupChains()`
    `APIResult` | `lockUser(java.lang.String clRequestID, java.lang.String username, boolean locked)` Admin interface: Lock / unlock user accounts.
    `protected void` | `onBatchComplete(int batchDefID, MFClientBase admin)`
    `protected void` | `onConnect(MFClientBase admin)`
    `protected void` | `onDateRollover(DateRollover msg, MFClientBase admin)`
    `protected void` | `onDisconnect(MFClientBase admin)`
    `protected void` | `onDropCopy(DropCopy msg, MFClientBase admin)`
    `protected void` | `onEventReport(EventReport msg, MFClientBase admin)`
    `protected void` | `onHeartbeat(Heartbeat msg, MFClientBase admin)`
    `protected void` | `onLockResponse(LockResponse msg, MFClientBase admin)`
    `protected void` | `onMarketData(MarketView msg, MFClientBase admin)`
    `protected void` | `onReplayDone(ReplayDone msg, MFClientBase admin)`
    `protected void` | `onRiskResponse(RiskResponse msg, MFClientBase admin)`
    `protected void` | `onStart(MFClientBase admin)`
    `protected void` | `onStop(MFClientBase admin)`
    `protected void` | `onSubscriptionEvent(SubscriptionEvent msg, MFClientBase admin)`
    `static MFAdmin` | `open(java.lang.String user, java.lang.String pass, java.lang.String 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 MFAdmin` | `open(java.lang.String user, java.lang.String pass, java.lang.String _hostname1, int _port1, java.lang.String _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.
    `APIResult` | `run(MFAdminHandler handler)` Run a loop that will continuously dispatch incoming messages to a handler implementation.
    `APIResult` | `setRisk(java.lang.String clRequestID, boolean doReplace, MFClientBase.RiskUsage... usages)`
    `APIResult` | `setRisk(java.lang.String clRequestID, MFClientBase.RiskLimit... limits)` Admin interface: publish incremental set of limits.
    `APIResult` | `setRisk(java.lang.String clRequestID, MFClientBase.RiskLimit[] limits, MFClientBase.RiskUsage[] usages, boolean isSnapshot)` Admin interface: publish incremental/snapshot set of limits and usage.
    `APIResult` | `setRisk(java.lang.String clRequestID, MFClientBase.RiskLimit[] limits, MFClientBase.RiskUsage[] usages, boolean isSnapshot, boolean doReplace)`
    `APIResult` | `setRisk(java.lang.String clRequestID, MFClientBase.RiskUsage... usages)` Admin interface: publish incremental set of risk usage.
    `APIResult` | `subscribeMD(int feedID, int marketID)` Subscribe to market data updates for a specific feed.
    `APIResult` | `subscribeMD(int feedID, int marketID, java.lang.String 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, java.lang.String clSubID)` Subscribe to trading for a specific feed.
    `APIResult` | `unsubscribeAll()` Unsubscribe all market data and trading subscriptions.
    `APIResult` | `unsubscribeOF(int feedID)` Unsubscribe to trading for a specific feed.
    `APIResult` | `unsubscribeOF(int feedID, java.lang.String clSubID)` Unsubscribe to trading for a specific feed.

    - ### Methods inherited from class com.marketfactory.api.MFClientBase

      `cancelAll, cancelAll, cancelOrder, cancelOrder, cancelOrder, close, connect, enableDebugMetrics, getFeedByID, getFeedByName, getFeeds, getHostname, getLastPingTimes, getMarketByID, getMarketByName, getPort, getSequenceID, getSignature, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, handle, init, isConnected, isRunning, isStopRequested, join, log, log, modifyOrder, modifyOrder, modifyOrder, onJsonFromServer, onMassQuoteAck, onNewOrder, onOrderCanceled, onOrderCancelRejected, onOrderDone, onOrderReceived, onOrderRejected, onOrderSubmitted, onOrderTimeout, onQuoteRequest, onTradeCapture, onTradeCaptureAck, processEvents, registerMarketComb, replay, requestSnapshot, resetAdminMembers, run, send, setDebug, setStickySubscriptions, setStickySubscriptions, setUseHeartbeat, stop, submitOrder, submitOrder, submitOrder, submitOrder, submitOrder, subscribeAllMD, subscribePricing, subscribeTrading, test, unregisterMarketComb, unsubscribeMD, unsubscribeMD, unsubscribePricing, unsubscribeTrading`

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

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

- - ### Constructor Detail

    - #### MFAdmin

          public MFAdmin(java.lang.String _username,
                         java.lang.String _password,
                         java.lang.String _hostname1,
                         int _port1)

      Create a new admin object. A new client still needs to be connected (see connect()).
      Parameters:
        `_username` - -- username
        `_password` - -- password
        `_hostname1` - -- primary host
        `_port1` - -- primary port

    - #### MFAdmin

          public MFAdmin(java.lang.String _username,
                         java.lang.String _password,
                         java.lang.String _hostname1,
                         int _port1,
                         java.lang.String _hostname2,
                         int _port2)

      Create a new admin object (with failover). A new client still needs to be connected (see connect()).
      Parameters:
        `_username` - -- username
        `_password` - -- password
        `_hostname1` - -- primary host
        `_port1` - -- primary port
        `_hostname2` - -- secondary host
        `_port2` - -- secondary port

  - ### Method Detail

    - #### connectOne

          protected APIResult connectOne(java.lang.String host,
                                         int port)

      Overrides:
        `connectOne` in class `MFClientBase`

    - #### run

          public APIResult run(MFAdminHandler handler)

      Run a loop that will continuously dispatch incoming messages to a handler implementation. 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().
      Parameters:
        `handler` - -- the instance to be run
      Returns:
        the result of the run.

    - #### open

          public static MFAdmin open(java.lang.String user,
                                     java.lang.String pass,
                                     java.lang.String 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` - - primary hostname
        `port` - - primary port
      Returns:
        an opened MFAdmin instance
      Throws:
        `java.io.IOException` - -- if connection failes

    - #### open

          public static MFAdmin open(java.lang.String user,
                                     java.lang.String pass,
                                     java.lang.String _hostname1,
                                     int _port1,
                                     java.lang.String _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 hostname
        `_port1` - - primary port
        `_hostname2` - - secondary hostname
        `_port2` - - secondary port
      Returns:
        an opened MFAdmin instance
      Throws:
        `java.io.IOException` - -- if connection failes

    - #### subscribeMD

          public APIResult subscribeMD(int feedID,
                                       int marketID,
                                       java.lang.String clSubID)

      Description copied from class: `MFClientBase`
      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.
      Overrides:
        `subscribeMD` in class `MFClientBase`
      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)

      Description copied from class: `MFClientBase`
      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.
      Overrides:
        `subscribeMD` in class `MFClientBase`
      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,
                                       java.lang.String clSubID)

      Description copied from class: `MFClientBase`
      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.
      Overrides:
        `subscribeOF` in class `MFClientBase`
      Parameters:
        `feedID` - -- the feed id
        `clSubID` - -- the client subscription id
      Returns:
        APIResult.OK if the subscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### subscribeOF

          public APIResult subscribeOF(int feedID)

      Description copied from class: `MFClientBase`
      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.
      Overrides:
        `subscribeOF` in class `MFClientBase`
      Parameters:
        `feedID` - -- feed id
      Returns:
        APIResult.OK if the subscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeOF

          public APIResult unsubscribeOF(int feedID,
                                         java.lang.String clSubID)

      Description copied from class: `MFClientBase`
      Unsubscribe to trading for a specific feed.
      Overrides:
        `unsubscribeOF` in class `MFClientBase`
      Parameters:
        `feedID` - -- the feed id
        `clSubID` - -- the client subscription id
      Returns:
        APIResult.OK if the unsubscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeOF

          public APIResult unsubscribeOF(int feedID)

      Description copied from class: `MFClientBase`
      Unsubscribe to trading for a specific feed.
      Overrides:
        `unsubscribeOF` in class `MFClientBase`
      Parameters:
        `feedID` - -- the feed id
      Returns:
        APIResult.OK if the unsubscription request has been sent, APIResult.SOCKERR_WRITING on error.

    - #### unsubscribeAll

          public APIResult unsubscribeAll()

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

    - #### allowClientsToConnect

          public APIResult allowClientsToConnect()

      Description copied from class: `MFClientBase`
      Admin interface: Call this method to allow monitored API clients to connect. An MFAdmin must remain connected and have called this method for monitored clients to function.
      Overrides:
        `allowClientsToConnect` in class `MFClientBase`
      Returns:
        the result of sending

    - #### lockUser

          public APIResult lockUser(java.lang.String clRequestID,
                                    java.lang.String username,
                                    boolean locked)

      Description copied from class: `MFClientBase`
      Admin interface: Lock / unlock user accounts. This is a more granular, subordinate, version of allowClientsToConnect().
      Overrides:
        `lockUser` in class `MFClientBase`
      Parameters:
        `clRequestID` - -- the client request id
        `username` - -- the user to be locked
        `locked` - -- to lock?
      Returns:
        the api result

    - #### setRisk

          public APIResult setRisk(java.lang.String clRequestID,
                                   MFClientBase.RiskLimit[] limits,
                                   MFClientBase.RiskUsage[] usages,
                                   boolean isSnapshot)

      Description copied from class: `MFClientBase`
      Admin interface: publish incremental/snapshot set of limits and usage. A full snapshot must be sent prior to allowClientsToConnect() so NOP calculations are not stale.
      Overrides:
        `setRisk` in class `MFClientBase`
      Parameters:
        `clRequestID` - -- client request id
        `limits` - -- variable collection of limits
        `usages` - -- variable collection of usages
        `isSnapshot` - -- snapshot flag
      Returns:
        the result of the setRisk call.

    - #### setRisk

          public APIResult setRisk(java.lang.String clRequestID,
                                   MFClientBase.RiskLimit[] limits,
                                   MFClientBase.RiskUsage[] usages,
                                   boolean isSnapshot,
                                   boolean doReplace)

      Overrides:
        `setRisk` in class `MFClientBase`

    - #### setRisk

          public APIResult setRisk(java.lang.String clRequestID,
                                   MFClientBase.RiskLimit... limits)

      Description copied from class: `MFClientBase`
      Admin interface: publish incremental set of limits. Group limits may be selectively updated, deferring to previous values/defaults if desired. If a group is subject to multiple limits, the most restrictive limit will always be preferred.
      Overrides:
        `setRisk` in class `MFClientBase`
      Parameters:
        `clRequestID` - -- client request id
        `limits` - -- variable collection of limits
      Returns:
        the result of the setRisk call.

    - #### setRisk

          public APIResult setRisk(java.lang.String clRequestID,
                                   MFClientBase.RiskUsage... usages)

      Description copied from class: `MFClientBase`
      Admin interface: publish incremental set of risk usage. User state may be selectively updated based on current activity. Users only have a single state, to which the server will incorporate unacknowledged/pending orders.
      Overrides:
        `setRisk` in class `MFClientBase`
      Parameters:
        `clRequestID` - -- client request id
        `usages` - -- variable collection of usages
      Returns:
        the result of the setRisk call.

    - #### setRisk

          public APIResult setRisk(java.lang.String clRequestID,
                                   boolean doReplace,
                                   MFClientBase.RiskUsage... usages)

      Overrides:
        `setRisk` in class `MFClientBase`

    - #### getRiskLimits

          public MFClientBase.RiskLimit[] getRiskLimits()

      Description copied from class: `MFClientBase`
      Admin interface: limits registered by server process.
      Overrides:
        `getRiskLimits` in class `MFClientBase`
      Returns:
        May include server defaults and other limits not explicitly initialized from an admin instance.

    - #### getRiskUsage

          public MFClientBase.RiskUsage[] getRiskUsage()

      Overrides:
        `getRiskUsage` in class `MFClientBase`
      Returns:
        Admin interface: full risk usage view held by server process. Will reflect the last set of usages received by the server, incorporating unacknowledged/pending orders. Will only include groups that have been modified by admin or trade activity.

    - #### getRiskMarketPositions

          public MFClientBase.RiskMarketPosition[] getRiskMarketPositions()

      Description copied from class: `MFClientBase`
      Admin interface:
      Overrides:
        `getRiskMarketPositions` in class `MFClientBase`
      Returns:
        array of derived RiskMarketPositions rather than RiskUsage. The results are abridged to show current position without being broken down by date.

    - #### getRiskTimestamp

          public long getRiskTimestamp()

      Overrides:
        `getRiskTimestamp` in class `MFClientBase`
      Returns:
        Admin interface: timestamp of last constraint update from server process.

    - #### getUserGroupChains

          public java.util.Map<java.lang.String,java.lang.String[]> getUserGroupChains()

      Overrides:
        `getUserGroupChains` in class `MFClientBase`
      Returns:
        Admin interface: linear list of groups to which each user belongs. (each entry is a direct child of the next group in the list.) Ex: ApiUser1: [ApiUser1, Client1, Root] GuiUser1: [GuiUser1, Client1, Root]

    - #### getHandler

          protected MFAdminHandler getHandler()

    - #### onStart

          protected void onStart(MFClientBase admin)

      Overrides:
        `onStart` in class `MFClientBase`

    - #### onStop

          protected void onStop(MFClientBase admin)

      Overrides:
        `onStop` in class `MFClientBase`

    - #### onDisconnect

          protected void onDisconnect(MFClientBase admin)

      Overrides:
        `onDisconnect` in class `MFClientBase`

    - #### onConnect

          protected void onConnect(MFClientBase admin)

      Overrides:
        `onConnect` in class `MFClientBase`

    - #### onHeartbeat

          protected void onHeartbeat(Heartbeat msg,
                                     MFClientBase admin)

      Overrides:
        `onHeartbeat` in class `MFClientBase`

    - #### onSubscriptionEvent

          protected void onSubscriptionEvent(SubscriptionEvent msg,
                                             MFClientBase admin)

      Overrides:
        `onSubscriptionEvent` in class `MFClientBase`

    - #### onMarketData

          protected void onMarketData(MarketView msg,
                                      MFClientBase admin)

      Overrides:
        `onMarketData` in class `MFClientBase`

    - #### onEventReport

          protected void onEventReport(EventReport msg,
                                       MFClientBase admin)

      Overrides:
        `onEventReport` in class `MFClientBase`

    - #### onDateRollover

          protected void onDateRollover(DateRollover msg,
                                        MFClientBase admin)

      Overrides:
        `onDateRollover` in class `MFClientBase`

    - #### onBatchComplete

          protected void onBatchComplete(int batchDefID,
                                         MFClientBase admin)

      Overrides:
        `onBatchComplete` in class `MFClientBase`

    - #### onDropCopy

          protected void onDropCopy(DropCopy msg,
                                    MFClientBase admin)

      Overrides:
        `onDropCopy` in class `MFClientBase`

    - #### onReplayDone

          protected void onReplayDone(ReplayDone msg,
                                      MFClientBase admin)

      Overrides:
        `onReplayDone` in class `MFClientBase`

    - #### onLockResponse

          protected void onLockResponse(LockResponse msg,
                                        MFClientBase admin)

      Overrides:
        `onLockResponse` in class `MFClientBase`

    - #### onRiskResponse

          protected void onRiskResponse(RiskResponse msg,
                                        MFClientBase admin)

      Overrides:
        `onRiskResponse` in class `MFClientBase`