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")
  
      data1 = bt.feeds.YahooFinanceCSVData(
          dataname=args.data1, **dkwargs
      )
      cerebro.adddata(data1, name="Data1")
  
      data2 = bt.feeds.YahooFinanceCSVData(
          dataname=args.data2, **dkwargs
      )
      cerebro.adddata(data2, name="Data2")
  
      cerebro.addstrategy(St, printout=args.printout)
      if not args.no_pyfolio:
          cerebro.addanalyzer(bt.analyzers.PyFolio, _name="pyfolio")
  
      results = cerebro.run()
      if not args.no_pyfolio:
          strat = results[0]
          pyfoliozer = strat.analyzers.getbyname("pyfolio")
  
          (
              returns,
              positions,
              transactions,
              gross_lev,
          ) = pyfoliozer.get_pf_items()
          if args.printout:
              print("-- RETURNS")
              print(returns)
              print("-- POSITIONS")
              print(positions)
              print("-- TRANSACTIONS")
              print(transactions)
              print("-- GROSS LEVERAGE")
              print(gross_lev)
  
          import pyfolio as pf
  
          pf.create_full_tear_sheet(
              returns,
              positions=positions,
              transactions=transactions,
              gross_lev=gross_lev,
              live_start_date="2005-05-01",
              round_trips=True,
          )
  
      if args.plot:
          cerebro.plot(style=args.plot_style)
  
file_path: backtrader/samples/pyfoliotest/pyfoliotest.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