Code to analyse shares