Hi, I have a question regarding SetHoldings and Portfolio Quantity. Im not sure if im missing something basic here, but the following code beollow will result in Portfolio["SPY"].Quantity will be 0.           

SetCash(3000);

  

SetHoldings("SPY", 1.0, true); Log("Active Pos SPY " + Portfolio["SPY"].Quantity);

Logfile: 

2016-02-01 00:00:00 Launching analysis for d7cc9af835c9d21ba2fddd76d4f2cd73 with LEAN Engine v2.2.0.2.733 2016-02-02 00:00:00 Converted OrderID: 1 into a MarketOnOpen order. 2016-02-02 00:00:00 Active Pos SPY 0 2016-08-02 00:00:00 Algorithm Id:(d7cc9af835c9d21ba2fddd76d4f2cd73) completed in 7.57 seconds at 0k data points per second. Processing total of 566 data points. 2016-08-02 00:00:00 Your log was successfully created and can be downloaded from: http://data.quantconnect.com/backtests/24380/356187/d7cc9af835c9d21ba2fddd76d4f2cd73-log.txt

Author