Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
how come the long positions does not result in the reversal of short positions

as long as I set the slippage and commission to be zero, and assuming the order gets filled most of the time, shouldn't the long positions give the reversal (* -1) result of taking the short positions on the same instrument?

If I make a long strategy, and flips the sign of the weights for the same strategy, the result is not as expected.
In particular, if my short strategy results in negative return, shouldn't I be able to get the positive return of the same size if I flip the short into long positions?

5 responses

I think I am having a similar issue. Did you ever solve this?

If trading costs are set to 0, then yes, the returns would be inverted if you flip the sign.

I go into my problem in great detail at https://www.quantopian.com/posts/trouble-with-reversing-current-order

I see in the docs that the default trading cost is :
"The default commission model for US equities is PerShare, at $0.001 per share and $0 minimum cost per order. The first fill will incur at least the minimum commission, and subsequent fills will incur additional commission."

So are suggesting that if I set the trading costs to 0.0 inverting the sign will work?

Yes, but you also need to set slippage to 0. Most of your default trading cost will come from slippage.

Here's the code for that to include in your Initialize function:

def initialize(context):

    set_commission(commission.PerShare(cost=0.000, min_trade_cost=0))  
    set_slippage(slippage.FixedSlippage(spread=0))