I am trying to optimize my data usage so I can get as long of a backtest as possible with as many stocks as possible. There are a couple of different situations that I think I can save data with:

1) I've got about 10 stocks that I only need daily historical data, but when I execute the orders I need the last minute price, just once a day, to calculate how many shares I can buy of each stock based on risk management principles. I am currently subscribed to recieve minute data for these stocks which Is a waste I think

Can I get an up to the minute price with a daily data subcription?

2) I have a universe spitting out many different stocks each day (currently 50, would like to push this to >150), I only need the price every 5 minutes. I know I can consolidate individual stocks with self.SubscriptionManager.AddConsolidator(stock, consolidator) but how do I apply that to the stocks being put out by a universe and does that even save me any data?

This is what I am trying:

def Initialize(self): # ...other initialization... self.consolidator = TradeBarConsolidator(5) self.consolidator.DataConsolidated += self.OnDataConsolidated def OnSecuritiesChanged(self, changes): self.changes = changes # if we have no changes, do nothing if not self.changes == SecurityChanges.None: for security in self.changes.AddedSecurities: self.SubscriptionManager.AddConsolidator(security.Symbol, self.consolidator)

 

Related question:

What price does self.Securities[security].Price return (which interval)? The last seen price at the subscription interval, or the consolidated interval? What about self.History(security, 1, Resolution.Minute)['close'][0]?