Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

python - Issue in Quant Connect with comparative operators

I am having an issue comparing prices of crypto currencies in quant connect, I am getting the error message TypeError : '>' not supported between instances of 'NoneType' and 'NoneType' (Open Stacktrace), but the variables do have values, I am confused as to why they are 'NoneType'. For those unfamiliar with Quant Connect self.Debug is equivalent to print.

week = self.sma_dict.get(cryp, {}).get('week_mavg')
            mavg = self.sma_dict.get(cryp, {}).get('mavg')
            trois = self.sma_dict.get(cryp, {}).get('trois_mavg')
            self.Debug(week)
            self.Debug(mavg)
            self.Debug(trois)
            
            if week > mavg and trois < week and y > trois and cryp not in self.Portfolio.Invested: 

I've also tried:

week = self.sma_dict.get(cryp, {}).get('week_mavg', float)
            mavg = self.sma_dict.get(cryp, {}).get('mavg', float)
            trois = self.sma_dict.get(cryp, {}).get('trois_mavg', float)
            self.Debug(week)
            self.Debug(mavg)
            self.Debug(trois)
            
            if week > mavg and trois < week and y > trois and cryp not in self.Portfolio.Invested:  

But I then get the error message TypeError : '>' not supported between instances of 'Type' and 'Type' (Open Stacktrace)

This could very well be a Quant Connect issue, but any suggestions would be appreciated. Thanks, Jack.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...