code: def main(plot):
      instrument = "yhoo"
      bBandsPeriod = 40
  
      # Download the bars.
      feed = quandl.build_feed("WIKI", [instrument], 2011, 2012, ".")
  
      strat = BBands(feed, instrument, bBandsPeriod)
      sharpeRatioAnalyzer = sharpe.SharpeRatio()
      strat.attachAnalyzer(sharpeRatioAnalyzer)
  
      if plot:
          plt = plotter.StrategyPlotter(strat, True, True, True)
          plt.getInstrumentSubplot(instrument).addDataSeries(
              "upper", strat.getBollingerBands().getUpperBand()
          )
          plt.getInstrumentSubplot(instrument).addDataSeries(
              "middle", strat.getBollingerBands().getMiddleBand()
          )
          plt.getInstrumentSubplot(instrument).addDataSeries(
              "lower", strat.getBollingerBands().getLowerBand()
          )
  
      strat.run()
      print(
          "Sharpe ratio: %.2f"
          % sharpeRatioAnalyzer.getSharpeRatio(0.05)
      )
  
      if plot:
          plt.plot()
  
file_path: pyalgotrade/samples/bbands.py
imports: from __future__ import print_function
  from pyalgotrade import strategy
  from pyalgotrade import plotter
  from pyalgotrade.tools import quandl
  from pyalgotrade.technical import bollinger
  from pyalgotrade.stratanalyzer import sharpe
  from pyalgotrade import broker
label_desc: Use image node_id 1 for calling a global function with example usage: main(plot) without return types