refactor historical stock loading into function for future use