Automatic Portmanteau Tests with Applications to Market Risk Management. (December 2017)