class_docstr: TradingControl representing a limit on the maximum position size that can
  be held by an algo for a given asset.
class_docstr_tok: ["TradingControl","representing","a","limit","on","the","maximum","position","size","that","can","be","held","by","an","algo","for","a","given","asset","."]
code: def __init__(
      self, on_error, asset=None, max_shares=None, max_notional=None
  ):
      super(MaxPositionSize, self).__init__(
          on_error,
          asset=asset,
          max_shares=max_shares,
          max_notional=max_notional,
      )
      self.asset = asset
      self.max_shares = max_shares
      self.max_notional = max_notional
  
      if max_shares is None and max_notional is None:
          raise ValueError(
              "Must supply at least one of max_shares and max_notional"
          )
  
      if max_shares and max_shares < 0:
          raise ValueError("max_shares cannot be negative.")
  
      if max_notional and max_notional < 0:
          raise ValueError("max_notional must be positive.")
  
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 1 to create a new MaxPositionSize object from inherited base classes: TradingControl with example: obj = MaxPositionSize(on_error, asset, max_shares, max_notional)