![]() |
MarketFactory 3.14.0 C# API
|
A maker API client, which processes a single network connection. More...
Public Member Functions | |
| MFMarketMaker (string _username, string _password, string _hostname1, int _port1) | |
| MFMarketMaker (string _username, string _password, string _hostname1, int _port1, string _hostname2, int _port2) | |
| APIResult | acceptOrder (NewOrder order) |
| Accept the order. Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one. More... | |
| APIResult | acceptOrder (NewOrder order, MFFloat amount) |
| Accepts the order. 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. More... | |
| APIResult | cancelQuote (QuoteRequest request, string quoteID) |
| Cancels quotes associated with a request and quoteID. More... | |
| APIResult | cancelQuoteForSymbol (QuoteRequest request, string symbol) |
| Cancels the quotes for a symbol. More... | |
| APIResult | cancelQuotes (QuoteRequest request) |
| Cancels quotes for a request. More... | |
| APIResult | close () |
| Close the connection. More... | |
| APIResult | connect () |
| Connect to the first available server with user credentials. More... | |
| APIFeed | getFeedByID (int id) |
| After a successful connection is established, you may access the server's list of _feeds, markets. More... | |
| APIFeed | getFeedByName (string name) |
| After a successful connection is established, you may access the server's list of _feeds, markets. More... | |
| APIFeed [] | getFeeds () |
| After a successful connection is established, you may access the server's list of _feeds, markets. More... | |
| string | getHostname () |
| Returns the primary/secondary server hostname (whichever one is being used). More... | |
| Queue< PingTime > | getLastPingTimes () |
| APIMarket | getMarketByID (APIFeed feed, int marketID) |
| After a successful connection is established, you may access the server's list of _feeds, markets. More... | |
| APIMarket | getMarketByName (APIFeed feed, string name) |
| After a successful connection is established, you may access the server's list of _feeds, markets. More... | |
| int | getPort () |
| Returns the primary/secondary server port (whichever one is being used). More... | |
| int | getSequenceID (int feedID) |
| Get the last received sequenceID after successful subscription. More... | |
| string | getSignature () |
| Get protocol api signature. More... | |
| bool | isConnected () |
| Return true if the _channel is _connected. More... | |
| bool | isRunning () |
| Returns true if the client is currently dispatching events (i.e., you called run()). More... | |
| bool | isStopRequested () |
| APIResult | join () |
| Block until the client has exited the dispatch loop. More... | |
| void | log (string message) |
| Logs a debug message into the Whisperer server _log file. More... | |
| void | log (string message, LogLevel level) |
| APIResult | processEvents (MFMarketMakerHandler 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. More... | |
| APIResult | rejectOrder (NewOrder order, string text) |
| Rejects the order. Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one. More... | |
| APIResult | rejectQuoteRequest (QuoteRequest request, QuoteRequestRejectReason reason, string text) |
| Rejects the quote request. More... | |
| APIResult | replay (int feedID, int fromSequenceID, int toSequenceID) |
| Request replay of order flow events in the range [fromSequenceID, toSequenceID=-1]. More... | |
| 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. More... | |
| void | setDebug (bool debug) |
| void | setStickySubscriptions (bool sticky) |
| Enable/Disable sticky subscriptions. More... | |
| void | setStickySubscriptions (bool sticky, bool clearSubscriptionsOnStop) |
| void | setUseHeartbeat (bool use) |
| APIResult | stop () |
| Request to stop the event dispatch loop, does not disconnect the client from the server. More... | |
| APIResult | submitQuotes (QuoteRequest request, MFQuote[] quotes) |
| Note: If QuoteRequest does not arrive with a valid amount, you must fill one in. More... | |
| APIResult | subscribePricing (int feedID, string clSubID) |
| APIResult | subscribeTrading (int feedID, string clSubID) |
| void | test (APITest test) |
| Internal testing function. More... | |
| APIResult | unsubscribeAll () |
| Unsubscribe all market data and trading subscriptions. More... | |
| APIResult | unsubscribePricing (int feedID, string clSubID) |
| APIResult | unsubscribeTrading (int feedID, string clSubID) |
Static Public Member Functions | |
| static MFMarketMaker | open (string user, string pass, 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. Otherwise the new client object is returned; More... | |
| static MFMarketMaker | open (string user, string pass, string _hostname1, int _port1, 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. Otherwise the new client object is returned; /summary> More... | |
Protected Member Functions | |
| APIResult | cancelAll (int feedID, string cxlID) |
| Cancel all the orders on a feed. More... | |
| APIResult | cancelAll (string cxlID) |
| Cancel all the orders, on all feeds. More... | |
| APIResult | cancelOrder (string cxlID, string clOrdID) |
| Cancel a previously placed order by client order id ('clOrdID'). Return false if the order cannot be found locally, i.e., if the 'clOrdID' does not correspond to any previously placed order on this client interface. More... | |
| APIResult | cancelOrder (string cxlID, long orderID) |
| Cancel a previously placed order by internal 'orderID'. Return false if the internal 'orderID' could not be provided. More... | |
| APIResult | cancelOrder (string cxlID, long orderID, string clOrdID) |
| Cancel a previously placed order by providing both internal 'orderID' and clOrdID. APIResult.INVALID_ORDERID if the internal 'orderID' could not be provided. More... | |
| virtual APIResult | connectOne (String host, int port) |
| KeyValuePair< APIResult, long > | modifyOrder (string clOrdID, string clNewID, MFFloat amount, MFFloat price, OrderParameters parameters=null) |
| Submit modification to an existing order. More... | |
| virtual void | onBatchComplete (int batchDefID) |
| override void | onConnect () |
| virtual void | onDateRollover (DateRollover dateRollover) |
| override void | onDisconnect () |
| override void | onDropCopy (DropCopy msg) |
| override void | onEventReport (EventReport msg) |
| override void | onHeartbeat (Heartbeat msg) |
| virtual void | onJsonFromServer (JsonFromServer msg) |
| virtual void | onLockResponse (LockResponse lockResponse) |
| virtual void | onMarketData (MarketView marketData) |
| override void | onMassQuoteAck (MassQuoteAck msg) |
| override void | onNewOrder (NewOrder msg) |
| virtual void | onOrderCanceled (OrderCanceled orderCanceled) |
| virtual void | onOrderCancelRejected (OrderCancelRejected orderCancelRejected) |
| virtual void | onOrderDone (OrderDone orderDone) |
| virtual void | onOrderReceived (OrderReceived orderReceived) |
| virtual void | onOrderRejected (OrderRejected orderRejected) |
| virtual void | onOrderSubmitted (OrderSubmitted orderSubmitted) |
| override void | onOrderTimeout (OrderTimeout msg) |
| override void | onQuoteRequest (QuoteRequest msg) |
| override void | onReplayDone (ReplayDone msg) |
| virtual void | onRiskResponse (RiskResponse riskResponse) |
| override void | onStart () |
| override void | onStop () |
| override void | onSubscriptionEvent (SubscriptionEvent msg) |
| virtual void | onTradeCapture (TradeCapture tradeCapture) |
| override void | onTradeCaptureAck (TradeCaptureAck msg) |
| KeyValuePair< APIResult, int > | registerMarketComb (int feedID, int[] marketIds) |
| APIResult | requestSnapshot (int feedID, int marketID) |
| APIResult | run (MFBaseHandler _handler, bool loop) |
| APIResult | send (IMessage msg) |
| KeyValuePair< APIResult, long > | submitOrder (string clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, OrderType ordType, TimeInForce tif) |
| Submit an order. More... | |
| KeyValuePair< APIResult, long > | submitOrder (string clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, MFFloat stopPrice, MFFloat maxShowAmt, OrderType ordType, TimeInForce tif) |
| Submit an order without minAmount (kept for backward compatibility). More... | |
| KeyValuePair< APIResult, long > | submitOrder (string clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, MFFloat stopPrice, MFFloat maxShowAmt, MFFloat minFillAmt, OrderType ordType, TimeInForce tif, List< KeyValuePair< string, string >> parameters) |
| KeyValuePair< APIResult, long > | submitOrder (string clOrdID, int feedID, int marketID, Side side, MFFloat amount, MFFloat price, MFFloat stopPrice, MFFloat maxShowAmt, MFFloat minFillAmt, OrderType ordType, TimeInForce tif, OrderParameters parameters=null) |
| Submits the order. Use an OrderParametersBuilder to construct a reusable OrderParameters object. Offers better performance if the you want to reuse the same order parameters for multiple submitOrder calls. More... | |
| APIResult | subscribe (APIType apiType, int feedID, int marketID, String clSubID) |
| APIResult | subscribeAllMD () |
| Subscribe to all the market data feeds. More... | |
| APIResult | subscribeMD (int feedID, int marketID, String 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. More... | |
| APIResult | subscribeMD (int feedID, int marketID) |
| APIResult | subscribeOF (int feedID, String clSubID) |
| Subscribe to trading for a specific feed. More... | |
| APIResult | subscribeOF (int feedID) |
| Subscribe to trading for a specific feed. More... | |
| APIResult | unregisterMarketComb (int batchDefID) |
| APIResult | unsubscribe (APIType apiType, int feedID, int marketID, String clSubID) |
| APIResult | unsubscribeMD (int feedID, int marketID, String clSubID) |
| Unsubscribe to market data updates for a specific feed. More... | |
| APIResult | unsubscribeMD (int feedID, int marketID) |
| Unsubscribe to market data updates for a specific feed. More... | |
| APIResult | unsubscribeOF (int feedID, String clSubID) |
| Unsubscribe to trading for a specific feed. More... | |
| APIResult | unsubscribeOF (int feedID) |
| Unsubscribe to trading for a specific feed. More... | |
Protected Attributes | |
| string | _hostname1 |
| string | _hostname2 |
| Logger | _log = Logger.getLogger("com.marketfactory.api") |
| string | _password |
| int | _port1 |
| int | _port2 |
| string | _username |
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.
| MFMarketMaker | ( | string | _username, |
| string | _password, | ||
| string | _hostname1, | ||
| int | _port1 | ||
| ) |
| MFMarketMaker | ( | string | _username, |
| string | _password, | ||
| string | _hostname1, | ||
| int | _port1, | ||
| string | _hostname2, | ||
| int | _port2 | ||
| ) |
| 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.
| handler | MFMarketMakerHandler to use for callbacks |
/summary>
| APIResult processEvents | ( | MFMarketMakerHandler | 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.
| APIResult subscribePricing | ( | int | feedID, |
| string | clSubID | ||
| ) |
| APIResult subscribeTrading | ( | int | feedID, |
| string | clSubID | ||
| ) |
| APIResult unsubscribePricing | ( | int | feedID, |
| string | clSubID | ||
| ) |
| APIResult unsubscribeTrading | ( | int | feedID, |
| string | clSubID | ||
| ) |
| APIResult rejectQuoteRequest | ( | QuoteRequest | request, |
| QuoteRequestRejectReason | reason, | ||
| string | text | ||
| ) |
Rejects the quote request.
| request | Request to reject. |
| reason | Codified reject reason. |
| text | Reject reason. |
| APIResult cancelQuotes | ( | QuoteRequest | request | ) |
| APIResult cancelQuote | ( | QuoteRequest | request, |
| string | quoteID | ||
| ) |
Cancels quotes associated with a request and quoteID.
| request | QuoteRequest the quotes to cancel are associated with. |
| quoteID | QuoteID of the quote(s) to cancel |
| APIResult cancelQuoteForSymbol | ( | QuoteRequest | request, |
| string | symbol | ||
| ) |
Cancels the quotes for a symbol.
| request | QuoteRequest the quotes to cancel are associated with. |
| symbol | Symbol of quotes to cancel |
| APIResult submitQuotes | ( | QuoteRequest | request, |
| MFQuote [] | quotes | ||
| ) |
Note: If QuoteRequest does not arrive with a valid amount, you must fill one in.
| request | QuoteRequest these quotes are in response to |
| quotes | Quotes to send |
Rejects the order. Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one.
| order | Order to reject. Add the orderID and/or execID if missing |
| text | Reject reason |
Accept the order. Note: if NewOrder.orderID/execID is not provided by the venue, you must generate one.
| order | Order to accept. Add the orderID and/or execID if missing |
Accepts the order. 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.
| order | Order to accept. Add the orderID and/or execID if missing. |
| amount | Amount to fill |
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
protectedvirtual |
Reimplemented from MFBaseClient.
|
static |
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;
|
static |
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; /summary>
|
inherited |
|
inherited |
|
inherited |
Enable/Disable sticky subscriptions.
Set clearSubscriptionsOnStop=false if subscriptions should persist on disconnect/stop/start.
|
inherited |
|
inherited |
Return true if the _channel is _connected.
|
inherited |
Connect to the first available server with user credentials.
Returns 0 if the connection attempt succeeded; returns a negative number if on failure.
Note: this should not be invoked by _handler.
|
protectedvirtualinherited |
Reimplemented in MFAdmin.
|
inherited |
Close the connection.
(This can only be called this when you're not dispatching.)
Note: this should not be invoked by _handler.
|
inherited |
Returns true if the client is currently dispatching events (i.e., you called run()).
|
inherited |
Request to stop the event dispatch loop, does not disconnect the client from the server.
|
inherited |
|
inherited |
Block until the client has exited the dispatch loop.
Note: this should not be invoked by _handler.
|
protectedinherited |
_log.info("Attempting reconnect...");
|
protectedinherited |
|
inherited |
Get protocol api signature.
|
inherited |
Get the last received sequenceID after successful subscription.
Returns -2 if not subscribed. Returns -1 if there are no OF messages for the client on the feed.
|
inherited |
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.
|
inherited |
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).
|
inherited |
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).
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.
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.
|
inherited |
Returns the primary/secondary server hostname (whichever one is being used).
Does not indicate whether a connection is in progress or successfully established.
|
inherited |
Returns the primary/secondary server port (whichever one is being used).
Does not indicate whether a connection is in progress or successfully established.
|
inherited |
|
inherited |
Request replay of order flow events in the range [fromSequenceID, toSequenceID=-1].
Only open-ended requests are accepted by the server.
|
protectedinherited |
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.
summary> 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.
|
protectedinherited |
|
protectedinherited |
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.
|
protectedinherited |
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.
|
protectedinherited |
Subscribe to all the market data feeds.
This is intended as a test utility; ideally you control which feeds and markets you connect to.
|
protectedinherited |
Unsubscribe to market data updates for a specific feed.
|
protectedinherited |
Unsubscribe to market data updates for a specific feed.
|
protectedinherited |
Unsubscribe to trading for a specific feed.
|
protectedinherited |
Unsubscribe to trading for a specific feed.
|
protectedinherited |
|
protectedinherited |
|
inherited |
Unsubscribe all market data and trading subscriptions.
Call this if you want to stop receiving callbacks but don't want to disconnect.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Submit an order.
|
protectedinherited |
Submit an order without minAmount (kept for backward compatibility).
|
protectedinherited |
|
protectedinherited |
Submits the order. Use an OrderParametersBuilder to construct a reusable OrderParameters object. Offers better performance if the you want to reuse the same order parameters for multiple submitOrder calls.
| clOrdID | client order identifier. |
| feedID | Feed identifier. |
| marketID | market identifier. |
| side | side |
| amount | amount |
| price | price |
| stopPrice | stop price |
| maxShowAmt | max show amount |
| minFillAmt | minimum fill amount |
| ordType | order type |
| tif | time in force |
| parameters | optional OrderParameters |
|
protectedinherited |
Submit modification to an existing order.
|
protectedinherited |
Cancel a previously placed order by client order id ('clOrdID'). Return false if the order cannot be found locally, i.e., if the 'clOrdID' does not correspond to any previously placed order on this client interface.
|
protectedinherited |
Cancel a previously placed order by internal 'orderID'. Return false if the internal 'orderID' could not be provided.
|
protectedinherited |
Cancel a previously placed order by providing both internal 'orderID' and clOrdID. APIResult.INVALID_ORDERID if the internal 'orderID' could not be provided.
|
protectedinherited |
Cancel all the orders on a feed.
|
protectedinherited |
Cancel all the orders, on all feeds.
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
|
protectedvirtualinherited |
Reimplemented in MFAdmin.
|
protectedvirtualinherited |
Reimplemented in MFAdmin.
|
protectedvirtualinherited |
|
inherited |
Logs a debug message into the Whisperer server _log file.
(We use this for inserting markers for automated testing and debugging.)
|
inherited |
|
inherited |
Internal testing function.
Do not use this.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |