def handle_data(self, data):
        if not self.ordered:
            assert 0 not in self.portfolio.positions
        else:
            # Since you can't own fractional shares (at least in this
            # example), we want to make sure that our target amount is
            # no more than a share's value away from our current
            # holdings.
            target_value = self.portfolio.portfolio_value * 0.002
            position_value = self.portfolio.positions[0]['amount'] * \
                self.sale_price

            assert self.sale_price <= abs(target_value - position_value), \
                "Orders not filled correctly"

            assert self.portfolio.positions[0]['last_sale_price'] == \
                data.current(sid(0), "price"), \
                "Orders not filled at current price."

        self.sale_price = data.current(sid(0), "price")
        self.order_target_percent(self.sid(0), .002)
        self.ordered = True
dataset/ETHPy150Open quantopian/zipline/zipline/test_algorithms.py/TestTargetPercentAlgorithm.handle_data/swapped operands of `<=`