{"id":8071,"date":"2025-09-04T23:21:58","date_gmt":"2025-09-05T04:21:58","guid":{"rendered":"https:\/\/librarytestdev.wpenginepowered.com\/?post_type=doc&#038;p=8071"},"modified":"2025-09-04T23:23:51","modified_gmt":"2025-09-05T04:23:51","slug":"price-class-arithmetic-operators","status":"publish","type":"doc","link":"https:\/\/library-test.tradingtechnologies.com\/apis\/tt-net-sdk\/subscribing-for-market-data-tt-net-sdk\/more-about-prices\/an-in-depth-look-at-the-price-class\/price-class-arithmetic-operators\/","title":{"rendered":"Price class: arithmetic operators"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The&nbsp;<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.Price.html\">Price<\/a>&nbsp;class overloads common arithmetic operators that allow you to perform arithmetic on prices in a variety of formats.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public static Price operator *(int tick, Price price);\npublic static Price operator *(Price price, int tick);\npublic static Price operator *(Price lhs, Price rhs);\n\npublic static Price operator \/(int tick, Price price);\npublic static Price operator \/(Price price, int tick);\npublic static Price operator \/(Price lhs, Price rhs);\n\npublic static Price operator +(int tick, Price price);\npublic static Price operator +(Price price, int tick);\npublic static Price operator +(Price lhs, Price rhs);\n\npublic static Price operator -(int tick, Price price);\npublic static Price operator -(Price price, int tick);\npublic static Price operator -(Price lhs, Price rhs);\n\npublic static Price operator --(Price price);\npublic static Price operator ++(Price price);\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example, assume that the variable inst represents a valid instance for the Eurex FGBL-Jun20 futures contract. You could use the overloaded&nbsp;<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.Price.html#tt_net_sdk_Price_op_Addition_System_Int32_tt_net_sdk_Price_\">++<\/a>&nbsp;operator to increase the price by one tick.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Price p1 = Price.FromString(inst,\"114.73\");\nConsole.WriteLine(\"Price = \" + p1.ToString());\n\np1++;\nConsole.WriteLine(\"Price = \" + p1.ToString());\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The result of this code snippet would be:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Price = 114.73\nPrice = 114.74\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Because these operators return a&nbsp;<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.Price.html\">Price<\/a>&nbsp;object, you can create expressions such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Price p1 = Price.FromString(inst,\"114.73\");\nPrice p2 = (p1 + 1) * 2;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The expression&nbsp;<strong>(p1 + 1)<\/strong>&nbsp;calls the&nbsp;<strong>+(Price price, int tick)<\/strong>&nbsp;operator. Because this expression also returns a&nbsp;<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.Price.html\">Price<\/a>&nbsp;object, it then calls the&nbsp;<strong>*(Price price, int tick)<\/strong>&nbsp;operator to complete the evaluation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;Price&nbsp;class overloads common arithmetic operators that allow you to perform arithmetic on prices [&hellip;]<\/p>\n","protected":false},"author":2,"template":"wp-custom-template-single-doc-tt-net-sdk","meta":{"_acf_changed":true,"footnotes":""},"docs-category":[778],"class_list":["post-8071","doc","type-doc","status-publish","hentry","docs-category-an-in-depth-look-at-the-price-class"],"acf":[],"_links":{"self":[{"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc\/8071","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\/8071\/revisions"}],"wp:attachment":[{"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/media?parent=8071"}],"wp:term":[{"taxonomy":"docs-category","embeddable":true,"href":"https:\/\/library-test.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/docs-category?post=8071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}