trade algorithm in python