code: def runstrat(args=None):
      args = parse_args(args)
  
      cerebro = bt.Cerebro()
      cerebro.broker.setcash(args.cash)
  
      dkwargs = dict()
      if args.fromdate is not None:
          dkwargs["fromdate"] = datetime.strptime(
              args.fromdate, "%Y-%m-%d"
          )
      if args.todate is not None:
          dkwargs["todate"] = datetime.strptime(args.todate, "%Y-%m-%d")
  
      # data
      data = bt.feeds.YahooFinanceCSVData(dataname=args.data, **dkwargs)
      cerebro.adddata(data)
  
      # strategy
      cerebro.addstrategy(
          TheStrategy,
          use_target_size=args.target_size,
          use_target_value=args.target_value,
          use_target_percent=args.target_percent,
      )
  
      cerebro.run()
  
      if args.plot:
          pkwargs = dict(style="bar")
          if args.plot is not True:  # evals to True but is not True
              npkwargs = eval(
                  "dict(" + args.plot + ")"
              )  # args were passed
              pkwargs.update(npkwargs)
  
          cerebro.plot(**pkwargs)
  
file_path: backtrader/samples/order_target/order_target.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  from datetime import datetime
  import backtrader
label_desc: Use image node_id 1 for calling a global function with example usage: runstrat(args) without return types