def assert_required_fields(self, event): """ We only allow events with a price field to be run through the returns transform. """ if 'price' not in event: raise WrongDataForTransform(transform="StdDevEventWindow", fields='price')
def assert_required_fields(self, event): """ We only allow events with all of our tracked fields. """ for field in self.fields: if field not in event: raise WrongDataForTransform( transform="MovingAverageEventWindow", fields=self.fields)
def check_required_fields(self, event): """ We only allow events with a price field to be run through the returns transform. """ if not hasattr(event, 'price'): raise WrongDataForTransform(transform="ReturnsEventWindow", fields=['price'])
def check_required_fields(self, event): """ We only allow events with all of our tracked fields. """ # All events require a 'dt' field. if not hasattr(event, 'dt'): raise WrongDataForTransform( transform=self.__class__.__name__, fields=['dt'], ) # Subclasses must implement the 'fields' property to specify other # required fields. for field in self.fields: if field not in event: raise WrongDataForTransform( transform=self.__class__.__name__, fields=self.fields, )
def assert_required_fields(self, event): if 'price' not in event or 'volume' not in event: raise WrongDataForTransform(transform="VWAPEventWindow", fields=self.fields)
def assert_required_fields(self, event): for field in self.fields: if field not in event: raise WrongDataForTransform( transform="VWAPEventWindow", fields=self.fields)