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

Hi folks, I was thinking that there are some very common functions such as stops, profit taking, trailing stops, so on... that we can all contribute to.

I was thinking we can just keep a master list of clean useful functions we can just add to the handle_data call that would help us monitor our portfolio every minute. I will write some starter code later today, but i was thinking something like,

def profit_taking(context, taking_ratio = 1.2):  
    --code--  
    if price_ratio > taking_ratio:  
        order_target(sec, 0)  

then we can just add the functions we want to use to handle_data.