Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
needing help to reblance

i have this in my code

def handle_data(context,data):

but I don't want to rebalance every day i would rather do it every month

1 response

Use schedule_function. Try this:

schedule_function(rebalance,  
                     date_rules.month_end(),  
                     time_rules.market_close(minutes=30))  

Also get rid of def handle_data(context,data): and replace it with this:

def rebalance(context, data):