mhallsmoore / qstrader

QuantStart.com - QSTrader backtesting simulation engine.
https://www.quantstart.com/qstrader/
MIT License
2.79k stars 842 forks source link

Scaled down order in simulated broker mentioned but not implemented? #382

Open pmkenny1234 opened 1 year ago

pmkenny1234 commented 1 year ago

On line 584 of simulated_broker.py (in _execute_order()), there is a comment about scaling down the order if there isn't available cash. However, a few lines later scaled_quantity is set to just order.quantity. Is it desired that the scaling actually happen? I'm definitely seeing a negative cash balance commonly when running simulations, which makes sense since orders may be placed well before they're actually filled.