Hello,
I'm relatively new to quantopian and making pretty good progress. I'm trying to figure how to access a pipeline column('current_price') that I successfully created in a separate function outside of my make_pipeline() function. The goal is to use the current price it in a filter to add to my screen.
algo.schedule_function(
get_current_price,
algo.date_rules.every_day(),
algo.time_rules.market_close(hours=0,minutes=21),
half_days=True
)
pipe = Pipeline(
columns={
'Revenue': Fundamentals.total_revenue.latest,
'returns_1d': returns,
'value_score': value_score,
'health_grade': health_grade,
'p/e_ratio': pe_ratio,
'prob_GaL': prob_GaL,
'prob_GaG': prob_GaG,
'Average_Gain': mean_gain,
'Average_Lose': mean_loss,
'yesterday_close': yesterday_close,
'combined_ft': combined_ft
},
screen= (universe & combined_ft)
)
return pipe
def get_current_price(context,data):
pipe_results = algo.pipeline_output('data_pipe')
secs = pipe_results[pipe_results['combined_ft']].index
current_price = data.current(secs, 'price')
pipe_results['current_price'] = current_price
log.info("{}, current_price{}".format(get_datetime('US/Eastern').time(),current_price))
print(pipe_results['current_price'])
Can any of you tell the best method to retrieve values from my current_price column and use it in my pipeline filter/screen?