DV Trading interview question

Optimizing solution from past project experience