{"id":7013,"date":"2025-08-28T22:11:57","date_gmt":"2025-08-29T03:11:57","guid":{"rendered":"https:\/\/librarytestdev.wpenginepowered.com\/?post_type=doc&#038;p=7013"},"modified":"2025-09-04T17:17:23","modified_gmt":"2025-09-04T22:17:23","slug":"working-with-price-subscriptions","status":"publish","type":"doc","link":"https:\/\/library-test.tradingtechnologies.com\/apis\/tt-core-sdk\/subscribing-for-market-data\/working-with-price-subscriptions\/","title":{"rendered":"Working with Price Subscriptions"},"content":{"rendered":"\n<p><span class=\"label-info label\">Note<\/span> Market data subscriptions are throttled at 750 per second and applications are limited to making no more than 15,000 market data subscriptions.<\/p>\n\n<p>\n  To create a price subscription and start receiving updates,\n  you:\n<\/p>\n\n<ol>\n  <li>\n    Create a class that is derived from\n    <strong>ttsdk::IPriceEventHandler<\/strong> and defines your\n    event handler. You must provide implementations for:\n    <ul>\n      <li>\n        virtual void OnPriceUpdate(const uint64_t subId, const\n        InstrumentPtr&amp; instrument, const PriceSnap&amp;\n        snap) = 0;\n        <ul><li>Callback delivering price updates<\/li><\/ul>\n      <\/li>\n      \n      <li>\n        virtual void OnError(const uint64_t subId, const\n        InstrumentPtr&amp; instrument, const SubscriptionError\n        code, const char* error) = 0;\n        <ul><li>\n          Callback fired when an error occurs fulfilling a price\n          subscription request\n        <\/li><\/ul>\n      <\/li>\n      \n      <li>\n        virtual void OnDisconnect(const uint64_t subId, const\n        InstrumentPtr&amp; instrument, const PriceEventType\n        type) = 0;\n        <ul><li>\n          Callback fired when an disconnection event happens\n        <\/li><\/ul>\n      <\/li>\n      \n      <li>\n        virtual void OnUnsubscribed(const uint64_t subId) = 0;\n        <ul><li>\n          Callback fired when the unsubscribe request is complete\n          and it is safe to destroy the handler object\n        <\/li><\/ul>\n      <\/li>\n      \n    <\/ul>\n  <\/li>\n  <li>\n    Call the SubscribePrices() function passing your event\n    handler instance variable.\n    <ul>\n      <li>\n        The SubscribePrices() function allows you to specify\n        whether to wish to optionally receive:\n        <ul>\n          <li>market depth<\/li>\n          <li>\n            exchange calculated and disseminated implied prices\n          <\/li>\n          <li>TT calculated and disseminated implied prices<\/li>\n          <li>TT\u2019s simulation price stream<\/li>\n        <\/ul>\n      <\/li>\n    <\/ul>\n  <\/li>\n<\/ol>\n\n<p>\n  The following code snippet demonstrates an example of this\n  process.\n<\/p>\n\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n  <pre class=\"highlight\"><code>\n\nclass PriceObserver : public ttsdk::IPriceEventHandler\n{\n  public:\n        PriceObserver() {}\n\n      virtual void OnPriceUpdate(const uint64_t subId, \n              const ttsdk::InstrumentPtr&amp; instrument, const ttsdk::PriceSnap&amp; snap)\n      {\n              std::cout GetAlias() GetAlias() <\/code><\/pre>\n                  <\/div>\n                <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Note Market data subscriptions are throttled at 750 per second and applications are limited to making no more  [&hellip;]<\/p>\n","protected":false},"author":2,"template":"wp-custom-template-single-doc-tt-core-sdk","meta":{"_acf_changed":false,"footnotes":""},"docs-category":[447],"class_list":["post-7013","doc","type-doc","status-publish","hentry","docs-category-subscribing-for-market-data"],"acf":[],"_links":{"self":[{"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc\/7013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc"}],"about":[{"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/types\/doc"}],"author":[{"embeddable":true,"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/users\/2"}],"version-history":[{"count":0,"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc\/7013\/revisions"}],"wp:attachment":[{"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/media?parent=7013"}],"wp:term":[{"taxonomy":"docs-category","embeddable":true,"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/docs-category?post=7013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}