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

I have an algorithm that rebalances monthly, and only trades monthly. Yet my leverage during the month creeps up (sometimes going from 1 to 4) despite not having made any trades. Is it something to do with shorting? Here’s my order logic.

#Find Weights, avoiding a divide by zero  
    try:  
        weight = context.lev / (len(hold_list) + len(short_list))  
    except:  
        weight = 0.0  
    #Place the orders  
    for stock in data:  
        if stock in hold_list:      #Long  
            order_target_percent(stock, +weight)  
        elif stock in short_list:   #Short  
            order_target_percent(stock, -weight)  
        else:                       #Nothing  
            order_target_percent(stock, 0.0)  
2 responses

Were any of the shorted stocks delisted?

I don't think so, when I converted it to long only the leverage still changed in-between transactions. Also, sorry it took long, I had some finals I had to deal with.