code: def runstrat(pargs=None):
      args = parse_args(pargs)
  
      cerebro = bt.Cerebro()
  
      dfkwargs = dict()
      if args.format == "yahoo_unreversed":
          dfkwargs["reverse"] = True
  
      fmtstr = "%Y-%m-%d"
      if args.fromdate:
          dtsplit = args.fromdate.split("T")
          if len(dtsplit) > 1:
              fmtstr += "T%H:%M:%S"
  
          fromdate = datetime.datetime.strptime(args.fromdate, fmtstr)
          dfkwargs["fromdate"] = fromdate
  
      fmtstr = "%Y-%m-%d"
      if args.todate:
          dtsplit = args.todate.split("T")
          if len(dtsplit) > 1:
              fmtstr += "T%H:%M:%S"
          todate = datetime.datetime.strptime(args.todate, fmtstr)
          dfkwargs["todate"] = todate
  
      dfcls = DATAFORMATS[args.format]
      data = dfcls(dataname=args.infile, **dfkwargs)
      cerebro.adddata(data)
  
      cerebro.addstrategy(
          RewriteStrategy,
          separator=args.separator,
          outfile=args.outfile,
      )
  
      cerebro.run(stdstats=False)
  
      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/tools/rewrite-data.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import os.path
  import time
  import sys
  import backtrader
  from backtrader.utils.py3 import bytes
label_desc: Use image node_id 1 for calling a global function with example usage: runstrat(pargs) without return types