code: def runstrat(args=None):
      args = parse_args(args)
  
      cerebro = bt.Cerebro()
      cerebro.broker.set_cash(args.cash)
  
      dkwargs = dict()
      if args.fromdate:
          fromdate = datetime.datetime.strptime(
              args.fromdate, "%Y-%m-%d"
          )
          dkwargs["fromdate"] = fromdate
  
      if args.todate:
          todate = datetime.datetime.strptime(args.todate, "%Y-%m-%d")
          dkwargs["todate"] = todate
  
      data0 = bt.feeds.YahooFinanceCSVData(
          dataname=args.data0, **dkwargs
      )
      cerebro.adddata(data0, name="Data0")
  
      cerebro.addstrategy(
          St,
          period=args.period,
          stake=args.stake,
          printout=args.printout,
      )
  
      if args.timereturn:
          cerebro.addobserver(
              bt.observers.TimeReturn,
              timeframe=TIMEFRAMES[args.timeframe],
          )
      else:
          benchdata = data0
          if args.benchdata1:
              data1 = bt.feeds.YahooFinanceCSVData(
                  dataname=args.data1, **dkwargs
              )
              cerebro.adddata(data1, name="Data1")
              benchdata = data1
  
          cerebro.addobserver(
              bt.observers.Benchmark,
              data=benchdata,
              timeframe=TIMEFRAMES[args.timeframe],
          )
  
      cerebro.run()
  
      if args.plot:
          pkwargs = dict()
          if args.plot is not True:  # evals to True but is not True
              pkwargs = eval(
                  "dict(" + args.plot + ")"
              )  # args were passed
  
          cerebro.plot(**pkwargs)
  
file_path: backtrader/samples/observer-benchmark/observer-benchmark.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import random
  import backtrader
label_desc: Use image node_id 1 for calling a global function with example usage: runstrat(args) without return types