예제 #1
0
    def compute(self, today, assets, out, data):
        ndays = data.shape[0]

        # Initialize weights array
        weights = arange(1, ndays + 1, dtype=float64_dtype).reshape(ndays, 1)

        # Compute normalizer
        normalizer = (ndays * (ndays + 1)) / 2

        # Weight the data
        weighted_data = data * weights

        # Compute weighted averages
        out[:] = nansum(weighted_data, axis=0) / normalizer
예제 #2
0
    def compute(self, today, assets, out, data):
        ndays = data.shape[0]

        # Initialize weights array
        weights = arange(1, ndays + 1, dtype=float64_dtype).reshape(ndays, 1)

        # Compute normalizer
        normalizer = (ndays * (ndays + 1)) / 2

        # Weight the data
        weighted_data = data * weights

        # Compute weighted averages
        out[:] = nansum(weighted_data, axis=0) / normalizer
예제 #3
0
 def compute(self, today, assets, out, close, volume):
     out[:] = nansum(close * volume, axis=0) / len(close)
예제 #4
0
 def compute(self, today, assets, out, base, weight):
     out[:] = nansum(base * weight, axis=0) / nansum(weight, axis=0)
예제 #5
0
 def compute(self, today, assets, out, close, volume):
     out[:] = nansum(close * volume, axis=0) / len(close)
예제 #6
0
 def compute(self, today, assets, out, base, weight):
     out[:] = nansum(base * weight, axis=0) / nansum(weight, axis=0)