Version 2.14.0
Onix Solutions CME Straight Through Processing Handler allows clients to connect to CME for retrieval of FIXML 5.0 SP2 messages containing NYMEX, COMEX, DME, CBOT via CMD, CME cleared trades, CME Globex, BrokerTec Direct, and registered external deals information.
Handler provides the following services:
Using Handler usually includes the following:
biz.onixs.cme.stp.handler.Session
class.Handler needs a license for successful execution. If Handler is not able to find a valid license, it will throw an exception at the initialization stage.
biz.onixs.cme.stp.handler.Session
class exposes a biz.onixs.cme.stp.handler.Session.#setLicenseDirectory
member that allows instructing Handler where to look for a valid license. By default, Handler looks for a license in the current directory for the application that it uses, the home directory of the current user and a classpath. However, by using the noted parameter, it's possible to specify another folder anywhere on a file system.
The following example demonstrates how we can supply license to Handler:
public class Sample { private void run() throws Exception { Session.setLicenseDirectory("d:\\licenses"); final Session session = new Session(new URL(url), senderCompId, senderSubId, password); } }
Main class to work with Handler is biz.onixs.cme.stp.handler.Session
To create the Session object there are four parameters (obtained from CME):
The following example demonstrates how we can supply license to Handler:
final String url = "https://servicesnr.cmegroup.com/cmestp/query"; final String senderCompId = "SenderCompId"; final String senderSubId = "SenderSubId"; final String password = "Password"; final Session session = new Session(new URL(url), senderCompId, senderSubId, password);
There are two ways to receive biz.onixs.cme.stp.handler.TradeCaptureReport
messages:
biz.onixs.cme.stp.handler.TradeCaptureReportRequest
message is used.
The following example demonstrates how to request filter for all NYMEX products with "NG" or "NA" IDs, and negates NYMEX products with "CL" ID:
TradeCaptureReportRequest req = new TradeCaptureReportRequest(); RequestInstrument instrument1 = new RequestInstrument(); instrument1.setSecurityExchange("NYMEX"); req.getInstruments().add(instrument1); RequestInstrument instrument2 = new RequestInstrument(); instrument2.setSecurityID("-CL"); req.getInstruments().add(instrument2); RequestInstrument instrument3 = new RequestInstrument(); instrument3.setSecurityID("NG,NA"); req.getInstruments().add(instrument3);
For real time data retrieval without filtering use biz.onixs.cme.stp.handler.Session.subscribe()
or
biz.onixs.cme.stp.handler.Session.subscribe(DateTime)
methods.
For real time data retrieval with filtering use biz.onixs.cme.stp.handler.Session.subscribe(TradeCaptureReportRequest)
method.
biz.onixs.cme.stp.handler.Session
constructor parameter.
Session.setLicenseFile("../license/OnixS.Evaluator.Trial.lic"); Session session = new Session(new URL(url), senderCompId, senderSubId, password); session.registerErrorListener(this); session.registerMessageListener(this); session.registerFixmlMessageListener(this); String id = session.subscribe(); // Process received reports (if any) ... session.unsubscribe(id);
For historical data retrieval use the biz.onixs.cme.stp.handler.Session.query(TradeCaptureReportRequest)
method.
The following example demonstrates how to request filter for all NYMEX products with "NG" or "NA" IDs, and negates NYMEX products with "CL" ID:
Session.setLicenseFile("../license/OnixS.Evaluator.Trial.lic"); Session session = new Session(new URL(url), senderCompId, senderSubId, password); session.registerErrorListener(this); session.registerMessageListener(this); session.registerFixmlMessageListener(this); TradeCaptureReportRequest req = new TradeCaptureReportRequest(); req.setStartTime(DateTime.parse("2014-07-22")); req.setEndTime(DateTime.parse("2014-07-28")); RequestInstrument instrument = new RequestInstrument(); instrument.setSecurityID("EC"); instrument.setSecurityExchange("CME"); req.getInstruments().add(instrument); session.query(req); // Process received reports (if any) ...
By default, Handler logs all important aspects of its activity while processing market data. The SLF4J (Simple Logging Facade for Java) is used by Handler internally. The SLF4J detects and uses the concrete logging implementation configured by the user. By default, the Logback logging implementation is recommended.
The Logback (or any other logging implementation) must be configured at the beginning of the application. The examples of Logback configuration can be found in the Handler samples. The details of Logback configuration can be found here.
By default, logging is configured to log only errors and warnings. This is an example of logback.xml where detailed logging was switched on:
<logger name="biz.onixs.cme.stp.handler.sample" level="DEBUG"/>
<logger name="biz.onixs.cme.stp.handler" level="INFO"/>
<logger name="biz.onixs.cme.stp.handler.Session.Messages" level="INFO"/>