Overall Statistics
namespace QuantConnect 
    *   QuantConnect University: Tick Template Algorithm
    *   Tick data has its own event handler since the data format is very different to typical tradebars. 
    *   This algorithm demonstrates processing tick events/
    *   Tick data is every single trade which occurred. It is much much more data and therefore roughly 100x slower.
    public class TickTemplateAlgorithm : QCAlgorithm
        public override void Initialize()
            SetStartDate(2014, 1, 1);         
            //Cash allocation
            //Add as many securities as you like. All the data will be passed into the event handler:
            AddSecurity(SecurityType.Equity, "SPY", Resolution.Tick);

        //Tick Data Event Handler
        public void OnData(Ticks data) 
            // A "Ticks" object is a string indexed, collection of LISTS. Each list 
            // contains all the ticks which occurred in that second. 
            // In backtesting they are all timestamped to the previous second, in 
            // live trading they are realtime and stream in one at a time.
            List<Tick> spyTicks = data["SPY"];
            if (!Portfolio.HoldStock) 
                int quantity = (int) Math.Floor(Portfolio.Cash / spyTicks[0].Price);
                Order("SPY",  quantity);
                Debug("Purchased SPY on " + Time.ToShortDateString());