88 lines
13 KiB
HTML
88 lines
13 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: Selecting Securities of Interest</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
|
|
 <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">Selecting Securities of Interest<div class="ingroups"><a class="el" href="group__getting-started.html">Getting Started</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<h1><a class="anchor" id="define-security-selection"></a>
|
|
Defining Securities of Interest</h1>
|
|
<p>By default, the Handler processes market data for all securities available in a particular market data channel. For certain channels, it may be a huge amount of data which may cause the Handler to allocate a significant amount of system resources (like a memory). From the other side, it often happens that not all securities are the point of interest. For these reasons, the Handler provides an ability to define a subset of securities for which it monitors market data, maintains books and report about other market-related events. The Handler fires no events for any security not present in the defined subset. This feature is called <em>selecting securities or security filtering</em>.</p>
|
|
<p>Selecting securities is similar to the process of filling a bag with apples. The <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1InstrumentSelection.html">OnixS::CME::MDH::InstrumentSelection</a> class must be used to gather securities into a collection for which the Handler must process market data. There're no limits on the quantity of securities which can be included into the selection.</p>
|
|
<p>If at least one security is added to the filter, the Handler stops raising events for all securities available in the market data channel. Since that moment the Handler fires events only for securities included in filtering.</p>
|
|
<p>Securities can be filtered using security id, security group, symbol, and asset attributes. For each of these attributes, the <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1InstrumentSelection.html">OnixS::CME::MDH::InstrumentSelection</a> class exposes the corresponding member returning a collection of attribute values which can be manipulated as the regular std::set.</p>
|
|
<p>An empty (blank) security selection causes the Handler to process market data and to trigger events for all securities on the channel.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>Selecting securities affects the <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1SecurityListener.html" title="Callbacks invoked by Handler to expose market data entities. ">OnixS::CME::MDH::SecurityListener</a> listener only. The Handler does not invoke listener members for securities out of the selection scope. Other listeners are not affected by this feature.</dd></dl>
|
|
<dl class="section warning"><dt>Warning</dt><dd><b>Filtering must be manipulated only when the Handler is not processing market data or in bounds of the <a class="el" href="structOnixS_1_1CME_1_1MDH_1_1HandlerListener.html#a0dfd73a3628877da330e100f2104be31" title="Download or replay of Security Definition(d) messages is finished. ">OnixS::CME::MDH::HandlerListener::onEndOfInstrumentRecovery</a> callback with a successful recovery status. Once the Handler begins market data processing or moves out of the noted callback scope, security selection must not be modified.</b></dd></dl>
|
|
<h1><a class="anchor" id="security-filter-example"></a>
|
|
Example</h1>
|
|
<p>The following code demonstrates how to instruct the Handler to process data only for securities selected by the user:</p>
|
|
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespaceOnixS_1_1CME_1_1MDH.html">OnixS::CME::MDH</a>;</div><div class="line"></div><div class="line"><span class="keyword">class</span></div><div class="line">InteractiveSecuritySelector</div><div class="line">: <span class="keyword">public</span> <a class="code" href="structOnixS_1_1CME_1_1MDH_1_1SecurityListener.html">SecurityListener</a></div><div class="line">, <span class="keyword">public</span> <a class="code" href="structOnixS_1_1CME_1_1MDH_1_1HandlerListener.html">HandlerListener</a></div><div class="line">{</div><div class="line"> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1InstrumentSelection.html">InstrumentSelection</a> selection_;</div><div class="line"></div><div class="line"> <span class="keyword">template</span></div><div class="line"> <</div><div class="line"> <span class="keyword">class </span>Definition</div><div class="line"> ></div><div class="line"> <span class="keywordtype">bool</span></div><div class="line"> userSelectedSecurity(</div><div class="line"> <span class="keyword">const</span> Definition& definition)</div><div class="line"> {</div><div class="line"> <span class="comment">// Given member asks user whether user wants</span></div><div class="line"> <span class="comment">// to have market data for given instrument.</span></div><div class="line"> <span class="comment">// Returned value indicates whether user</span></div><div class="line"> <span class="comment">// selected instrument.</span></div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">public</span>:</div><div class="line"> InteractiveSecuritySelector()</div><div class="line"> {</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span></div><div class="line"> onDefinition(</div><div class="line"> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html">Handler</a>&,</div><div class="line"> <span class="keyword">const</span> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Security.html">Security</a>& security,</div><div class="line"> <span class="keyword">const</span> InstrumentDefinitionFutureArgs& args)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (userSelectedSecurity(args.message())</div><div class="line"> selection_.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1InstrumentSelection.html#a629ee8e637950374bb657661405ca354">securityIds</a>().<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1TinySet.html#aaad59340d2cf285a334d6e676aafc4b4">insert</a>(security.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Security.html#a901e3a47c0d6256a7b4c32ca9fb0e362">id</a>());</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span></div><div class="line"> onDefinition(</div><div class="line"> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html">Handler</a>&,</div><div class="line"> <span class="keyword">const</span> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Security.html">Security</a>& security,</div><div class="line"> <span class="keyword">const</span> InstrumentDefinitionSpreadArgs& args)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (userSelectedSecurity(args.message())</div><div class="line"> selection_.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1InstrumentSelection.html#a629ee8e637950374bb657661405ca354">securityIds</a>().<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1TinySet.html#aaad59340d2cf285a334d6e676aafc4b4">insert</a>(security.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Security.html#a901e3a47c0d6256a7b4c32ca9fb0e362">id</a>());</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span></div><div class="line"> onDefinition(</div><div class="line"> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html">Handler</a>&,</div><div class="line"> <span class="keyword">const</span> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Security.html">Security</a>& security,</div><div class="line"> <span class="keyword">const</span> InstrumentDefinitionOptionArgs& args)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (userSelectedSecurity(args.message())</div><div class="line"> selection_.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1InstrumentSelection.html#a629ee8e637950374bb657661405ca354">securityIds</a>().<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1TinySet.html#aaad59340d2cf285a334d6e676aafc4b4">insert</a>(security.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Security.html#a901e3a47c0d6256a7b4c32ca9fb0e362">id</a>());</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span></div><div class="line"> onEndOfInstrumentRecovery(</div><div class="line"> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html">Handler</a>& handler,</div><div class="line"> <span class="keyword">const</span> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1RecoveryCompletionArgs.html">RecoveryCompletionArgs</a>& args)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (args.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1RecoveryCompletionArgs.html#aa13c6ac7db8f94df450e83002e9dc007">status</a>() ==</div><div class="line"> <a class="code" href="structOnixS_1_1CME_1_1MDH_1_1RecoveryCompletionStatus.html#a8150b7776c2a1749101acf22e868d091ad3fd99373969ea0bcc59d231d928c64f">RecoveryCompletionStatus::Succeeded</a>)</div><div class="line"> {</div><div class="line"> handler.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html#ade4bb14b6bd22e843e6a38e40d94f1d9">selectInstruments</a>(selection_);</div><div class="line"> }</div><div class="line"> }</div><div class="line">};</div><div class="line"></div><div class="line"><a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html">Handler</a> handler(settings);</div><div class="line"></div><div class="line">InteractiveSecuritySelector selector;</div><div class="line"></div><div class="line">handler.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html#a6beafabae2b29c9ed906fd9e6d3897b7">registerSecurityListener</a>(selector);</div><div class="line">handler.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html#ad3e30d4857d5192a9545acb66ba10280">registerListener</a>(selector);</div><div class="line"></div><div class="line">handler.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html#a706bb1347bedfcfd0cba2ed8d30ae5b1">start</a>();</div></div><!-- fragment --> </div><!-- contents -->
|
|
<!-- HTML footer for doxygen 1.8.11-->
|
|
<!-- start footer part -->
|
|
<footer>
|
|
<hr class="footer"/>
|
|
<address class="footer">
|
|
<small>© <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>
|