{"id":7021,"date":"2025-08-28T22:11:58","date_gmt":"2025-08-29T03:11:58","guid":{"rendered":"https:\/\/librarytestdev.wpenginepowered.com\/?post_type=doc&#038;p=7021"},"modified":"2026-06-29T13:31:12","modified_gmt":"2026-06-29T18:31:12","slug":"receiving-only-specific-solicited-order-fill-events","status":"publish","type":"doc","link":"https:\/\/library-staging.tradingtechnologies.com\/apis\/tt-core-sdk\/working-with-orders-and-fills\/receiving-only-specific-solicited-order-fill-events\/","title":{"rendered":"Receiving Only Specific Solicited Order \/ Fill Events"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">To receive specific solicited order \/ fill events, you need to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a class that is derived from ttsdk::IOrderEventHandler and provide implementations for the following methods.\n<ul class=\"wp-block-list\">\n<li>virtual void OnExecutionReport(OrderPtr order, ExecutionReportPtr execRpt) = 0;\n<ul class=\"wp-block-list\">\n<li>Callback fired when delivering execution report messages<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>virtual void OnReject(OrderPtr order, RejectResponsePtr rejResp) = 0;\n<ul class=\"wp-block-list\">\n<li>Callback fired when delivering order reject messages<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>virtual void OnSendFailed(OrderPtr order, const OrderProfile&amp; profile, const SendCode code) = 0;\n<ul class=\"wp-block-list\">\n<li>Callback fired when a request delivery surpasses the timeout threshold<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>virtual void OnUnsubscribed(const char* orderId) = 0;\n<ul class=\"wp-block-list\">\n<li>Callback fired when the unsubscribe request is complete and it is safe to destroy the handler object<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Call the Subscribe() method of the OrderPtr instance passing an instance of the class that defines your ttsdk::IOrderEventHandler event handler.\n<ul class=\"wp-block-list\">\n<li>This is discussed further in the\u00a0<a href=\"https:\/\/library-staging.tradingtechnologies.com\/apis\/tt-core-sdk\/working-with-orders-and-fills\/receiving-only-specific-solicited-order-fill-events\/of-submitting-orders.html\">Submitting Orders<\/a>\u00a0section.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A sample implementation of class derived from&nbsp;<strong>ttsdk::IOrderEventHandler<\/strong>&nbsp;is demonstrated in the following code snippet.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><br>\n  \nclass OrderObserver : public ttsdk::IOrderEventHandler\n{\n  public:\n      OrderObserver() {}\n\n      virtual void OnExecutionReport(ttsdk::OrderPtr order, \n              ttsdk::ExecutionReportPtr execRpt) override\n      {\n              switch(execRpt-&gt;GetExecType())\n              {\n                    case ttsdk::ExecType::New :\n                      std::cout &lt;&lt; \"Order successfully entered in market. RequestId=\" \n                            &lt;&lt; execRpt-&gt;GetRequestId() \n                            &lt;&lt; \" OrderStatus=\" \n                            &lt;&lt; ttsdk::ToString(execRpt-&gt;GetOrderStatus()) &lt;&lt; std::endl;\n                      break;\n                    case ttsdk::ExecType::Canceled :\n                      std::cout &lt;&lt; \"Order successfully cancelled. RequestId=\" \n                            &lt;&lt; execRpt-&gt;GetRequestId() \n                            &lt;&lt; \" OrderStatus=\" \n                            &lt;&lt; ttsdk::ToString(execRpt-&gt;GetOrderStatus()) \n                            &lt;&lt; \" &#91;external=\" &lt;&lt; execRpt-&gt;IsExternalAction() \n                            &lt;&lt; \"]\" &lt;&lt; std::endl;\n                      break;\n                    case ttsdk::ExecType::Replaced :\n                      std::cout &lt;&lt; \"Order replaced. RequestId=\" \n                            &lt;&lt; execRpt-&gt;GetRequestId() \n                            &lt;&lt; \" TTOrderId=\" &lt;&lt; order-&gt;GetOrderId() \n                            &lt;&lt; \" OrderStatus=\" \n                            &lt;&lt; ttsdk::ToString(execRpt-&gt;GetOrderStatus()) \n                            &lt;&lt; \" &#91;external=\" &lt;&lt; execRpt-&gt;IsExternalAction() \n                            &lt;&lt; \"]\" &lt;&lt; std::endl;\n                      break;\n                    case ttsdk::ExecType::Trade :\n                      std::cout &lt;&lt; \"Order filled. RequestId=\" \n                            &lt;&lt; execRpt-&gt;GetRequestId() \n                            &lt;&lt; \" TTOrderId=\" &lt;&lt; order-&gt;GetOrderId() \n                            &lt;&lt; \" OrderStatus=\" \n                            &lt;&lt; ttsdk::ToString(execRpt-&gt;GetOrderStatus()) &lt;&lt; std::endl;\n                      break;\n                    case ttsdk::ExecType::Rejected :\n                      std::cout &lt;&lt; \"Order filled. RequestId=\" &lt;&lt; execRpt-&gt;GetRequestId() \n                            &lt;&lt; \" TTOrderId=\" &lt;&lt; order-&gt;GetOrderId() \n                            &lt;&lt; \" OrderStatus=\" \n                            &lt;&lt; ttsdk::ToString(execRpt-&gt;GetOrderStatus()) &lt;&lt; std::endl;\n                      break;\n                    default:\n                      std::cout &lt;&lt; \"Unhandled event. RequestId=\" \n                            &lt;&lt; execRpt-&gt;GetRequestId() &lt;&lt; \" TTOrderId=\" \n                            &lt;&lt; order-&gt;GetOrderId() &lt;&lt; \" OrderStatus=\" \n                            &lt;&lt; ttsdk::ToString(execRpt-&gt;GetOrderStatus()) \n                            &lt;&lt; \" ExecutionType=\" \n                            &lt;&lt; ttsdk::ToString(execRpt-&gt;GetExecType()) &lt;&lt; std::endl;\n              }\n      }\n\n      virtual void OnReject(ttsdk::OrderPtr order, ttsdk::RejectResponsePtr rejResp) override\n      {\n              std::cout &lt;&lt; \"OnReject event. RequestId=\" &lt;&lt; rejResp-&gt;GetRequestId() \n                    &lt;&lt; \" TTOrderId=\" &lt;&lt; order-&gt;GetOrderId() &lt;&lt; \" RejectReason=\" \n                    &lt;&lt; ttsdk::ToString(rejResp-&gt;GetRejectReason()) \n                    &lt;&lt; \" Text=\" &lt;&lt; rejResp-&gt;GetText() &lt;&lt; std::endl;\n              order_.reset();\n      }\n\n      virtual void OnSendFailed(ttsdk::OrderPtr order, const ttsdk::OrderProfile&amp; profile, \n              const ttsdk::IOrderEventHandler::SendCode code) override\n      {\n            std::cout &lt;&lt; \"Order send failed. RequestId=\" &lt;&lt; profile.request_id\n                  &lt;&lt; \" TTOrderId=\" &lt;&lt; order-&gt;GetOrderId() &lt;&lt; \" SendCode=\" \n                  &lt;&lt; (int)code &lt;&lt; std::endl;\n      }\n\n      virtual void OnUnsubscribed(const char* orderId) override\n      {\n            std::cout &lt;&lt; \"Order observer for orderId=\" &lt;&lt; orderId \n                  &lt;&lt; \" has been successfully unsubscribed.\" &lt;&lt; std::endl;\n      }  \n};\n      \n      <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p class=\"wp-block-paragraph\">To receive specific solicited order \/ fill events, you need to:<\/p>\n<p class=\"wp-block-paragraph\">A sample implementation of class derived from&nbsp;<strong>ttsdk::IOrderEventHandler<\/strong>&nbsp;is demonstrated in the following code snippet.<\/p>\n","protected":false},"author":2,"template":"wp-custom-template-single-doc-tt-core-sdk","meta":{"_acf_changed":false,"footnotes":""},"docs-category":[448],"class_list":["post-7021","doc","type-doc","status-publish","hentry","docs-category-working-with-orders-and-fills"],"acf":[],"_links":{"self":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc\/7021","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\/7021\/revisions"}],"wp:attachment":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/media?parent=7021"}],"wp:term":[{"taxonomy":"docs-category","embeddable":true,"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/docs-category?post=7021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}