Back to Community
Custom rebalance using date_rules

With date_rules, the following are available:

  • every_day()
  • week_start(days_offset = 0-4)
  • week_end(days_offset = 0-4)
  • month_start(days_offset = 0-25)
  • month_end(days_offset = 0-25)

I'd like to use date_rules to allow for a quarterly or annual rebalance but based on the options available, this is not possible. Has anyone made this work or found another solution?

3 responses

I am also interested in doing this. If there is a known solution, please advise.

Thanks.

David,

Attached is one way to use the built in get_datetime() function to trade monthly, quarterly and/or annually. Maybe that helps? There are also a number of posts that address similar scheduling needs. Search for 'get_datetime' or 'schedule' and you will find some more.

https://www.quantopian.com/posts/rebalancing-less-frequently-than-1-month-help
https://www.quantopian.com/posts/using-schedule-function-every-day-but-mondays-possible

Good luck,

Dan

Clone Algorithm
20
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57a8896cbbcc1e0ff9dba928
There was a runtime error.