Back

AddUniverse(universe, fineSelector) got object is not callable

Hi I see in source code you can do this 

public void AddUniverse(   
    Universe universe, Func<IEnumerable<FineFundamental>,    
    IEnumerable<Symbol>> fineSelector)

 

So I did this
self.AddUniverse(self.Universe.Index.QC500, self.FineSelectionFunction)

but I got "object is not callable" error, so I assume the QC500 Universe object is wrongly identified as a coarseSelector function...?

Any alternative to use QC500 universe + fineSelector? or how to fix the code? Thanks! 

 

Error trace back:

System.Exception: TypeError : object is not callable ---> Python.Runtime.PythonException: TypeError : object is not callable
at Python.Runtime.Dispatcher.Dispatch (System.Collections.ArrayList args) [0x00018] in :0
at __System_Func`2[[System_Collections_Generic_IEnumerable`1[[QuantConnect_Data_UniverseSelection_CoarseFundamental, QuantConnect_Common, Version=2_4_0_0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4_0_0_0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System_Object, mscorlib, Version=4_0_0_0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]Dispatcher.Invoke (System.Collections.Generic.IEnumerable`1[T] ) [0x0000f] in <6295fcf03c3d4eb78d72b0003c2d5ecf>:0
at QuantConnect.Extensions+<>c__DisplayClass70_0`1[T].b__0 (T data) [0x00000] in :0

Update Backtest







0

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 means you've got () on the end of your selectors triggering them instead of passing them as funcs

0

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.


It doesn't have a () at end...

class NadionCalibratedCoil(QCAlgorithm):

def Initialize(self):
self.SetStartDate(2019, 12, 1)
self.SetCash(100000)
self.UniverseSettings.Resolution = Resolution.Daily
self.AddUniverse(self.Universe.Index.QC500, self.FineSelectionFunction)

def FineSelectionFunction(self, fine):
return [fine[0].Symbol]

def OnData(self, data):
for s in data.Keys:
self.SetHoldings(s, 1)

 

It could be something very dumb. I'm debugging it.
failed backtest:

https://www.quantconnect.com/terminal/processCache?request=embedded_backtest_931efd8ecade6c0eaadf89a60bce3682.html

 

0

I see why. The Lean/Algorithm/QCAlgorithm.Python.cs needs to be updated to support
AddUniverse(universe, finFunc). This is the code change I made.  

https://github.com/Denly/Lean/commit/29d6acd4f452477b43d22c5eaab96500f475abc4

 

2

Nice! Thanks for the issue+commit Shih Devin !

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed