Would the following code successfully rebalance portfolio each hour randomly according to the random portfolio weights that are sampled (and then normalized)? I think that setHoldings doesn't work incrementally hence causes errors if not being liquidated before each rebalancing. However, that would mean extreme commission expenditure if the rebalancing is done somehow in high frequency. Please, enlighten me on the right way of doing this incrementally. I have also tried to do so manually by using CalculateOrderQuantity and then placing market orders. However, that also failed the same way the setHoldings did. Although the shared code supposed to put all portfolio into these currencies. The report says that +90% of the portfolio were in cash. Also, I never used more than 1.0 leverage but the report states that the leverage varies up to 150. I would welcome if anybody can help me.

https://www.quantconnect.com/terminal/processReports/get/pdf/c8cb4b9a8cfa0a84e1599cd5be549fe7

 

https://www.quantconnect.com/reports/c8cb4b9a8cfa0a84e1599cd5be549fe7