If you have sparse data, you will need to fill gaps. Let's say we have dates and daily price, filled with gaps (missing dates):
Our goal is to fill dates and copy price from previous day. In this example, 2015-01-03 should be recorded with price = 2.
Here is a 8 SQL queries which demonstrate possible approach:
P.S. SQL doesn't reflect last row of input data, so we're inserting dummy row at the end of original "prices" table (see gist.github.com).