Very, very hackish solution to stockmax in Python