Hello,
Is it possible to update an indicator (fisher transform in this case) using history?
I found that history doesn't return TradeBars (Ibasedatabar) object.
QUANTCONNECT COMMUNITY
Hello,
Is it possible to update an indicator (fisher transform in this case) using history?
I found that history doesn't return TradeBars (Ibasedatabar) object.
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.
Douglas Stridsberg
Yes, you absolutely can.
Using RegisterIndicator will bind an indicator to a particular consolidator. Any history pushed to this consolidator will then, in turn, update the indicator.
If you show us an example of what you're trying to achieve, it would be easier to guide you.
Also, regarding what History returns - you can normally cast the return of History into what you need.
Armin Ranjbar
Hi Douglas,
Thank you for the answer! this is what I'm trying to do, fisher is already registered, but how can I make it 'warmup' using a history object?
def OnSecuritiesChanged(self, algorithm, changes): # clean up data for removed securities symbols = [x.Symbol for x in changes.RemovedSecurities] if len(symbols) > 0: for subscription in algorithm.SubscriptionManager.Subscriptions: if subscription.Symbol in symbols: self.symbolDataBySymbol.pop(subscription.Symbol, None) subscription.Consolidators.Clear() # initialize data for added securities addedSymbols = [ x.Symbol for x in changes.AddedSecurities if x.Symbol not in self.symbolDataBySymbol] if len(addedSymbols) == 0: return history = algorithm.History(addedSymbols, self.period, self.resolution) for symbol in addedSymbols: Fisher = FisherTransform(self.period) algorithm.RegisterIndicator(symbol, Fisher, self.resolution) if not history.empty: ticker = SymbolCache.GetTicker(symbol) if ticker not in history.index.levels[0]: Log.Trace(f'FisherAlphaModel.OnSecuritiesChanged: {ticker} not found in history data frame.') continue #for tuple in history: # algorithm.Debug(history) Fisher.Update()
Douglas Stridsberg
I don't have a working alpha environment to test right now but L33 should simply be passing the right information into Update. Check out this example algo and check the auto-complete to see what inputs are required for the Update of Fisher. It's likely to be a QuoteBar (or other bar derived from IBaseDataBar), which you can create from the history tuple.
Armin Ranjbar
Thank you for the answer!
Yeah it was WIP, the difference between fisher and RSI (in your example) is that fisher requires Ibasedatabar, which i'm still clueless on how to make...
Armin Ranjbar
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.
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!