Hi, I'm new to Quantopian and Python.
Firstly thank you in advance to anyone whom can help me with this rather simple problem.
I've just trying to figure out how to echo or print back the variables from calculations into the log or the debugger using the IDE. I can use the debugger to get information out of objects, but not the variables.
It's just a modification of - Pipeline Tutorial - Lesson 12 1.
The code is as follows:
def make_pipeline():
"""
Create our pipeline.
"""
# Base universe set to the QTradableStocksUS.
base_universe = QTradableStocksUS()
# 10-day close price average.
mean_5 = SimpleMovingAverage(
inputs=[USEquityPricing.close],
window_length=5,
mask=base_universe
)
# 30-day close price average.
mean_14 = ExponentialWeightedMovingAverage(
inputs=[USEquityPricing.close],
window_length=14,
decay_rate=1,
mask=base_universe
)
percent_difference = (mean_5 - mean_14) / mean_14
# Filter to select securities to short.
shorts = percent_difference.top(75)
# print shorts
# Filter to select securities to long.
longs = percent_difference.bottom(75)
# Filter for all securities that we want to trade.
securities_to_trade = (shorts | longs)
return Pipeline(
columns={
'longs': longs,
'shorts': shorts
},
screen=(securities_to_trade),
)
I am trying
print make_pipeline.mean_14
among a dozen other variations.
It would be nice to see what the values are on each iteration of the function and which stock they go with.
Cheers.
Dion.