class_docstr: TradingControl representing a prohibition against ordering an asset before
  its start_date, or after its end_date.
class_docstr_tok: ["TradingControl","representing","a","prohibition","against","ordering","an","asset","before","its","start_date",",","or","after","its","end_date","."]
docstr: Fail if the algo has passed this Asset's end_date, or before the
  Asset's start date.
docstr_tok: ["Fail","if","the","algo","has","passed","this","Asset","'s","end_date",",","or","before","the","Asset","'s","start","date","."]
code: def validate(
      self, asset, amount, portfolio, algo_datetime, algo_current_data
  ):
      """
      Fail if the algo has passed this Asset's end_date, or before the
      Asset's start date.
      """
      # If the order is for 0 shares, then silently pass through.
      if amount == 0:
          return
  
      normalized_algo_dt = pd.Timestamp(algo_datetime).normalize()
  
      # Fail if the algo is before this Asset's start_date
      if asset.start_date:
          normalized_start = pd.Timestamp(asset.start_date).normalize()
          if normalized_algo_dt < normalized_start:
              metadata = {"asset_start_date": normalized_start}
              self.handle_violation(
                  asset, amount, algo_datetime, metadata=metadata
              )
      # Fail if the algo has passed this Asset's end_date
      if asset.end_date:
          normalized_end = pd.Timestamp(asset.end_date).normalize()
          if normalized_algo_dt > normalized_end:
              metadata = {"asset_end_date": normalized_end}
              self.handle_violation(
                  asset, amount, algo_datetime, metadata=metadata
              )
  
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 AssetDateBounds obj's underlying member method code with example usage: obj.validate(asset, amount, portfolio, algo_datetime, algo_current_data) without return types