This may be what you want.
To get the most current fundamental data simply use the '.latest' method of any field (ie bound column) as shown below.
To get fundamental data as of x trading days ago (eg 252 days or 1 calendar year ago) you will need a small custom factor as shown below.
from quantopian.pipeline import CustomFactor
from quantopian.pipeline.data import morningstar
class Previous(CustomFactor):
# Returns value of input x trading days ago where x is the window_length
# Both the inputs and window_length must be specified as there are no defaults
def compute(self, today, assets, out, inputs):
out[:] = inputs[0]
To use the factor just instantiate it as below. Note that you may want to use the custom factor even for the current data (rather than the '.latest' method) because it supports a mask as shown.
assets_current = morningstar.balance_sheet.total_assets.latest
assets_current_500 = Previous(inputs = [morningstar.balance_sheet.total_assets], window_length=1, mask=universe)
assets_1_year_ago_500 = Previous(inputs = [morningstar.balance_sheet.total_assets], window_length=252, mask=universe)
Attached is your notebook with a few cells added to the end showing this approach in practice. Notice that the data matches the data you had gotten previously.