def validate_order_params(self,
                              asset,
                              amount,
                              limit_price,
                              stop_price,
                              style):
        """
        Helper method for validating parameters to the order API function.

        Raises an UnsupportedOrderParameters if invalid arguments are found.
        """

        if not self.initialized:
            raise OrderDuringInitialize(
                msg="order() can only be called from within handle_data()"
            )

        if style:
            if limit_price:
                raise UnsupportedOrderParameters(
                    msg="Passing both limit_price and style is not supported."
                )

            if stop_price:
                raise UnsupportedOrderParameters(
                    msg="Passing both stop_price and style is not supported."
                )

        for control in self.trading_controls:
            control.validate(asset,
                             amount,
                             self.portfolio,
                             self.get_datetime(),
                             self.trading_client.current_data)
def validate_order_params ( self , asset , amount , limit_price , stop_price , style ) : if not self . initialized : raise OrderDuringInitialize ( msg = "order() can only be called from within handle_data()" ) if style : if limit_price : raise UnsupportedOrderParameters ( msg = "Passing both limit_price and style is not supported." ) if stop_price : raise UnsupportedOrderParameters ( msg = "Passing both stop_price and style is not supported." ) for control in self . trading_controls : control . validate ( asset , amount , self . portfolio , self . get_datetime ( ) , self . trading_client . current_data )
Helper method for validating parameters to the order API function.

        Raises an UnsupportedOrderParameters if invalid arguments are found.