better write data to structures for each 'stock_name' and then write they to output files?