Hi Liam,
I added a few logs in the code. As you can see from the log, the securities being traded have default leverage of 2.0. In fact, each asset in QC has its own pre-defined leverage (2 for Equity, 50 for Forex and CFD, etc). In QC, the algorithms are also modeled with margin-modeling by default, but you can change it to cash account type. Check out “Cash and Brokerage Models” for more information.
The SetHoldings helper function sets a fraction of unlevered equity. In the beginning of the backtest period, the unlevered equity is the 10,000 cash. Later, this unlevered equity is the Total Portfolio Value. Therefore, SetHoldings(security, 1.0) would use 100% of the unlevered equity, so you see two orders being placed with total purchase of around 2x original cash since you have a default leverage of 2.0. If you modify the code to SetHoldings(security, 0.5), you will see the total purchase to be close to 10,000, evenly split between two stocks.
In addition, you might find this post useful! Hope this helps!