We've done some testing and made a few changes to the cash management system. The previous cash management system only updated cash when orders were closed and the profit loss was applied to our account. This is fine with only one leverage value but gets tricky when more FX, equities and our new custom types are thrown together.

We've swapped it out with a new system which instantly updates the cash position when the asset is bought or sold, updating the buying power. This is simpler and gives better representations of the cash position over time. There will be no difference in your backtests results, just your Portfolio.Cash variable. This also means we will rename the "Equity" chart curve to "Portfolio Value" to better reflect that the chart is the Cash+Market-Value-of-Assets(Equity).

During testing we also discovered we need to better handle margin calls. This is especially relevant for shorting ill-liquid assets where its fairly easy to trigger a margin call. We'll be implementing this in the next week to automatically liquidate positions when the cash reserves available are less than X% on a margin. This percentage varies with brokers and stocks so we'll make it a flexible function.

Although its not fun work its making QuantConnect more robust as we march towards live trading! We hope you continue to enjoy QuantConnect.

Author