{"id":8070,"date":"2025-09-04T23:21:58","date_gmt":"2025-09-05T04:21:58","guid":{"rendered":"https:\/\/librarytestdev.wpenginepowered.com\/?post_type=doc&#038;p=8070"},"modified":"2025-09-04T23:23:51","modified_gmt":"2025-09-05T04:23:51","slug":"price-class-comparison-operators","status":"publish","type":"doc","link":"https:\/\/library-staging.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-comparison-operators\/","title":{"rendered":"Price class: comparison 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 comparison operators that allow you to compare prices with one another in a variety of formats.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public static bool operator &lt;(double lhs, Price rhs)\npublic static bool operator &lt;(int lhs, Price rhs)\npublic static bool operator &lt;(Price lhs, double rhs)\npublic static bool operator &lt;(Price lhs, int rhs)\npublic static bool operator &lt;(Price lhs, Price rhs)\n\npublic static bool operator &lt;=(double lhs, Price rhs)\npublic static bool operator &lt;=(int lhs, Price rhs)\npublic static bool operator &lt;=(Price lhs, double rhs)\npublic static bool operator &lt;=(Price lhs, int rhs)\npublic static bool operator &lt;=(Price lhs, Price rhs)\n\npublic static bool operator ==(double lhs, Price rhs)\npublic static bool operator ==(int lhs, Price rhs)\npublic static bool operator ==(Price lhs, double rhs)\npublic static bool operator ==(Price lhs, int rhs)\npublic static bool operator ==(Price lhs, Price rhs)\n\npublic static bool operator &gt;(double lhs, Price rhs)\npublic static bool operator &gt;(int lhs, Price rhs)\npublic static bool operator &gt;(Price lhs, double rhs)\npublic static bool operator &gt;(Price lhs, int rhs)\npublic static bool operator &gt;(Price lhs, Price rhs)\n\npublic static bool operator &gt;=(double lhs, Price rhs)\npublic static bool operator &gt;=(int lhs, Price rhs)\npublic static bool operator &gt;=(Price lhs, double rhs)\npublic static bool operator &gt;=(Price lhs, int rhs)\npublic static bool operator &gt;=(Price lhs, Price rhs)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example, assume that the variable&nbsp;<strong>inst<\/strong>&nbsp;represents a valid&nbsp;<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.InstrumentDetails.html\">InstrumentDetails<\/a>&nbsp;instance for the Eurex FGBL-Mar20 futures contract. You could use the overloaded == operator to indicate whether two prices are equal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Price p1 = Price.FromString(inst,\"114.73\");\n\nif (p1 == 11473)\n{\n  Console.WriteLine(\"These are equal.\");\n}\nelse\n{\n  Console.WriteLine(\"These are not equal.\");\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the price on the left-hand-side (lhs) of the comparison operator is a&nbsp;<a href=\"\/tt-net-sdk\/api\/tt_net_sdk.Price.html\">Price<\/a>&nbsp;object and the price on the right-hand-side (rhs) of the comparison operator is in ticks format (an integer). Therefore, TT .NET SDK calls:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bool operator ==(Price lhs, int rhs)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">which produces the following result:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>These are equal.<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;Price&nbsp;class overloads common comparison operators that allow you to compare prices with one anot [&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-8070","doc","type-doc","status-publish","hentry","docs-category-an-in-depth-look-at-the-price-class"],"acf":[],"_links":{"self":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/doc\/8070","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\/8070\/revisions"}],"wp:attachment":[{"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/media?parent=8070"}],"wp:term":[{"taxonomy":"docs-category","embeddable":true,"href":"https:\/\/library-staging.tradingtechnologies.com\/ja\/wp-json\/wp\/v2\/docs-category?post=8070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}