Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
very weird behavior what happened ?!!?!?!?!?(selling more than buying)34% return in 2 months

this was a backtest of a modified live trading algo (the one you start with) and it some how sold more than it bought! what happened! when looking at the transactions I had bought 2 "XLB" then ordered -19 "XLB" my question how did that happen

5 responses

rounding error?

let me check

nope got rid of the rounding but that made the program worse, and its still selling more than it bought

oh ha-ha figured it out, I set the amount it bought (context.bought) to the price not how many shares

that's what it actually does