code: def main(plot):
      instruments = ["gld", "gdx"]
      windowSize = 50
  
      # Load the bars. These files were manually downloaded from Yahoo Finance.
      feed = yahoofeed.Feed()
      for year in range(2006, 2012 + 1):
          for instrument in instruments:
              fileName = "%s-%d-yahoofinance.csv" % (instrument, year)
              print("Loading bars from %s" % fileName)
              feed.addBarsFromCSV(instrument, fileName)
  
      strat = StatArb(feed, instruments[0], instruments[1], windowSize)
      sharpeRatioAnalyzer = sharpe.SharpeRatio()
      strat.attachAnalyzer(sharpeRatioAnalyzer)
  
      if plot:
          plt = plotter.StrategyPlotter(strat, False, False, True)
          plt.getOrCreateSubplot("hedge").addDataSeries(
              "Hedge Ratio", strat.getHedgeRatioDS()
          )
          plt.getOrCreateSubplot("spread").addDataSeries(
              "Spread", strat.getSpreadDS()
          )
  
      strat.run()
      print(
          "Sharpe ratio: %.2f"
          % sharpeRatioAnalyzer.getSharpeRatio(0.05)
      )
  
      if plot:
          plt.plot()
  
imports: from __future__ import print_function
  from pyalgotrade import strategy
  from pyalgotrade import dataseries
  from pyalgotrade.dataseries import aligned
  from pyalgotrade import plotter
  from pyalgotrade.barfeed import yahoofeed
  from pyalgotrade.stratanalyzer import sharpe
  import numpy
  import statsmodels.api
label_desc: Use image node_id 2 for calling a global function with example usage: main(plot) without return types