When a stock is removed from the universe, what happens to the updates to the technical indicators?
Does the stock remain in the list of securities and indicators for the stock are still automatically updated?
QUANTCONNECT COMMUNITY
When a stock is removed from the universe, what happens to the updates to the technical indicators?
Does the stock remain in the list of securities and indicators for the stock are still automatically updated?
Hi Valery T ,
When a security is removed from the universe, the data subscription is removed, and, consequently, there is no data to update the consolidator/indicator.
Please note that when we are working with universe selection, we should keep a reference of the consolidator and remove if from the subscription manager. For example:
class SymbolData:
def __init__(self, algorithm, symbol):
self.algorithm = algorithm
self.symbol = symbol
self.sma = SimpleMovingAverage(7)
# Create Daily Consolidator and Register the indicators for automatic updates
self.consolidator = algorithm.ResolveConsolidator(symbol, Resolution.Daily)
algorithm.RegisterIndicator(symbol, self.sma, self.consolidator)
def Clean(self):
'''Clean: remove consolidator'''
self.algorithm.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)
Because when the algorithm re-subscribe to a given security, it will create a new consolidator/indicator pair with the same characteristics.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!