mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 04:25:37 +08:00
BUG: Correct AverageDollarVolume NaN handling
`AverageDollarVolume` used `nanmean`, which discards NaNs before averaging, giving an ADV which is too high for any equities that have any NaNs. Changing the method to `nansum` divided by window length so that the denominator is the same no matter whether there are NaNs or not.
This commit is contained in:
@@ -156,7 +156,7 @@ class AverageDollarVolume(CustomFactor):
|
||||
inputs = [USEquityPricing.close, USEquityPricing.volume]
|
||||
|
||||
def compute(self, today, assets, out, close, volume):
|
||||
out[:] = nanmean(close * volume, axis=0)
|
||||
out[:] = nansum(close * volume, axis=0) / len(close)
|
||||
|
||||
|
||||
class _ExponentialWeightedFactor(SingleInputMixin, CustomFactor):
|
||||
|
||||
Reference in New Issue
Block a user