How to read Fundamental data paths for Asset Classification
masterWhen accessing Fundamental data points in QuantConnect/LEAN, you must use the exact path from the snapshot f. Paths follow specific rules depending on whether they are single-period or multi-period fields:
- Single-period fields: Read the path directly. Example:
f.ValuationRatios.PERatio. - Multi-period fields (
MultiPeriodField): These paths end in a bracketed period identifier like.[1M 2M 3M 6M 9M 12M]. You must append the corresponding period accessor to the path to retrieve the numeric value..Valueretrieves the most recent reported period..OneMonth,.TwoMonths,.ThreeMonths,.SixMonths,.NineMonths, and.TwelveMonthscorrespond to the1Mthrough12Mtokens.
Warning: Forgetting the period accessor on a MultiPeriodField will result in the wrapper being treated as a truthy object rather than a number, causing numeric inequalities to fail or return nonsense.
// Example of a single-period field
var peRatio = f.ValuationRatios.PERatio;
// Example of a multi-period field (must use the accessor)
// Path: f.FinancialStatements.IncomeStatement.NetIncome.12M
var trailingTwelveMonthNetIncome = f.FinancialStatements.IncomeStatement.NetIncome.TwelveMonths;
// Using the most recent period
var recentNetIncome = f.FinancialStatements.IncomeStatement.NetIncome.Value;