Files
externals/linux/doc/Onixs.CME.4.8.0/html/group__processing-session.html

122 lines
16 KiB
HTML

<!-- HTML header for doxygen 1.8.11-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>OnixS C++ CME Market Data Handler: Market Data Processing Session</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="onixs-doxygen.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
$(window).scroll(function() {
if ($(this).scrollTop() > 1)
{
$('header').addClass("sticky");
}
else
{
$('header').removeClass("sticky");
}
});
</script>
</head>
<body>
<header>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><a href="http://www.onixs.biz"><img alt="Logo" src="onixs.svg"/></a></td>
<td style="padding-left: 0.5em;">
<div id="projectname">OnixS C++ CME Market Data Handler
&#160;<span id="projectnumber">4.8.0.10</span>
</div>
<div id="projectbrief">API documentation</div>
</td>
</tr>
</tbody>
</table>
</div>
</header>
<div id="wrapper">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Home</span></a></li>
<li class="current"><a href="modules.html"><span>Contents</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Market Data Processing Session<div class="ingroups"><a class="el" href="group__getting-started.html">Getting Started</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Previously, the Handler offered a predefined set of market data processing patterns. The given processing patterns covered the most frequently used cases of market data processing like late join with an accurate order book maintenance or order book natural refresh using only real-time feeds.</p>
<p>However, if the users wanted to have more customization for a processing session like using a TCP Recovery facility in case of a natural refresh, there was no solution for the case.</p>
<p>Starting with version 4, the SDK offers improved and enhanced market data processing session. Now the Handler allows to use a TCP recovery while books are naturally refreshed or to combine join-time recovery with natural refresh and so forth.</p>
<h1><a class="anchor" id="processing-session-settings"></a>
Defining Processing Behavior</h1>
<p>A set of parameters, gathered into the the <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1SessionSettings.html">OnixS::CME::MDH::SessionSettings</a> class, now defines behavior of a processing session. The <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html#a706bb1347bedfcfd0cba2ed8d30ae5b1" title="Starts market data processing according to given parameters. ">OnixS::CME::MDH::Handler::start</a> member requires an instance of the <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1SessionSettings.html">OnixS::CME::MDH::SessionSettings</a> as a parameter.</p>
<p>Settings allow defining whether market data recovery must be done at the beginning of market data processing or in case of data loss or other processing error, and so on. Also, settings allow defining which type of market (by price or by order or both) to recover.</p>
<p>The table below describes primary parameters affecting market data processing:</p>
<table class="doxtable">
<tr>
<th>Parameter </th><th>Description </th><th>Behavior Visualization </th></tr>
<tr>
<td><a class="el" href="classOnixS_1_1CME_1_1MDH_1_1SessionSettings.html#a53fc04923f1de17fabc8acdd999417c6">OnixS::CME::MDH::SessionSettings::joinRecovery</a> </td><td><p class="starttd">Defines whether the Handler must recover either instruments or the entire market state, or nothing when it joins a trading session. For a complete list of available options see <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1JoinRecoveryOptions.html#a8150b7776c2a1749101acf22e868d091">OnixS::CME::MDH::JoinRecoveryOptions::Enum</a> items.</p>
<dl class="section note"><dt>Note</dt><dd>Recovery at join-time is a single-time procedure executed by the Handler. Performing recovery, for example, due to book update failure or data loss at a later time is defined by other parameters. See <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1SessionSettings.html#a94f92e547decb687d9bf5d9964d36649">OnixS::CME::MDH::SessionSettings::gapAndErrorHandling</a> for more information. </dd></dl>
</td><td rowspan="2"><div class="image">
<img src="SessionSettings-JoinAndGap.jpg" alt="SessionSettings-JoinAndGap.jpg"/>
</div>
</td></tr>
<tr>
<td><a class="el" href="classOnixS_1_1CME_1_1MDH_1_1SessionSettings.html#a94f92e547decb687d9bf5d9964d36649">OnixS::CME::MDH::SessionSettings::gapAndErrorHandling</a> </td><td><p class="starttd">When real-time market data is processed, a failure may take place due to errors in transmitted data or due to data loss. The Handler allows controlling its behavior in such cases. With the help of the given parameter, it's possible to specify whether processing real-time market data should continue or the Handler must recover market state to have accurate order books. Also, the Handler may recover all instruments in addition to the market state to have an accurate list of traded securities.</p>
<p>See the <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1GapAndErrorHandlingOptions.html#a8150b7776c2a1749101acf22e868d091">OnixS::CME::MDH::GapAndErrorHandlingOptions::Enum</a> for a complete list of available options.</p>
<dl class="section note"><dt>Note</dt><dd>The given parameter does not affect join-time behavior and thus if recovery is desired at join time, the <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1SessionSettings.html#a53fc04923f1de17fabc8acdd999417c6">OnixS::CME::MDH::SessionSettings::joinRecovery</a> member must be used to set a correspondent value. </dd></dl>
</td></tr>
<tr>
<td><a class="el" href="classOnixS_1_1CME_1_1MDH_1_1SessionSettings.html#a6626a6db6b58d510918eb2ac164e14d6">OnixS::CME::MDH::SessionSettings::marketRecovery</a> </td><td valign="top"><p class="starttd">The given parameter controls aspects of the Handler behavior in case of market recovery. If processing session has to perform market state recovery due to either late join or processing failure, the given parameter allows defining a type of market to recover.</p>
<p>Starting with Q4 of 2016, CME MDP offers market by order (MBO) data in addition to market by price (MBP) one. Although the data for both MBO and MBP is combined on the real-time feed, recovery is separated for each type of market. As a result, the Handler has to be configured with the types of markets which must be recovered.</p>
<p>For a complete list of options, see <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1MarketRecoveryOptions.html#a8150b7776c2a1749101acf22e868d091">OnixS::CME::MDH::MarketRecoveryOptions::Enum</a>.</p>
<dl class="section note"><dt>Note</dt><dd>Value of the given parameter must be adjusted with order books maintaining settings. For example, if a processing session is configured to recover market at the join time or due to data loss and recovery must be done for market by price only, then the accurate maintenance of MBO books is not possible. Therefore, the if the Handler is configured to maintain MBO books in such case, an exception is thrown. </dd></dl>
</td><td><div class="image">
<img src="SessionSettings-MarketRecovery.jpg" alt="SessionSettings-MarketRecovery.jpg"/>
</div>
</td></tr>
</table>
<h2><a class="anchor" id="accurate-latejoin-session-example"></a>
Configuring Handler For Accurate Book Maintenance While Joining Lately</h2>
<p>The following code snippet depicts how to configure market data processing session to maintain order books accurately starting from the middle of a trading session (a.k.a. late join).</p>
<div class="fragment"><div class="line"><span class="comment">// Processing session settings. </span></div><div class="line">SessionSettings settings;</div><div class="line"></div><div class="line"><span class="comment">// In case of late join, instruments and market state must be </span></div><div class="line"><span class="comment">// recovered before switching to process real-time (incremental) data.</span></div><div class="line">settings.joinRecovery(JoinRecoveryOptions::InstrumentsAndMarketState);</div><div class="line"></div><div class="line"><span class="comment">// Accurate order book maintenance assumes performing market recovery </span></div><div class="line"><span class="comment">// each time data is lost or other processing failure occurs. </span></div><div class="line">settings.gapAndErrorHandling(GapAndErrorHandlingOptions::RecoverMarketState);</div><div class="line"></div><div class="line"><span class="comment">// Now, spawns live market data processing. </span></div><div class="line">handler.start(settings);</div></div><!-- fragment --><h2><a class="anchor" id="accurate-preopening-mbp-session-example"></a>
Configuring Handler for Accurate MBP Book Maintenance while Joining in Preopening</h2>
<p>The following code snippet depicts how to configure a market data processing session to maintain MBP books accurately starting from the beginning of a trading session when market is at a blank state, and no initial recovery is needed to catch-up an up-to-date market state.</p>
<div class="fragment"><div class="line"><span class="comment">// Processing session settings. </span></div><div class="line">SessionSettings settings;</div><div class="line"></div><div class="line"><span class="comment">// In case of preopening, instruments are transmitted via real-time feed </span></div><div class="line"><span class="comment">// and market state is blank. Therefore, join recovery is not needed at all.</span></div><div class="line">settings.joinRecovery(JoinRecoveryOptions::InstrumentsAndMarketState);</div><div class="line"></div><div class="line"><span class="comment">// Accurate order book maintenance assumes performing market recovery </span></div><div class="line"><span class="comment">// each time data is lost or other processing failure occurs. </span></div><div class="line">settings.gapAndErrorHandling(GapAndErrorHandlingOptions::RecoverMarketState);</div><div class="line"></div><div class="line"><span class="comment">// Limits market recovery to MBP only.</span></div><div class="line">settings.marketRecovery(MarketRecoveryOptions::MbpOnly);</div><div class="line"></div><div class="line"><span class="comment">// Now, spawns live market data processing. </span></div><div class="line">handler.start(settings);</div></div><!-- fragment --><h2><a class="anchor" id="natural-refresh-with-initial-recovery-session-example"></a>
Configuring Handler to Refresh Books Naturally with Initial Recovery</h2>
<p>The following code snippet depicts how to configure market data processing to maintain order books in the natural refresh mode and to perform a full state recovery at a join stage. The given configuration is frequently used in cases, when a server doing market data processing is collocated in the CME network and a possibility of data loss is minimal. It gives almost same benefits as an accurate order book maintenance, but in case of data loss, it does not let real-time processing to freeze due to necessity in performing market recovery.</p>
<div class="fragment"><div class="line"><span class="comment">// Processing session settings. </span></div><div class="line">SessionSettings settings;</div><div class="line"></div><div class="line"><span class="comment">// This forces Handler to perform instrument and market recovery at join time.</span></div><div class="line">settings.joinRecovery(JoinRecoveryOptions::InstrumentsAndMarketState);</div><div class="line"></div><div class="line"><span class="comment">// Natural refresh assumes continuation of real-time data </span></div><div class="line"><span class="comment">// processing even if some of transmitted data is lost. </span></div><div class="line">settings.gapAndErrorHandling(GapAndErrorHandlingOptions::ContinueProcessing);</div><div class="line"></div><div class="line"><span class="comment">// Now, spawns live market data processing. </span></div><div class="line">handler.start(settings);</div></div><!-- fragment --><h2><a class="anchor" id="natural-refresh-with-tcp-recovery-session-example"></a>
Configuring Handler To Refresh Books Naturally But Use TCP Recovery In Case Of Data Losses</h2>
<p>The following code snippet helps to configure market data processing to maintain order books in natural refresh mode. However, in contrast to a regular case, when real-time processing is resumed immediately, in the given case the Handler tries to recover missing data using TCP Recovery Feed.</p>
<div class="fragment"><div class="line"><span class="comment">// Processing session settings.</span></div><div class="line">SessionSettings settings;</div><div class="line"></div><div class="line"><span class="comment">// Natural refresh assumes continuation of real-time data </span></div><div class="line"><span class="comment">// processing even if some of transmitted data is lost. </span></div><div class="line">settings.gapAndErrorHandling(GapAndErrorHandlingOptions::ContinueProcessing);</div><div class="line"></div><div class="line"><span class="comment">// Settings for TCP recovery facility.</span></div><div class="line">TcpRecoverySetting tcpRecoverySettings;</div><div class="line"></div><div class="line"><span class="comment">// Credentials are to be set as there&#39;s no defaults for</span></div><div class="line"><span class="comment">// these parameters. Other parameters have default values.</span></div><div class="line">tcpRecoverySettings.username(<span class="stringliteral">&quot;CME&quot;</span>);</div><div class="line">tcpRecoverySettings.password(<span class="stringliteral">&quot;CME&quot;</span>);</div><div class="line"></div><div class="line"><span class="comment">// Instance of TCP recovery service to be bound to the Handler.</span></div><div class="line">TcpRecoveryService tcpRecovery(tcpRecoverySettings);</div><div class="line">handler.bindTcpRecovery(tcpRecovery);</div><div class="line"></div><div class="line"><span class="comment">// Now, spawns live market data processing. </span></div><div class="line">handler.start(settings);</div></div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="classOnixS_1_1CME_1_1MDH_1_1AccurateLateJoinSession.html">OnixS::CME::MDH::AccurateLateJoinSession</a>, <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1AccurateLateJoinMboSession.html">OnixS::CME::MDH::AccurateLateJoinMboSession</a>, <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1AccurateLateJoinMbpSession.html">OnixS::CME::MDH::AccurateLateJoinMbpSession</a>, <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1AccurateLateJoinSession.html">OnixS::CME::MDH::AccurateLateJoinSession</a>, <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1AccuratePreopeningSession.html">OnixS::CME::MDH::AccuratePreopeningSession</a>, <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1AccuratePreopeningMboSession.html">OnixS::CME::MDH::AccuratePreopeningMboSession</a>, <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1AccuratePreopeningMbpSession.html">OnixS::CME::MDH::AccuratePreopeningMbpSession</a>, <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1NaturalRefreshSession.html">OnixS::CME::MDH::NaturalRefreshSession</a>. </dd></dl>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.11-->
<!-- start footer part -->
<footer>
<hr class="footer"/>
<address class="footer">
<small>&copy; <a href="http://www.onixs.biz">Onix Solutions [On<span class="corporate-orange">i</span>x<span class="corporate-orange">S</span>]</a>. All rights reserved.</small>
</address>
</footer>
</div> <!-- wrapper -->
</body>
</html>