I am new to QC and hope to be continuing here for foreseeable future. While i am getting the hang of architecture, i am trying to fetch the price for ES.


In initialize, i have the following:

self.future = self.AddSecurity(
SecurityType.Future, 'ES', Resolution.Tick)

self.future.SetFilter(lambda x: x.FrontMonth())
self.future_ES = self.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute)

On onData block, i wrote something like;
if self.Time.microsecond == 0 and self.Time.second == 0:
self.barOpen = 0
self.barClose = 0
self.barVolume = 0
self.Debug('Calling new function {}'.format(float(self.Securities[self.future_ES].Price)))

And a function:
def OnDataGetFutureData(self, slice):
"""Check for future open close volume for charting."""
for chain in slice.FutureChains:
for contract in chain.Value:
self.barOpen = self.Securites[contract.Symbol].Open
self.barClose = self.Securites[contract.Symbol].Close
self.barVolume = self.Securites[contract.Symbol].Volume
self.Debug('Open: {} Close: {} Volume:{}'.format(self.barOpen,self.barClose,self.barVolume))

Unfortunately, I am getting type error on self.Securities[self.future_ES].price and if i comment that, the function is not setting the values properly.

I did try looking into documentation with no avail. I started working on QC only few days ago. Any help would be appreciated.