Overall Statistics
from QuantConnect.Data.Market import TradeBar
from QuantConnect import Securities

class testyou(QCAlgorithm):
	
    def Initialize(self):
		# Set the cash we'd like to use for our backtest
		# This is ignored in live trading 
		self.SetCash(100000)
		
		# Start and end dates for the backtest.
		# These are ignored in live trading.
		self.SetStartDate(2012,1,1)
		self.SetEndDate(2012,1,11)
		self.sym="SPY"
		
		# Add assets you'd like to see
		self.spy = self.AddEquity(self.sym, Resolution.Daily).Symbol  # for Alex code for tick values.. to use minimum tick values need to remove .Symbol
		
		# ROR..
		self.count = 0 	# My counter
		self.rWindow = RollingWindow[TradeBar](2)	# Rolling window (yesterday value)
		
		# Symbol properties..
		#self.p = self.spy.SymbolProperties.MinimumPriceVariation
		
		
		
    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
        self.Log(">>> OnData called..")
        #self.Log("tick size = " + str(self.p))
        
        # Add SPY TradeBar in rollling window
        self.rWindow.Add(data[self.sym])
        bar = data[self.sym]

	    # Place open and close orders..
        self.MarketOnOpenOrder(self.sym, 1, "hello")
        self.MarketOnCloseOrder(self.sym, -1, "goodbye")
       
            
        self.Log("OnData exited >>>")
        self.Log(" ")