Hi,
I wrote a simple algo that (attempts to) rotate to the ETF that performed the best over the last 3 months. The strategy is very simple, but I have some questions about how Quantopian is behaving:
I'm using daily mode and schedule_function(date_rules.month_end(), time_rules.market_close(hours=1, minutes=30)) and my function seems to run on the proper day, but when I look at Transaction Details, it shows trades for that day. For example, in the log output, order_target_percent() is called on 2003-07-31, but Transaction Details shows a trade on 2003-07-31. I thought that the order is supposed to execute on the next day? Also, in the log output, order_target_percent() is called on 2003-11-28, but the Transaction Details shows a trade on 2003-11-30 which is a Sunday.
To rotate out of existing positions, I use order_target(stock, 0) and to rotate into the selection, I use order_target_percent(stock, 1.0), but I notice that this doesn’t seem to be using all the available cash. For example, on 2003-12-01, there is $587.72 available. Some days such as 2007-09-04 have $10,454.28 available which is a lot.
So my questions are: Why does this occur? What is the recommended way to deal with this?
Thanks.