Back

History() not working with futures data?

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)))

Update Backtest








Well, you can't see the logs, but it shows that the object I'm printing contains no data.  Any idea what the issue is?  Is the API not supported for futures?

0

Sorry there was a temporary issue with the backtesting from 2-4pm today; its been resolved.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed