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

com.marketfactory.api

## Class MFMarketMaker

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

-     public class MFMarketMaker
      extends MFClientBase

  A maker 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/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
    `MFMarketMaker(java.lang.String _username, java.lang.String _password, java.lang.String _hostname1, int _port1)` Create a new admin object.
    `MFMarketMaker(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` | `acceptOrder(NewOrder order)` Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one.
    `APIResult` | `acceptOrder(NewOrder order, MFFloat amount)` This method is for sending partial fills.
    `APIResult` | `cancelQuote(QuoteRequest request, java.lang.String quoteID)`
    `APIResult` | `cancelQuoteForSymbol(QuoteRequest request, java.lang.String symbol)`
    `APIResult` | `cancelQuotes(QuoteRequest request)`
    `protected MFMarketMakerHandler` | `getHandler()`
    `protected void` | `onConnect(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` | `onMassQuoteAck(MassQuoteAck msg, MFClientBase admin)`
    `protected void` | `onNewOrder(NewOrder msg, MFClientBase admin)`
    `protected void` | `onOrderTimeout(OrderTimeout msg, MFClientBase admin)`
    `protected void` | `onQuoteRequest(QuoteRequest msg, MFClientBase admin)`
    `protected void` | `onReplayDone(ReplayDone msg, MFClientBase admin)`
    `protected void` | `onStart(MFClientBase admin)`
    `protected void` | `onStop(MFClientBase admin)`
    `protected void` | `onSubscriptionEvent(SubscriptionEvent msg, MFClientBase admin)`
    `protected void` | `onTradeCaptureAck(TradeCaptureAck msg, MFClientBase admin)`
    `static MFMarketMaker` | `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 MFMarketMaker` | `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` | `rejectOrder(NewOrder order, java.lang.String text)` Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one.
    `APIResult` | `rejectQuoteRequest(QuoteRequest request, QuoteRequestRejectReason reason, java.lang.String text)`
    `APIResult` | `run(MFMarketMakerHandler handler)` Run a loop that will continuously dispatch incoming messages to a _handler implementation.
    `APIResult` | `submitQuotes(QuoteRequest request, MFQuote[] quotes)` Note: If QuoteRequest does not arrive with a valid amount, you must fill one in.
    `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` | `subscribePricing(int feedID, java.lang.String clSubID)`
    `APIResult` | `subscribeTrading(int feedID, java.lang.String clSubID)`
    `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.
    `APIResult` | `unsubscribePricing(int feedID, java.lang.String clSubID)`
    `APIResult` | `unsubscribeTrading(int feedID, java.lang.String clSubID)`

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

      `allowClientsToConnect, cancelAll, cancelAll, cancelOrder, cancelOrder, cancelOrder, close, connect, connectOne, enableDebugMetrics, getFeedByID, getFeedByName, getFeeds, getHostname, getLastPingTimes, getMarketByID, getMarketByName, getPort, getRiskLimits, getRiskMarketPositions, getRiskTimestamp, getRiskUsage, getSequenceID, getSignature, getUserGroupChains, 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, lockUser, log, log, modifyOrder, modifyOrder, onBatchComplete, onDateRollover, onJsonFromServer, onLockResponse, onMarketData, onOrderCanceled, onOrderCancelRejected, onOrderDone, onOrderReceived, onOrderRejected, onOrderSubmitted, onRiskResponse, onTradeCapture, processEvents, registerMarketComb, replay, requestSnapshot, resetAdminMembers, run, send, setDebug, setRisk, setRisk, setRisk, setRisk, setRisk, setStickySubscriptions, setStickySubscriptions, setUseHeartbeat, stop, submitOrder, submitOrder, submitOrder, submitOrder, submitOrder, subscribeAllMD, subscribeMD, subscribeMD, test, unregisterMarketComb, unsubscribeMD, unsubscribeMD`

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

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

- - ### Constructor Detail

    - #### MFMarketMaker

          public MFMarketMaker(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

    - #### MFMarketMaker

          public MFMarketMaker(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

    - #### run

          public APIResult run(MFMarketMakerHandler 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(). Note: this should not be invoked by _handler.
      Parameters:
        `handler` - to be run
      Returns:
        the run result

    - #### open

          public static MFMarketMaker 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.
      Parameters:
        `user` - -- username
        `pass` - -- password
        `host` - -- primary host
        `port` - -- primary port
      Returns:
        the new client object
      Throws:
        `java.io.IOException` - if connection fails

    - #### open

          public static MFMarketMaker 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.
      Parameters:
        `user` - -- username
        `pass` - -- password
        `_hostname1` - -- primary host
        `_port1` - -- primary port
        `_hostname2` - -- secondary host
        `_port2` - -- secondary port
      Returns:
        the new client object
      Throws:
        `java.io.IOException` - if connection fails

    - #### 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.

    - #### subscribePricing

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

      Overrides:
        `subscribePricing` in class `MFClientBase`

    - #### subscribeTrading

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

      Overrides:
        `subscribeTrading` in class `MFClientBase`

    - #### unsubscribePricing

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

      Overrides:
        `unsubscribePricing` in class `MFClientBase`

    - #### unsubscribeTrading

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

      Overrides:
        `unsubscribeTrading` in class `MFClientBase`

    - #### rejectQuoteRequest

          public APIResult rejectQuoteRequest(QuoteRequest request,
                                              QuoteRequestRejectReason reason,
                                              java.lang.String text)

    - #### cancelQuotes

          public APIResult cancelQuotes(QuoteRequest request)

    - #### cancelQuote

          public APIResult cancelQuote(QuoteRequest request,
                                       java.lang.String quoteID)

    - #### cancelQuoteForSymbol

          public APIResult cancelQuoteForSymbol(QuoteRequest request,
                                                java.lang.String symbol)

    - #### submitQuotes

          public APIResult submitQuotes(QuoteRequest request,
                                        MFQuote[] quotes)

      Note: If QuoteRequest does not arrive with a valid amount, you must fill one in.
      Parameters:
        `request` - -- quote request
        `quotes` - variable
      Returns:
        the result of sending the requests

    - #### rejectOrder

          public APIResult rejectOrder(NewOrder order,
                                       java.lang.String text)

      Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one.
      Parameters:
        `order` - to reject
        `text` - why
      Returns:
        result of sending the reject

    - #### acceptOrder

          public APIResult acceptOrder(NewOrder order)

      Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one.
      Parameters:
        `order` - to accept
      Returns:
        the result of sending the accept.

    - #### acceptOrder

          public APIResult acceptOrder(NewOrder order,
                                       MFFloat amount)

      This method is for sending partial fills. Put the partial amount in the amount field. Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one.
      Parameters:
        `order` - to accept
        `amount` - to fill
      Returns:
        the result of sending the accept.

    - #### getHandler

          protected MFMarketMakerHandler 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`

    - #### onEventReport

          protected void onEventReport(EventReport msg,
                                       MFClientBase admin)

      Overrides:
        `onEventReport` in class `MFClientBase`

    - #### onQuoteRequest

          protected void onQuoteRequest(QuoteRequest msg,
                                        MFClientBase admin)

      Overrides:
        `onQuoteRequest` in class `MFClientBase`

    - #### onMassQuoteAck

          protected void onMassQuoteAck(MassQuoteAck msg,
                                        MFClientBase admin)

      Overrides:
        `onMassQuoteAck` in class `MFClientBase`

    - #### onNewOrder

          protected void onNewOrder(NewOrder msg,
                                    MFClientBase admin)

      Overrides:
        `onNewOrder` in class `MFClientBase`

    - #### onOrderTimeout

          protected void onOrderTimeout(OrderTimeout msg,
                                        MFClientBase admin)

      Overrides:
        `onOrderTimeout` in class `MFClientBase`

    - #### onTradeCaptureAck

          protected void onTradeCaptureAck(TradeCaptureAck msg,
                                           MFClientBase admin)

      Overrides:
        `onTradeCaptureAck` 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`