Python stock pattern recognition