I'm experimenting a bit with the pipeline and I can't seem to be able to sort values.
In this code I have a very simple algorithm: I will buy the stocks that have had the greatest percentage return the previous day. However, I do not seem to be able to sort my pipleline the way I want.
To check if my sorting is correct, every day in my rebalance function I check the actual percentage change by calling:
print data.history(security,"close", 3, "1d").iloc[:2].pct_change()
When I look in the log out put I see the following percentage changes:
2011-01-03 00:00:00+00:00 0.024726
2011-01-03 00:00:00+00:00 0.006965
2011-01-03 00:00:00+00:00 0.014212
2011-01-03 00:00:00+00:00 0.034572
The sorting has not been made, what have I done wrong here?