before_trading_start does run before the trading start, but it prints in line 16 what you saved in
context.close_prices the most recent time line 26 in
handle_data was executed, and that's 9:31am EST/EDT of the previous trading day.
For example, if you're running this live, the latest call to
before_trading_start (early this morning, late last night, or at midnight) should have printed the day closing prices from last Friday, Monday, Tuesday, and Wednesday, and the latest prices from 9:31am yesterday (Thursday).