Hi all,
Does this command " close_price = USEquityPricing.close.latest" set close_price to the 1D close? Or just the latest price depending on the time frame?
Thanks,
Dee
Hi all,
Does this command " close_price = USEquityPricing.close.latest" set close_price to the 1D close? Or just the latest price depending on the time frame?
Thanks,
Dee
One can think of the statement "close_price = USEquityPricing.close.latest" as setting "close_price" to the latest price depending on the time frame. However, "close_price" will be a factor object and NOT a scaler value. One can't say "print close_price" and expect a number. It's not the real value of the close price. It's just used to define the pipeline and the associated data.
Specifically, "USEquityPricing" is a dataset, ".close" is a column in that dataset, and ".latest" is a method which returns the latest value of that column. Technically, a dataset isn't really the actual data. DataSets are simply objects that tell the Pipeline API where and how to find the data. The above statement is used to initially define the pipeline output. See the documentation https://www.quantopian.com/help#importing-datasets for a complete description.
So, when the pipeline is run (using the "pipeline_output" method in an algorithm or the "run_pipeline" method in a notebook) then and only then is the actual scaler data retrieved. The output is a Pandas dataframe indexed by security with the columns one has defined. By initially adding "close_price" to a pipeline, one of the columns in the dataframe will now contain the latest close price of an asset based upon the day the pipeline is run.
Hope that makes sense?