Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
5 Minute Level Pricing make_pipeline in notebook

Hi, I'm new to quantopian. I am trying to
make_pipeline
with 5 minute level pricing for the close
calculating moving averages

in the Notebook environment. I am able to do that with get_pricing, frequency=minute and resample but not sure how to do that using a custom factor in the research environment for a pipeline.

I am trying to replicate the code below for customer factor for make_pipline in the research environment

data = get_pricing('MSFT', start_date='2017-1-1', end_date='2018-3-28', frequency='minute')  
ohlc_dict = {'open_price' : 'first', 'high' : 'max', 'low' : 'min', 'close_price' : 'last', 'volume' : 'sum'}  
data_5=data.resample('5Min').apply(ohlc_dict).dropna(how='any')  
import numpy as np  
data_5['ma_5'] = data_5['close_price'].rolling(window=5).mean()  
data_5['ma_10'] = data_5['close_price'].rolling(window=10).mean()  
data_5['ma_25'] = data_5['close_price'].rolling(window=25).mean()
5 responses

No can do. The mechanics of a pipeline only allow daily data. For minute data in a notebook use the 'get_pricing' method. In an algorithm use the 'data.history' method. Maybe take a look at this post https://www.quantopian.com/posts/updating-pipeline-every-minute-using-handle-data .

Question, you apparently already have the output you want using pandas methods. Why do you feel you need to write a custom factor?

Hi Dan, thx for quick reply, i want to see different moving average cross over trends in research for all equities, and see how the strategy might perform for 5 minute moving averages. I took a look at the post and others, and i was able to resample pricing data to get 5 minute data, but now i want to expand on that to all equities for a short period of time and see how the strategy might perform for different sectors. Not sure if this is the correct way to go about it or if i should i just take a look at a few stock for 5minute moving averages and then implement and algo backtest.

I think i was trying to analyze all equities at once in research ... i guess i cannot do that , thx for the reply, will take a look at different individual stocks and then attempt to write algo based on different filters, i think i was trying to do everything all at once!

If I understand correctly, the code above is what you want but it only get's a single stock (ie MSFT). You want to try this across a larger sample of securities? What you want to do is run pipeline first to return a 'universe' of securities, then use that list of securities as the input to the 'get_pricing' method. See the attached notebook.

Much appreciated Dan, i think this is what I need to be doing!