Hello,
I'm not sure why this algorithm is sending so many 1, -1, and other small orders. Do you now how I can stop those small orders from trickling through?
Thanks!
Sean
QUANTCONNECT COMMUNITY
Hello,
I'm not sure why this algorithm is sending so many 1, -1, and other small orders. Do you now how I can stop those small orders from trickling through?
Thanks!
Sean
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Yuxin Guan
Hello Sean
The order quantity depends on the cash in hand, the unit price for target securities, and the number of securities in the basket. To increase cash in hand, we could change
self.SetCash(100000)
toself.SetCash(1000000)
. In order to choose securities with lower unit prices, we can add conditions to screen out securities with a price of less than $100. We could also limit the number of target securities from 100 to 50. These two goals can be achieved by updating code inself.CoarseSelectionFunction
:sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=False) filtered = [ x.Symbol for x in sortedByDollarVolume x.Price < 100] return filtered[:50]
Please check this page for more variation about universe selection.
I attached a backtest updating the code provided for the demonstration. Hope this could help.
Best,
Yuxin Guan
S O'Keeffe
Hi Yuxin,
Thank you for your response! I'm OK with the SetCash and the price of the securities being traded. The question I was actually wondering about is why I'm seeing so many orders like these in the above backtest:
2020-05-18T13:59:23ZCCL14.43-4MarketFilled-57.722020-05-18T13:59:23ZUAL22.71-1MarketFilled-22.71From what I understand, 3% is the default portfolio percent allocated to each insight or order with the "AccumulativeInsightPortfolioConstructionModel." But the total value of each of these trades is $57 or $22, very very far below that 3% default portfolio percent. Do you know why the algorithm is sending orders so far below that 3% default?
Thanks,
Sean
S O'Keeffe
Hi Yuxin,
Sorry those two example orders didn't come through correctly! The two example orders that you can see if you clone the above algorithm are these:
Time Symbol Price Quantity Type Status Value
2020-05-18T13:59:23Z CCL 14.43 -4 Market Filled -57.72
2020-05-18T13:59:23Z UAL 22.71 -1 Market Filled -22.71
Thanks,
Sean
Derek Melchin
Hi Sean,
The small orders we see are because the AccumulativeInsightPortfolioConstructionModel adjusts the weight of each security in the portfolio with an active long Insight to be 3% on each rebalance. See the source code and the attached backtest for reference. To stop this behavior, we need to implement a custom PCM. To do so, I recommend reviewing our portfolio construction documentation and the custom models in our GitHub repo.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
S O'Keeffe
Hi Derek,
Ah OK I missed the fact that this PCM also rebalanced every time a new insight is generated. Thank you so much as always!
Thank you,
Sean
S O'Keeffe
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!