I\'m attempting to replicate Ernie Chan\'s example 2.7 outlined in his seminal book Algorithmic Trading (page 55) in python. There isn\'t much pertinent material found online bu