def daily_return(prices):
 g = np.zeros_like(prices)
 g[1:] = ((prices[1:] - prices[:(-1)]) / prices[:(-1)])
 return g

def daily_return ( prices ) : g = np . zeros_like ( prices ) g [ 1 : ] = ( ( prices [ 1 : ] - prices [ : ( - 1 ) ] ) / prices [ : ( - 1 ) ] ) return g
an array of daily returns from price array .