I would like to use fundamentals data for purposes other than selecting stocks (ie as inputs in ML).  I see in the docs how to select stocks based on fundamentals, but not how to access fundamental values.  In my testing, Securities["SPY"].Fundamentals are always null.

For example, inside a schedule function:

Securities["SPY"].Fundamentals.ValuationRatios.PERatio

 ...throws a nullreferenceexeption.  Is there some other step I need to take to populate Fundamentals in this scenario?

 

Author