Any idea why my log message (which is trying to print the results of History() on a futures contract) returns no data?
 

from datetime import timedelta from collections import deque class TestAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2017, 8, 2) self.SetEndDate(2017, 8, 3) self.SetCash(25000) # Subscribe and set our expiry filter fr the futures chain # get contracts expring in 15 to 180 days self.soybeans = self.AddFuture(Futures.Grains.Soybeans, Resolution.Hour) self.soybeans.SetFilter(timedelta(15), timedelta(180)) def OnData(self, slice): # only print out data for settlement (which occurs at 2:15 PM ET) if not (self.Time.hour == 14 and self.Time.minute == 15): return data = dict() # iterate over each futures chain we are getting data for for chain in slice.FutureChains: # sort the contracts by open interest (highest to lowest, so reverse the default sort order) # get the first contract in the sorted list to get the month we want data on front = sorted(chain.Value, key = lambda x: x.OpenInterest, reverse=True)[0] self.Log(str(self.History(front.Symbol, 5, Resolution.Hour)))

Author