If you just want to avoid a copy without adding a null state then it's the reference bit that makes all the difference. Whether that reference is a const reference or not does not matter for optimization, I think.
If you make it a non-const reference the compiler won't let you pass a result of another function call such as sum(get_daily_prices())
If you make it a non-const reference the compiler won't let you pass a result of another function call such as sum(get_daily_prices())