87 lines
13 KiB
HTML
87 lines
13 KiB
HTML
<!-- HTML header for doxygen 1.8.7-->
|
|
<!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.3.0</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>
|
|
</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, each <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1Handler.html">OnixS::CME::MDH::Handler</a> instance 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 significant amount of system resources (like a memory). From other side, it often happens that not all securities are the point of interest. For these reasons, Handler provides an ability to define a subset of securities for which Handler will monitor market data, maintain books and report about other market-related events. No events will be fired by the Handler 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 bag with apples. <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 the collection for which the Handler must process market data. There's no limits on quantity of securities which can be included into selection.</p>
|
|
<p>If at least one security is added to the filter, Handler stops raising events for all securities available in the market data channel. Since that moment the Handler fires events only for securities included into filtering.</p>
|
|
<p>Securities can be filtered using security id, security group, symbol and asset attributes. For each of these attributes, <a class="el" href="classOnixS_1_1CME_1_1MDH_1_1InstrumentSelection.html">OnixS::CME::MDH::InstrumentSelection</a> class exposes corresponding member returning collection of attribute values which can manipulated as regular std::set.</p>
|
|
<p>Empty (blank) security selection causes the Handler to process market data and trigger events all securities in the market data channel.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>Selecting securities affects <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. Handler does not invoke listener members for securities out of 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 <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 successful recovery status. Once Handler begins market data processing or moves out of noted callback scope, security selection must not be modified.</b></dd></dl>
|
|
<h1><a class="anchor" id="security-filter-example"></a>
|
|
Example</h1>
|
|
<p>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> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1MessageArgs.html">InstrumentDefinitionFutureArgs</a>& args)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (userSelectedSecurity(args.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1MessageArgs.html#aa48e989a0bebff5955f6a4ec789aa60c">message</a>())</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> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1MessageArgs.html">InstrumentDefinitionSpreadArgs</a>& args)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (userSelectedSecurity(args.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1MessageArgs.html#aa48e989a0bebff5955f6a4ec789aa60c">message</a>())</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> <a class="code" href="classOnixS_1_1CME_1_1MDH_1_1MessageArgs.html">InstrumentDefinitionOptionArgs</a>& args)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (userSelectedSecurity(args.<a class="code" href="classOnixS_1_1CME_1_1MDH_1_1MessageArgs.html#aa48e989a0bebff5955f6a4ec789aa60c">message</a>())</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.7-->
|
|
<!-- 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>
|