{"id":8078,"date":"2025-09-04T23:21:57","date_gmt":"2025-09-05T04:21:57","guid":{"rendered":"https:\/\/librarytestdev.wpenginepowered.com\/?post_type=doc&#038;p=8078"},"modified":"2025-09-04T23:23:50","modified_gmt":"2025-09-05T04:23:50","slug":"handling-epiq-subscriptions","status":"publish","type":"doc","link":"https:\/\/library-staging.tradingtechnologies.com\/apis\/tt-net-sdk\/working-with-orders-and-fills-tt-net-sdk\/handling-epiq-subscriptions\/","title":{"rendered":"Handling EPIQ Subscriptions"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"creating-epiq-subscriptions\">Creating EPIQ subscriptions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">TT .NET SDK supports delivering&nbsp;<a href=\"\/trade\/piq-position-in-queue.html\">Position-in-Queue (PIQ)<\/a>&nbsp;for each of you orders. To create a PIQ subscription and start receiving updates:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enable EPIQ when initializing the API.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tt_net_sdk.TTAPIOptions.SDKMode sdkMode = tt_net_sdk.TTAPIOptions.SDKMode.Client;\ntt_net_sdk.TTAPIOptions apiConfig = new tt_net_sdk.TTAPIOptions(\n                                                    sdkMode,\n                                                    environment,\n                                                    appSecretKey,\n                                                    5000);\n\/\/Set to true if EPIQ is to be calculated\napiConfig.EnableEstimatedPositionInQueue = true;\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create an\u00a0<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.EstimatedPositionInQueueSubscription.html\">EstimatedPositionInQueueSubscription<\/a>\u00a0object for a specific instrument.<\/li>\n\n\n\n<li>Create an event handler method to be called when EPIQ updates are available.<\/li>\n\n\n\n<li>Register the event handler with the\u00a0<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.EstimatedPositionInQueueSubscription.html#tt_net_sdk_EstimatedPositionInQueueSubscription_Start\">EstimatedPositionInQueueSubscription<\/a>\u00a0instance.<\/li>\n\n\n\n<li>Call the\u00a0<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.EstimatedPositionInQueueSubscription.html\">Start()<\/a>\u00a0method of the\u00a0<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.EstimatedPositionInQueueSubscription.html\">EstimatedPositionInQueueSubscription<\/a>\u00a0instance.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"subscribing-for-epiq\"><a href=\"\/tt-net-sdk\/articles\/of-handling-epiq-subscriptions.html#subscribing-for-epiq\"><\/a>Subscribing for EPIQ<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Typically, you start an EPIQ subscription immediately after initializing the API. The following snippet demonstrates how to instantiate an&nbsp;<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.EstimatedPositionInQueueSubscription.html\">EstimatedPositionInQueueSubscription<\/a>&nbsp;instance:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>private EstimatedPositionInQueueSubscription m_epiqSubscription = null;\n\n               \/\/subscribe for Estimated Position in Queue\n               m_epiqSubscription = new EstimatedPositionInQueueSubscription(tt_net_sdk.Dispatcher.Current);\n               m_epiqSubscription.EstimatedPositionInQueueUpdated += M_epiqSubscription_EstimatedPositionInQueueUpdated;\n               m_epiqSubscription.Start();\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: When you have a shared order book or if you have existing orders in the market, you will receive the EPIQ snapshot before receiving the live stream.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-the-subscription-event-handler\"><a href=\"\/tt-net-sdk\/articles\/of-handling-epiq-subscriptions.html#creating-the-subscription-event-handler\"><\/a>Creating the subscription event handler<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After the subscription starts, TT .NET SDK retrieves the EPIQ data for all of your orders and invokes the event handler method you registered with the subscription. Subsequent events are then fired as EPIQ changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following code snippet shows the structure of a sample EPIQ subscription event handler method:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>private void M_epiqSubscription_EstimatedPositionInQueueUpdated(object sender, EstimatedPositionInQueueEventArgs e)\n    {\n        Console.WriteLine(\"\\n==== Estimated Position In Queue : for Order Id =&gt; {0} is {1} ======\", e.OrderId, e.PositionInQueue);\n    }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Creating EPIQ subscriptions TT .NET SDK supports delivering&nbsp;Position-in-Queue (PIQ)&nbsp;for each of you  [&hellip;]<\/p>\n","protected":false},"author":2,"template":"wp-custom-template-single-doc-tt-net-sdk","meta":{"_acf_changed":true,"footnotes":""},"docs-category":[773],"class_list":["post-8078","doc","type-doc","status-publish","hentry","docs-category-working-with-orders-and-fills-tt-net-sdk"],"acf":[],"_links":{"self":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc\/8078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc"}],"about":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/types\/doc"}],"author":[{"embeddable":true,"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/users\/2"}],"version-history":[{"count":0,"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc\/8078\/revisions"}],"wp:attachment":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/media?parent=8078"}],"wp:term":[{"taxonomy":"docs-category","embeddable":true,"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/docs-category?post=8078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}