code: def runstrat(args=None):
      args = parse_args(args)
  
      cerebro = bt.Cerebro()
  
      # Data feed kwargs
      kwargs = dict()
  
      # Parse from/to-date
      dtfmt, tmfmt = "%Y-%m-%d", "T%H:%M:%S"
      for a, d in (
          (getattr(args, x), x) for x in ["fromdate", "todate"]
      ):
          if a:
              strpfmt = dtfmt + tmfmt * ("T" in a)
              kwargs[d] = datetime.datetime.strptime(a, strpfmt)
  
      # Data feed
      data0 = bt.feeds.BacktraderCSVData(dataname=args.data0, **kwargs)
      cerebro.adddata(data0)
  
      # Broker
      cerebro.broker = bt.brokers.BackBroker(
          **eval("dict(" + args.broker + ")")
      )
  
      # Sizer
      cerebro.addsizer(
          bt.sizers.FixedSize, **eval("dict(" + args.sizer + ")")
      )
  
      # Strategy
      cerebro.addstrategy(St, **eval("dict(" + args.strat + ")"))
  
      # Execute
      cerebro.run(**eval("dict(" + args.cerebro + ")"))
  
      if args.plot:  # Plot if requested to
          cerebro.plot(**eval("dict(" + args.plot + ")"))
  
file_path: backtrader/samples/lrsi/lrsi-test.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import backtrader
label_desc: Use image node_id 1 for calling a global function with example usage: runstrat(args) without return types