I am new to the QuantConnect and I am compiling on the deskop via VS.NET 2013. I am trying to do two things

1 - I connect to local data for equity aapl in the folder Equity\usa data.

2 - I am trying to create a customdata feed via Yahoo

I have found that none of them has triggered the OnData event at all on the debug mode. It does not seem to pass the symbol into the custom data feed as well. 

 

I just copied from the sample codes and also I put all codes in the initialize routine. 

 

        public override void Initialize()
        {
            SetStartDate(2011, 9, 13);
            SetEndDate(DateTime.Now.Date.AddDays(-1));
            SetCash(100000);
            //AddData<Yahoo>("SPY", Resolution.Daily);
            //Define the symbol and "type" of our generic data:
            AddSecurity(SecurityType.Equity, "aapl", Resolution.Daily);
        }
        //Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
        public void OnData(TradeBars data)
        {
            // "TradeBars" object holds many "TradeBar" objects: it is a dictionary indexed by the symbol:
            // 
            //  e.g.  data["MSFT"] data["GOOG"]

            if (!Portfolio.HoldStock)
            {
                int quantity = (int)Math.Floor(Portfolio.Cash / data["SPY"].Close);

                //Order function places trades: enter the string symbol and the quantity you want:
                Order("SPY", quantity);

                //Debug sends messages to the user console: "Time" is the algorithm time keeper object 
                Debug("Purchased SPY on " + Time.ToShortDateString());

                //You can also use log to send longer messages to a file. You are capped to 10kb
                //Log("This is a longer message send to log.");
            }
        }

Author