Modify read_stock_data function to avoid duplicate lines