{"id":411,"date":"2022-12-25T11:14:46","date_gmt":"2022-12-25T11:14:46","guid":{"rendered":"https:\/\/algomojo.com\/blog\/?p=411"},"modified":"2023-09-13T04:36:43","modified_gmt":"2023-09-13T04:36:43","slug":"what-is-placesmartorder-feature-in-algomojo-how-to-build-intelligent-trading-systems-using-placesmartorder","status":"publish","type":"post","link":"https:\/\/algomojo.com\/blog\/what-is-placesmartorder-feature-in-algomojo-how-to-build-intelligent-trading-systems-using-placesmartorder\/","title":{"rendered":"What is PlaceSmartOrder Feature in Algomojo? How to Build Intelligent Trading Systems using PlaceSmartOrder?"},"content":{"rendered":"\n<p>The world is moving towards Automated trading. However, bringing smartness to automated trading is the major trading requirement for most traders.<\/p>\n\n\n\n<p>Algomojo is an automated trading platform that offers a range of features and tools for traders to build and intelligent automation in their own trading platforms like Amibroker, Tradingview, Python , MT4. MT5. Excel etc. One such feature is the PlaceSmartOrder API function, which allows traders to build intelligent trading systems that can automatically place orders based on existing trade positions in the position book.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/i0.wp.com\/www.marketcalls.in\/wp-content\/uploads\/2022\/12\/Algomojo-Placesmartorder-1024x576.png?resize=1024%2C576&amp;ssl=1\" alt=\"\" class=\"wp-image-56868\"\/><\/figure>\n\n\n\n<p><strong>Why PlaceSmartOrder API?<\/strong><\/p>\n\n\n\n<p>1)Place Order Based on the Open Positions in the Position Book<\/p>\n\n\n\n<p>2)Ability to ignore exit trades if there are no Open Positions<\/p>\n\n\n\n<p>3)Ability to Place Larger Orders with Order Slicing feature<\/p>\n\n\n\n<p>4)Squareoff All Positions from the Position Book<\/p>\n\n\n\n<p><strong>Advantages of PlaceSmartOrder<\/strong><\/p>\n\n\n\n<p>1)Reduced Coding Effort for the Trading System Developers<\/p>\n\n\n\n<p>2)Almost<a href=\"https:\/\/algomojo.com\/blog\/tradingview-smart-order-strategy-automation-without-writing-any-single-line-of-code\/\">&nbsp;zero coding effort for the Traders who want to implement tradingview strategies<\/a><\/p>\n\n\n\n<p><strong>What PlaceSmartOrder Does?<\/strong><\/p>\n\n\n\n<p>PlaceSmartOrder is an intelligent API control used to match the position book of the trading account<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Action (API Parameter)<\/strong><\/td><td><strong>Quantity (API Parameter)<\/strong><\/td><td><strong>Position Size (API Parameter)<\/strong><\/td><td><strong>Current Open Position (Trading Account)<\/strong><\/td><td><strong>Action Taken by Algomojo (Execution)<\/strong><\/td><\/tr><tr><td>BUY<\/td><td>100<\/td><td>0<\/td><td>0<\/td><td>No Open Position Found. Hence Buy +100 qty<\/td><\/tr><tr><td>BUY<\/td><td>100<\/td><td>100<\/td><td>-100<\/td><td>BUY 200 to match the Open Position given in API Parameter<\/td><\/tr><tr><td>BUY<\/td><td>100<\/td><td>100<\/td><td>100<\/td><td>No Action was Taken as the Position is already matched<\/td><\/tr><tr><td>BUY<\/td><td>100<\/td><td>200<\/td><td>100<\/td><td>BUY +100 to match the Open Position given in API Parameter<\/td><\/tr><tr><td>SELL<\/td><td>100<\/td><td>0<\/td><td>0<\/td><td>No Open Position Found. Hence SELL -100 qty<\/td><\/tr><tr><td>SELL<\/td><td>100<\/td><td>-100<\/td><td>+100<\/td><td>SELL 200 to match the Open Position given in API Parameter<\/td><\/tr><tr><td>SELL<\/td><td>100<\/td><td>-100<\/td><td>-100<\/td><td>No Action was Taken as the Position is already matched<\/td><\/tr><tr><td>SELL<\/td><td>100<\/td><td>-200<\/td><td>-100<\/td><td>SELL \u2013 100 to match the Open Position given in API Parameter<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>How to Call PlaceSmartOrder API?<\/strong><\/p>\n\n\n\n<p><strong>PlaceSmartOrder API endpoint url<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-http\">https:\/\/amapi.algomojo.com\/v1\/PlaceSmartOrder<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>PlaceSmartOrder API Sample Request for Placing Smart Orders<\/strong><\/p>\n\n\n\n<p>Here is a sample JSON message for placing 100 qty when there are no open positions.<\/p>\n\n\n\n<p>1)If there are no open positions found in the positionbook then it places the quantity 100 shares<br>2)If there are open positions that exist then the position_size (Value = 0) will be matched to the positionbook that is any open position (long\/short) will be squared off and brings the current open position to zero quantity.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\">{\n    &quot;api_key&quot;:&quot;{your_api_key}&quot;,\n    &quot;api_secret&quot;:&quot;{your_api_secret}&quot;,\n    &quot;data&quot;:\n    {\n        &quot;broker&quot;:&quot;up&quot;,\n        &quot;strategy&quot;:&quot;Smart Strategy&quot;,\n        &quot;exchange&quot;:&quot;NSE&quot;,\n        &quot;symbol&quot;:&quot;RELIANCE-EQ&quot;,\n        &quot;action&quot;:&quot;BUY&quot;,\n        &quot;product&quot;:&quot;MIS&quot;,\n        &quot;pricetype&quot;:&quot;MARKET&quot;,\n        &quot;quantity&quot;:&quot;100&quot;,\n        &quot;price&quot;:&quot;0&quot;,\n        &quot;position_size&quot;:&quot;0&quot;,\n        &quot;trigger_price&quot;:&quot;0&quot;,\n        &quot;disclosed_quantity&quot;:&quot;0&quot;,\n        &quot;amo&quot;:&quot;NO&quot;,\n        &quot;splitorder&quot;:&quot;NO&quot;,\n        &quot;split_quantity&quot;:&quot;1&quot;\n    }\n\n}      <\/code><\/pre>\n\n\n\n<p><strong>Reversing Position from Long to Short<\/strong><\/p>\n\n\n\n<p>If already there are long open positions say +100 shares then setting the position_size to -100 reverses the trade and matches the position book to net short position<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\">{\n    &quot;api_key&quot;:&quot;{your_api_key}&quot;,\n    &quot;api_secret&quot;:&quot;{your_api_secret}&quot;,\n    &quot;data&quot;:\n    {\n        &quot;broker&quot;:&quot;up&quot;,\n        &quot;strategy&quot;:&quot;Smart Strategy&quot;,\n        &quot;exchange&quot;:&quot;NSE&quot;,\n        &quot;symbol&quot;:&quot;RELIANCE-EQ&quot;,\n        &quot;action&quot;:&quot;BUY&quot;,\n        &quot;product&quot;:&quot;MIS&quot;,\n        &quot;pricetype&quot;:&quot;MARKET&quot;,\n        &quot;quantity&quot;:&quot;100&quot;,\n        &quot;price&quot;:&quot;0&quot;,\n        &quot;position_size&quot;:&quot;-100&quot;,\n        &quot;trigger_price&quot;:&quot;0&quot;,\n        &quot;disclosed_quantity&quot;:&quot;0&quot;,\n        &quot;amo&quot;:&quot;NO&quot;,\n        &quot;splitorder&quot;:&quot;NO&quot;,\n        &quot;split_quantity&quot;:&quot;1&quot;\n    }\n\n}     <\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Reversing Position from Short to Long<\/strong><\/p>\n\n\n\n<p>If already there are short open positions say -100 shares then setting the position_size to +100 reverses the trade and matches the position book to net long position<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\">{\n    &quot;api_key&quot;:&quot;{your_api_key}&quot;,\n    &quot;api_secret&quot;:&quot;{your_apAi_secret}&quot;,\n    &quot;data&quot;:\n    {\n        &quot;broker&quot;:&quot;up&quot;,\n        &quot;strategy&quot;:&quot;Smart Strategy&quot;,\n        &quot;exchange&quot;:&quot;NSE&quot;,\n        &quot;symbol&quot;:&quot;RELIANCE-EQ&quot;,\n        &quot;action&quot;:&quot;BUY&quot;,\n        &quot;product&quot;:&quot;MIS&quot;,\n        &quot;pricetype&quot;:&quot;MARKET&quot;,\n        &quot;quantity&quot;:&quot;100&quot;,\n        &quot;price&quot;:&quot;0&quot;,\n        &quot;position_size&quot;:&quot;100&quot;,\n        &quot;trigger_price&quot;:&quot;0&quot;,\n        &quot;disclosed_quantity&quot;:&quot;0&quot;,\n        &quot;amo&quot;:&quot;NO&quot;,\n        &quot;splitorder&quot;:&quot;NO&quot;,\n        &quot;split_quantity&quot;:&quot;1&quot;\n    }\n\n}      <\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Adding to the long-existing position<\/strong><\/p>\n\n\n\n<p>If already there are long open positions say +100 shares then setting the position_size to +200 adds another 200 shares to the existing long position. Overall net quantity becomes +300 in this case.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\">{\n    &quot;api_key&quot;:&quot;{your_api_key}&quot;,\n    &quot;api_secret&quot;:&quot;{your_api_secret}&quot;,\n    &quot;data&quot;:\n    {\n        &quot;broker&quot;:&quot;up&quot;,\n        &quot;strategy&quot;:&quot;Smart Strategy&quot;,\n        &quot;exchange&quot;:&quot;NSE&quot;,\n        &quot;symbol&quot;:&quot;RELIANCE-EQ&quot;,\n        &quot;action&quot;:&quot;BUY&quot;,\n        &quot;product&quot;:&quot;MIS&quot;,\n        &quot;pricetype&quot;:&quot;MARKET&quot;,\n        &quot;quantity&quot;:&quot;100&quot;,\n        &quot;price&quot;:&quot;0&quot;,\n        &quot;position_size&quot;:&quot;200&quot;,\n        &quot;trigger_price&quot;:&quot;0&quot;,\n        &quot;disclosed_quantity&quot;:&quot;0&quot;,\n        &quot;amo&quot;:&quot;NO&quot;,\n        &quot;splitorder&quot;:&quot;NO&quot;,\n        &quot;split_quantity&quot;:&quot;1&quot;\n    }\n\n}     <\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Reducing from the existing long existing position<\/strong><\/p>\n\n\n\n<p>If already there are long open positions say +100 shares then setting the position_size to +50 reduces 50 shares from the existing long position. Overall net quantity becomes +50 in this case.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\">{\n    &quot;api_key&quot;:&quot;{your_api_key}&quot;,\n    &quot;api_secret&quot;:&quot;{your_api_secret}&quot;,\n    &quot;data&quot;:\n    {\n        &quot;broker&quot;:&quot;up&quot;,\n        &quot;strategy&quot;:&quot;Smart Strategy&quot;,\n        &quot;exchange&quot;:&quot;NSE&quot;,\n        &quot;symbol&quot;:&quot;RELIANCE-EQ&quot;,\n        &quot;action&quot;:&quot;BUY&quot;,\n        &quot;product&quot;:&quot;MIS&quot;,\n        &quot;pricetype&quot;:&quot;MARKET&quot;,\n        &quot;quantity&quot;:&quot;100&quot;,\n        &quot;price&quot;:&quot;0&quot;,\n        &quot;position_size&quot;:&quot;50&quot;,\n        &quot;trigger_price&quot;:&quot;0&quot;,\n        &quot;disclosed_quantity&quot;:&quot;0&quot;,\n        &quot;amo&quot;:&quot;NO&quot;,\n        &quot;splitorder&quot;:&quot;NO&quot;,\n        &quot;split_quantity&quot;:&quot;1&quot;\n    }\n\n}     <\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Squaring off Open Positions<\/strong><\/p>\n\n\n\n<p>Irrespective of any open positions the following JSON data will bring the open positions to zero. In other words existing positions will be squared off irrespective of net long\/short positions. In this example, both quantity and position_size are set to zero.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\">{\n    &quot;api_key&quot;:&quot;{your_api_key}&quot;,\n    &quot;api_secret&quot;:&quot;{your_api_secret}&quot;,\n    &quot;data&quot;:\n    {\n        &quot;broker&quot;:&quot;up&quot;,\n        &quot;strategy&quot;:&quot;Smart Strategy&quot;,\n        &quot;exchange&quot;:&quot;NSE&quot;,\n        &quot;symbol&quot;:&quot;RELIANCE-EQ&quot;,\n        &quot;action&quot;:&quot;BUY&quot;,\n        &quot;product&quot;:&quot;MIS&quot;,\n        &quot;pricetype&quot;:&quot;MARKET&quot;,\n        &quot;quantity&quot;:&quot;0&quot;,\n        &quot;price&quot;:&quot;0&quot;,\n        &quot;position_size&quot;:&quot;0&quot;,\n        &quot;trigger_price&quot;:&quot;0&quot;,\n        &quot;disclosed_quantity&quot;:&quot;0&quot;,\n        &quot;amo&quot;:&quot;NO&quot;,\n        &quot;splitorder&quot;:&quot;NO&quot;,\n        &quot;split_quantity&quot;:&quot;1&quot;\n    }\n\n}    <\/code><\/pre>\n\n\n\n<p>For more detailed information visit the&nbsp;<a href=\"https:\/\/algomojo.com\/docs\/api-documentation\/\">Algomojo \u2013 Arrow API Documentation<\/a>&nbsp;and the appendix section for the possible parameters to set in the JSON format.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Algomojo is an automated trading platform that offers a range of features and tools for traders to build and intelligent automation in their own trading platforms like Amibroker, Tradingview, Python , MT4. MT5. Excel etc. One such feature is the PlaceSmartOrder API function, which allows traders to build intelligent trading systems that can automatically place orders based on existing trade positions in the position book.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[2],"tags":[180,163,170],"_links":{"self":[{"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/posts\/411"}],"collection":[{"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/comments?post=411"}],"version-history":[{"count":8,"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/posts\/411\/revisions"}],"predecessor-version":[{"id":596,"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/posts\/411\/revisions\/596"}],"wp:attachment":[{"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/media?parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/categories?post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/algomojo.com\/blog\/wp-json\/wp\/v2\/tags?post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}