Below is a subtract of my code, the "prices" list consists of the timestamp as an index, followed by the stock price for each stock in context.stocks. So far so good but once I run the: price_list = prices[stock].tolist() line the timestamp data gets lost and I can only see the stock price in price_list without any indication on what date/time that price was actually valid.
My first question is, why does the tolist not also include the timestamp ?
My second question what is a proper way of getting the appropiate date/time for the price in price_list ?
def initialize(context):
context.stocks = [sid(8554), sid(24)]
def handle_data(context, data):
prices = data.history(context.stocks, 'price', 100, '1d')
for stock in context.stocks:
price_list = prices[stock].tolist()
.....