How to call a single bar of data?

How would i go about calling data from a single tradebar back?

The following line throws an error

slices = self.History(["EURUSD"], 1, Resolution.Daily)

u'the label [EURUSD] is not in the [index]

Update Backtest

Did you add EURUSD to your Securities in the Initialize() ? Best is to share your algo to see what your are doing.


import numpy as np

class BasicTemplateAlgorithm(QCAlgorithm):
'''Basic template algorithm simply initializes the date range and cash'''

def Initialize(self):

self.current = None
self.SetStartDate(2015,10,07) #Set Start Date
self.SetEndDate(2016,10,11) #Set End Date
self.SetCash(100000) #Set Strategy Cash

self.AddForex("EURUSD", Resolution.Daily)
self.Debug("numpy test >>> print numpy.pi: " + str(np.pi))

def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.

slices = self.History(["EURUSD"], 1, Resolution.Daily)

Just basic stuff


Update Backtest


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.


This discussion is closed