Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
unable to execute in contest

hello,

i can backtest this also but cannot run it in contest i.e no transactions are taking place. Same is true for all of my algorithms. Can the website admin help me with this?

thanks
-kamal

7 responses

I believe one issue is with when you schedule your orders to take place.

schedule_function(func=rebalance,  
                      date_rule=date_rules.month_start(days_offset=0),  
                      time_rule=time_rules.market_open(hours=0,minutes=30),  
                      half_days=True)

No orders will happen until the first of the month. If you enter them in the contest mid-month you won't see any orders for awhile (until the first of next month)

I set days_offset=21 and hours=3,minutes=10 just before hitting 12:10 pm, and it still did not execute. I can also see these messages in the log file
2017-08-21 18:15 WARN :74: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)
2017-08-21 18:15 WARN :73: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)

Pl tell me what to modify to get it working.

thanks
-kamal

The days_offset parameter is in trading days and not calendar days. Setting it to 21 will not execute on the 21st of the month but rather 21 trading days after the first trading day of the month. To get the 21st of the month try setting it to something closer to 15. Count the days on a calendar to be precise.

will this rebalance the portfolio 1 hr before market close?

schedule_function(func=rebalance,
date_rule=date_rules.every_day(),
time_rule=time_rules.market_close(minutes=60))

thanks
-kamal

Kamal, what I do when I have a monthly rebalance function that I also want to run the first day the algo boots up is I'll schedule another function that runs daily and all it does is check whether I have 0 positions, and if so it executes the rebalance function.

yes. Even otherwise, when you issue an order, it checks if the current portfolio already has that position and only then decides to issue a buy/sell order. So, executing rebalance every day will be a no-op if the portfolio does not change every day.

thanks
-kamal

btw, willa sharpe ratio < 1 and beta of 0.25 be f\of any interest if it beats the SPY (the longer it is run)?

thanks
-kamal