{"id":40055,"date":"2025-09-26T14:00:00","date_gmt":"2025-09-26T06:00:00","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=40055"},"modified":"2025-10-14T11:47:58","modified_gmt":"2025-10-14T03:47:58","slug":"tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/","title":{"rendered":"[TQuant From 0 to 1 &#8211; Day 5] Introduction to Order Placement Methods in the TQuant Lab Backtesting System"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full caption-align-center\"><img fetchpriority=\"high\" decoding=\"async\" width=\"6000\" height=\"4000\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash.jpg\" alt=\"\u00a0TQuant Lab \u56de\u6e2c\u7cfb\u7d71\u4e0b\u55ae\u65b9\u5f0f\u4ecb\u7d39\" class=\"wp-image-34495\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash.jpg 6000w, https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash-300x200.jpg 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash-1024x683.jpg 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash-150x100.jpg 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash-768x512.jpg 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash-1536x1024.jpg 1536w, https:\/\/www.tejwin.com\/wp-content\/uploads\/natasha-nguyen-IHIAvE842hY-unsplash-2048x1365.jpg 2048w\" sizes=\"(max-width: 6000px) 100vw, 6000px\" \/><figcaption class=\"wp-element-caption\">Photo by<a href=\"https:\/\/unsplash.com\/@nat13ng?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\" target=\"_blank\" rel=\"noopener\"> NATasha Nguyen<\/a> on<a href=\"https:\/\/unsplash.com\/photos\/white-and-black-labeled-box-IHIAvE842hY?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\" target=\"_blank\" rel=\"noopener\"> Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69d8f5f1ef4f1\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69d8f5f1ef4f1\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Introduction\" >Introduction<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#How_to_Use_in_Practice\" >How to Use in Practice<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Introduction_to_Order_Functions\" >Introduction to Order Functions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#orderasset_amount_%E2%80%94_Order_by_Share_Quantity\" >order(asset, amount)&nbsp;\u2014 Order by Share Quantity<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#order_targetasset_target_amount_%E2%80%94_Order_to_Target_Share_Quantity\" >order_target(asset, target_amount)&nbsp;\u2014 Order to Target Share Quantity<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#order_valueasset_value_%E2%80%94_Order_by_Capital_Amount\" >order_value(asset, value)&nbsp;\u2014 Order by Capital Amount<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#order_target_valueasset_target_value_%E2%80%94_Order_to_Target_Market_Value\" >order_target_value(asset, target_value)&nbsp;\u2014 Order to Target Market Value<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#order_percentasset_percent_%E2%80%94_Order_by_Portfolio_Weight\" >order_percent(asset, percent)&nbsp;\u2014 Order by Portfolio Weight<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#order_target_percentasset_target_percent_%E2%80%94_Order_to_Target_Portfolio_Weight\" >order_target_percent(asset, target_percent)&nbsp;\u2014 Order to Target Portfolio Weight<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Practical_Exercise\" >Practical Exercise<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#For_clarity_we_will_demonstrate_two_straightforward_strategies\" >For clarity, we will demonstrate two straightforward strategies:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Display_backtest_results_and_visualize_with_charts\" >Display backtest results and visualize with charts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Strategy_2\" >Strategy 2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Next_Article_%E2%80%93_TQuant_From_0_to_1_%E2%80%93_Day_6_link_coming_soon\" >Next Article \u2013 [TQuant From 0 to 1 &#8211; Day 6] (link coming soon)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Further_Reading\" >Further Reading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-5-introduction-to-order-placement-methods-in-the-tquant-lab-backtesting-system\/#Related_Links\" >Related Links<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In\u00a0TQuant backtesting and live trading, order functions serve as the central link between\u00a0strategy logic\u00a0and\u00a0capital management. Choosing the right order method not only makes the code cleaner and easier to read but also improves the efficiency of\u00a0risk control\u00a0and\u00a0portfolio rebalancing.<\/p>\n\n\n\n<p>TQuant provides order functions across\u00a0three dimensions\u00a0\u2014\u00a0<em>share quantity<\/em>,\u00a0<em>capital amount<\/em>, and\u00a0<em>portfolio weight<\/em>. For each dimension, there are two variants: a\u00a0basic order\u00a0and a\u00a0target order. In total, this gives us\u00a0six order placement methods. In the following sections, we will explain the features, parameters, and recommended applications of each.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Use_in_Practice\"><\/span>How to Use in Practice<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>As explained in previous articles, order functions are primarily implemented inside the&nbsp;<code>handle_data<\/code>&nbsp;function, where trading logic is defined. During backtesting, the&nbsp;<code>run_algorithm<\/code>&nbsp;function executes a loop that evaluates the conditions on each trading day to determine whether orders should be placed.<\/p>\n\n\n\n<p>This design allows you to set very detailed order logic, enabling strategies that can better adapt to real-world trading scenarios.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction_to_Order_Functions\"><\/span>Introduction to Order Functions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"orderasset_amount_%E2%80%94_Order_by_Share_Quantity\"><\/span><code>order(asset, amount)<\/code>&nbsp;\u2014 Order by Share Quantity<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Function:<\/strong>&nbsp;Buy or sell directly with a specified number of shares. Suitable when precise control of trade quantities is required.<\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>asset<\/code>: Target asset (e.g.,&nbsp;<code>symbol('Ticker')<\/code>)<\/li>\n\n\n\n<li><code>amount<\/code>: Number of shares (positive = buy, negative = sell)<\/li>\n<\/ul>\n\n\n\n<p><strong>Use Case Suggestion:<\/strong>&nbsp;When you know the fixed number of shares for each trade, or need to operate within a specific share range,&nbsp;<code>order<\/code>&nbsp;is the most straightforward choice.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"order_targetasset_target_amount_%E2%80%94_Order_to_Target_Share_Quantity\"><\/span><code>order_target(asset, target_amount)<\/code>&nbsp;\u2014 Order to Target Share Quantity<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Function:<\/strong>&nbsp;Automatically calculates&nbsp;<code>(target shares \u2212 current shares)<\/code>&nbsp;and places an order to adjust holdings to the target. Suitable for position-adjustment strategies that are guided by shareholding targets.<\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>asset<\/code>: Target security<\/li>\n\n\n\n<li><code>target_amount<\/code>: Final shareholding quantity<\/li>\n<\/ul>\n\n\n\n<p><strong>Use Case Suggestion:<\/strong>&nbsp;If the requirement is to \u201cadjust to a fixed number of shares,\u201d this function saves the effort of manually calculating the difference.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"order_valueasset_value_%E2%80%94_Order_by_Capital_Amount\"><\/span><code>order_value(asset, value)<\/code>&nbsp;\u2014 Order by Capital Amount<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Function:<\/strong>&nbsp;Buy or sell with a specified capital amount. The system estimates the number of shares based on the current day\u2019s price. Suitable for operations measured by capital allocation.<\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>asset<\/code>: Target security<\/li>\n\n\n\n<li><code>value<\/code>: Buy\/sell amount (positive = buy, negative = sell)<\/li>\n<\/ul>\n\n\n\n<p><strong>Use Case Suggestion:<\/strong>&nbsp;When the strategy involves a fixed monetary amount per trade, or when allocating based on a proportion of total portfolio capital,&nbsp;<code>order_value<\/code>&nbsp;is the most intuitive.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"order_target_valueasset_target_value_%E2%80%94_Order_to_Target_Market_Value\"><\/span><code>order_target_value(asset, target_value)<\/code>&nbsp;\u2014 Order to Target Market Value<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Function:<\/strong>&nbsp;Adjust holdings to reach the specified market value&nbsp;<code>(target value \u2212 current value)<\/code>. Convenient for rebalancing at the market-value level.<\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>asset<\/code>: Target security<\/li>\n\n\n\n<li><code>target_value<\/code>: Final holding market value<\/li>\n<\/ul>\n\n\n\n<p><strong>Use Case Suggestion:<\/strong>&nbsp;In multi-asset portfolios, when strict market-value rebalancing is required, this function is particularly useful.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"order_percentasset_percent_%E2%80%94_Order_by_Portfolio_Weight\"><\/span><code>order_percent(asset, percent)<\/code>&nbsp;\u2014 Order by Portfolio Weight<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Function:<\/strong>&nbsp;Buy or sell based on a proportion of the portfolio\u2019s net value. For example,&nbsp;<code>0.1<\/code>&nbsp;means buying a position equal to 10% of net portfolio value.<\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>asset<\/code>: Target security<\/li>\n\n\n\n<li><code>percent<\/code>: Proportion of portfolio (positive = buy, negative = sell)<\/li>\n<\/ul>\n\n\n\n<p><strong>Use Case Suggestion:<\/strong>&nbsp;When dynamically adjusting asset weights without needing exact shares or capital amounts,&nbsp;<code>order_percent<\/code>&nbsp;is the simplest option.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"order_target_percentasset_target_percent_%E2%80%94_Order_to_Target_Portfolio_Weight\"><\/span><code>order_target_percent(asset, target_percent)<\/code>&nbsp;\u2014 Order to Target Portfolio Weight<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Function:<\/strong>&nbsp;Adjusts the asset position to reach a target portfolio weight&nbsp;<code>(target weight \u2212 current weight)<\/code>. Ensures strict portfolio rebalancing.<\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>asset<\/code>: Target security<\/li>\n\n\n\n<li><code>target_percent<\/code>: Final target weight (range: \u22121.0 to 1.0)<\/li>\n<\/ul>\n\n\n\n<p><strong>Use Case Suggestion:<\/strong>&nbsp;In multi-asset portfolios or rotation strategies,&nbsp;<code>order_target_percent<\/code>&nbsp;is the most direct and intuitive tool for rebalancing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Practical_Exercise\"><\/span>Practical Exercise<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>By combining the content from&nbsp;<strong>TQuant Day 4<\/strong>, we can integrate the four major backtesting frameworks with the newly learned order placement methods to build a simple investment strategy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"For_clarity_we_will_demonstrate_two_straightforward_strategies\"><\/span>For clarity, we will demonstrate two straightforward strategies:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Buy-and-Hold 0050<\/strong><br>At the start of the backtest, buy 0050 and hold it until the end of the testing period.<\/li>\n\n\n\n<li><strong>Dollar-Cost Averaging (DCA) on 0050<\/strong><br>Invest 10,000 NTD every 30 trading days until the allocated capital is fully used.<\/li>\n<\/ol>\n\n\n\n<p>First, we need to&nbsp;<strong>import the backtesting data<\/strong>. This part will be explained in detail in the next article. For now, just understand that this step involves importing the stock data required for trading into the backtesting system.<\/p>\n\n\n\n<p><strong>Code snippet for importing backtest data:<\/strong><br>In this example, the backtesting period is set from&nbsp;<strong>2023-12-31 to 2024-12-31<\/strong>, covering approximately 252 trading days. Readers can add any stock symbols they wish to trade into the&nbsp;<code>pool<\/code>&nbsp;list, and their price\u2013volume data will be imported into the backtesting system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Display_backtest_results_and_visualize_with_charts\"><\/span>Display backtest results and visualize with charts<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"447\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\/pp-1024x447.png\" alt=\"\u00a0TQuant Lab \u56de\u6e2c\u7cfb\u7d71\u4e0b\u55ae\u65b9\u5f0f\u4ecb\u7d39\" class=\"wp-image-34490\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/pp-1024x447.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/pp-300x131.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/pp-150x66.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/pp-768x335.png 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/pp.png 1211w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Strategy_2\"><\/span>Strategy 2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"447\" src=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/\/gkgkg-1024x447.png\" alt=\"\u00a0TQuant Lab \u56de\u6e2c\u7cfb\u7d71\u4e0b\u55ae\u65b9\u5f0f\u4ecb\u7d39\" class=\"wp-image-34492\" srcset=\"https:\/\/www.tejwin.com\/wp-content\/uploads\/gkgkg-1024x447.png 1024w, https:\/\/www.tejwin.com\/wp-content\/uploads\/gkgkg-300x131.png 300w, https:\/\/www.tejwin.com\/wp-content\/uploads\/gkgkg-150x66.png 150w, https:\/\/www.tejwin.com\/wp-content\/uploads\/gkgkg-768x335.png 768w, https:\/\/www.tejwin.com\/wp-content\/uploads\/gkgkg.png 1211w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we introduced six order placement methods in Zipline, each with its own applicable scenarios, advantages, and limitations. The choice between precise share quantities, capital amounts, or portfolio weights should be guided by strategy logic and risk management requirements. Mastering the correct order functions not only streamlines backtesting code but also ensures accuracy in trade execution, thereby improving both the efficiency and quality of strategy development. Wishing you greater success in quantitative research and live trading applications!<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>We also welcome investors to explore further. In the future, we will continue to introduce how to build various indicators using the TEJ database and backtest their performance. Readers interested in trading backtests are encouraged to consider TQuant Lab\u2019s solutions, which leverage high-quality databases to help you develop trading strategies tailored to your needs.<\/p>\n\n\n\n<p>Disclaimer: This analysis is for reference only and does not constitute any product or investment advice.<\/p>\n\n\n\n<div style=\"border: 1px black; border-style: solid none; text-align: center; border-color: #296580; padding: 24px; margin-top: 24px; margin-bottom: 24px;\">\n<p style=\"margin: 0px; font-size: 24px; font-weight: bold; line-height: 1.5;\"><strong data-start=\"26\" data-end=\"104\">\u3010TQuant Lab Backtesting System\u3011Solve Your Quantitative Finance Pain Points<\/strong><\/p>\n<div style=\"margin-top: 32px;\"><a style=\"border: none; border-radius: 4px; background-color: #296580; color: white; font-size: 20px; width: fit-content; text-decoration: none; padding: 12px 30px 12px 30px;\" href=\"https:\/\/tquant.tejwin.com\/\" target=\"_blank\" rel=\"noopener\">Click here to register and start your free trial<\/a><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Next_Article_%E2%80%93_TQuant_From_0_to_1_%E2%80%93_Day_6_link_coming_soon\"><\/span>Next Article \u2013 [TQuant From 0 to 1 &#8211; Day 6] (link coming soon)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Further_Reading\"><\/span>Further Reading<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.tejwin.com\/en\/insight\/your-gateway-to-quantitative-trading\/\">\u3010TQuant : From 0 to 1 \u2013 Day 1\u3011 Your Gateway to Quantitative Trading: Become a Quant Expert with TQuant Lab, No Experience Needed!<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.tejwin.com\/en\/?post_type=insight&amp;p=31794\">\u3010TQuant : From 0 to 1 \u2013 Day 2\u3011 Avoid the Invisible Killers of Quantitative Trading: Use TQuant Lab to Precisely Manage Commission and Slippage, Giving Your Strategies the Edge!<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-3-building-a-comprehensive-investment-data-perspective-stock-pool-screening-and-data-retrieval-with-tejtoolapi-2\/\"><a href=\"https:\/\/www.tejwin.com\/en\/?post_type=insight&amp;p=31794\">\u3010<\/a>TQuant from 0 to 1 \u2013 Day 3<a href=\"https:\/\/www.tejwin.com\/en\/?post_type=insight&amp;p=31794\">\u3011<\/a>Building a Comprehensive Investment Data Perspective: Stock Pool Screening and Data Retrieval with TejToolAPI<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.tejwin.com\/en\/insight\/tquant-from-0-to-1-day-4-core-architecture-of-backtesting-what-are-the-key-settings-for-initialize\/\">\u3010TQuant : From 0 to 1 &#8211; Day 4\u3011 Core Architecture of Backtesting: What are the key settings for Initialize?<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Related_Links\"><\/span>Related Links<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/tejtw\/TQuant-Lab\" target=\"_blank\" rel=\"noreferrer noopener\">TQuant Lab GitHub<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/tquant.tejwin.com\" target=\"_blank\" rel=\"noreferrer noopener\">TQuant Lab Official Website<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In\u00a0TQuant backtesting and live trading, order functions serve as the central link between\u00a0strategy logic\u00a0and\u00a0capital management. Choosing the right order method not only makes the code cleaner and easier to read but also improves the efficiency of\u00a0risk control\u00a0and\u00a0portfolio rebalancing.<\/p>\n<p>TQuant provides order functions across\u00a0three dimensions\u00a0\u2014\u00a0share quantity,\u00a0capital amount, and\u00a0portfolio weight. For each dimension, there are two variants: a\u00a0basic order\u00a0and a\u00a0target order. In total, this gives us\u00a0six order placement methods. In the following sections, we will explain the features, parameters, and recommended applications of each.<\/p>\n","protected":false},"featured_media":34496,"template":"","tags":[2962,2987,2988,3008,3166,2428],"insight-category":[50,1356],"class_list":["post-40055","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-market-data","tag-quant","tag-quantitative-analysis","tag-tejapi-quant","tag-tquant-lab-2","tag-2428","insight-category-fintech","insight-category-tquant-lab-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/40055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/types\/insight"}],"version-history":[{"count":10,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/40055\/revisions"}],"predecessor-version":[{"id":40422,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/40055\/revisions\/40422"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/34496"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=40055"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=40055"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight-category?post=40055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}