title: Looping a Bloomberg function over a list of tickers
body: <p>I would like to loop a Bloomberg IntraDayBar request over a dynamic list of 22 tickers and then combined the result into one dataframe:</p>
  <p><a href="https://i.stack.imgur.com/OSElY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OSElY.png" alt="enter image description here" /></a></p>
  <p>This code generates the following list of tickers:</p>
  <pre><code>bquery = blp.BlpQuery().start()
  
  dates = pd.bdate_range(end='today', periods=31)
  time = datetime.datetime.now()
  
  bcom_info =  bquery.bds(&quot;BCOM Index&quot;, &quot;INDX_MEMBERS&quot;)
  
  bcom_info['ticker'] = bcom_info['Member Ticker and Exchange Code'].astype(str) + ' Comdty'
  </code></pre>
  <p><a href="https://i.stack.imgur.com/z2Igz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z2Igz.png" alt="bcom_info" /></a></p>
  <p>I would like to create a dataframe that returns the volume for each ticker, contained in the 'TRADE' <code>event_type</code>. Effectively looping the below code over each of the tickers in <code>bcom_info</code>.</p>
  <pre><code>bquery.bdib(bcom_info['ticker'], event_type='TRADE', interval=60, start_datetime=dates[0], end_datetime=time)
  </code></pre>
  <p>I tried this but couldn't get it to work:</p>
  <pre><code>def bloom_func(x, func):
      bloomberg = bquery
      return bquery.bdib(x, func, event_type='TRADE', interval=60, start_datetime=dates[0], end_datetime=time)
  
  for d in bcom_info['ticker']:
      x[d] = bloom_func(d)
  </code></pre>
  <p>It generates the following error:</p>
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-80-fcbf4acd6840&gt; in &lt;module&gt;
        2 
        3 for d in tickers:
  ----&gt; 4     x[d] = bloom_func(d)
  
  TypeError: bloom_func() missing 1 required positional argument: 'func'
  </code></pre>