The following call from the AlphaModel to ETFConstituentsData returns an empty dictionary or at least an empty symbols list. Any idea why?

  1. import typing
  2. from AlgorithmImports import *
  3. from datetime import timedelta
  4. from QuantConnect.Indicators import SimpleMovingAverage
  5. from AlphaModel import *
  6. from QuantConnect.DataSource import *
  7. #endregion
  8. class TechnicalAlphaModel(AlphaModel):
  9. def Update(self, algorithm, data):
  10. insights = []
  11. c_data = []
  12. symbols = []
  13. constituents = data.Get(ETFConstituentData)
  14. #symbols = constituents.keys()
  15. #c_data = constituents.values()
  16. for kvp in constituents:
  17. symbol = kvp.Key
  18. constituentData = kvp.Value
  19. c_data.append(constituentData)
  20. symbols.append(symbol)
  21. algorithm.Debug(f'symbols {symbols}')
+ Expand

Author

Amir Goren

February 2024