def handle_data(self, data):
        if self.target_shares == 0:
            assert 0 not in self.portfolio.positions
            self.order(self.sid(0), 10)
            self.target_shares = 10
            return
        else:
            assert self.portfolio.positions[0]['amount'] == \
                self.target_shares, "Orders not filled immediately."
            assert self.portfolio.positions[0]['last_sale_price'] == \
                data.current(sid(0), "price"), \
                "Orders not filled at current price."

        self.order_target_value(self.sid(0), 20)
        self.target_shares = np.round(20 / data.current(sid(0), "price"))

        if isinstance(self.sid(0), Equity):
            self.target_shares = np.round(20 / data.current(sid(0), "price"))
        if isinstance(self.sid(0), Future):
            self.target_shares = np.round(
                20 / (data.current(sid(0), "price") * self.sid(0).multiplier))
dataset/ETHPy150Open quantopian/zipline/zipline/test_algorithms.py/TestTargetValueAlgorithm.handle_data/original