The first step when using Sharadar fundamentals is to decide which "dimension" you want to use. There are 6 possible dimensions, resulting from the combination of 3 possible reporting windows and 2 ways of handling restatements. The 3 reporting windows are:
The 2 ways of handling restatements are:
For historical research, most quants prefer to use As-Reported data, because it most accurately represents what would have originally been known at the time of trade.
Thus the 6 possible dimensions are:
In this notebook, we will use as-reported, trailing-twelve-month fundamentals. To do so, we use the slice()
method of zipline.pipeline.sharadar.Fundamentals
to select the desired dimension. Fundamentals
is a DataSetFamily
, and calling its slice()
method returns a DataSet
:
from zipline.pipeline import sharadar
fundamentals = sharadar.Fundamentals.slice('ART')
Many fundamental factors are directly available as columns in the Sharadar dataset. A list of available factors can be found in the docstring for Fundamentals
, which can be viewed by clicking on Fundamentals
in the above cell in JupyterLab and pressing Ctrl
. Once you have identified a factor of interest, you can use it in Pipeline by accessing its latest
property.
If we want to look at profitability, one metric we could use is net margin, defined as the ratio of net income to revenue:
net_margin = fundamentals.NETMARGIN.latest
Sometimes, a fundamental metric may not be directly available in the dataset, but you can derive the metric by combining other metrics. For example, operating margin, defined as the ratio of operating income to revenue, is not included in the dataset. But you can derive the metric like this:
operating_margin = fundamentals.OPINC.latest / fundamentals.REVENUE.latest