def monthly(funds): funds2 = [] years = dateutil.getYears(funds) for year in years: months = dateutil.getMonths(funds, year) for month in months: funds2.append(funds[dateutil.getFirstDay(funds, year, month)]) return daily(funds2)
def monthly(funds): funds2 = [] years = dateutil.getYears(funds) for year in years: months = dateutil.getMonths(funds, year) for month in months: funds2.append(funds[dateutil.getFirstDay(funds, year, month)]) return (daily(funds2))
def averageMonthly(funds): rets = daily(funds) x = 0 years = dateutil.getYears(funds) averages = [] for year in years: months = dateutil.getMonths(funds, year) for month in months: avg = 0 count = 0 days = dateutil.getDays(funds, year, month) for day in days: avg += rets[x] x += 1 count += 1 averages.append(float(avg) / count) return averages
def averageMonthly(funds): rets = daily(funds) x = 0 years = dateutil.getYears(funds) averages = [] for year in years: months = dateutil.getMonths(funds, year) for month in months: avg = 0 count = 0 days = dateutil.getDays(funds, year, month) for day in days: avg += rets[x] x += 1 count += 1 averages.append(float(avg) / count) return (averages)