Subscription
For real-time data retrieval without filtering, please use the Subscribe() and Subscribe(DateTime).
For real-time data retrieval with filtering, please use the Subscribe(TradeCaptureReportRequest) method.
To continue reports retrieval, Handler automatically sends requests for all active subscriptions every 3 seconds.
This interval can be changed using the pollingInterval
parameter of Session(Uri, string, string, string, int) constructor.
// Create session.
Session session = new Session(new Uri("UrlValue"), "SenderCompIdValue", "SenderSubIdValue", "Password");
session.TradeCaptureReportReceived += (sender, args) =>
{
Console.WriteLine("Trade Capture Report received.");
};
// Subscribe for all data.
string subscriptionId = session.Subscribe();
// Process received reports (if any) ...
// Unsubscribe.
session.Unsubscribe(subscriptionId);
// Subscribe with filters.
TradeCaptureReportRequest request = new TradeCaptureReportRequest();
request.Instrument.SecurityExchange = "NYMEX";
request.TradeCaptureDates.Add(new TradeCaptureDate() { TradeDate = new DateTime(2020, 05, 10) });
// Subscribe for all NYMEX trades for today.
subscriptionId = session.Subscribe(request);
// Process received reports (if any) ...
// Unsubscribe.
session.Unsubscribe(subscriptionId);