functions to generate .csv files for stocks