class_docstr: TradingControl representing a limit on the magnitude of any single order
  placed with the given asset.  Can be specified by share or by dollar
  value.
class_docstr_tok: ["TradingControl","representing","a","limit","on","the","magnitude","of","any","single","order","placed","with","the","given","asset",".","Can","be","specified","by","share","or","by","dollar","value","."]
docstr: Fail if the magnitude of the given order exceeds either self.max_shares
  or self.max_notional.
docstr_tok: ["Fail","if","the","magnitude","of","the","given","order","exceeds","either","self.max_shares","or","self.max_notional","."]
code: def validate(
      self, asset, amount, portfolio, algo_datetime, algo_current_data
  ):
      """
      Fail if the magnitude of the given order exceeds either self.max_shares
      or self.max_notional.
      """
  
      if self.asset is not None and self.asset != asset:
          return
  
      if self.max_shares is not None and abs(amount) > self.max_shares:
          self.handle_violation(asset, amount, algo_datetime)
  
      current_asset_price = algo_current_data.current(asset, "price")
      order_value = amount * current_asset_price
  
      too_much_value = (
          self.max_notional is not None
          and abs(order_value) > self.max_notional
      )
  
      if too_much_value:
          self.handle_violation(asset, amount, algo_datetime)
  
imports: import abc
  import logbook
  import pandas
  from six import with_metaclass
  from catalyst.errors import AccountControlViolation, TradingControlViolation
  from catalyst.constants import LOG_LEVEL
label_desc: Use image node_id 2 for calling the MaxOrderSize obj's underlying member method code with example usage: obj.validate(asset, amount, portfolio, algo_datetime, algo_current_data) without return types