title: IBPY get correct historical volume data
body: <p>I am trying to get historical data from IBPY.
  I get it, but the volume is extremely low to the point it's useless. 
  I would like to know how to get the correct historical volume estimation. </p>
  
  <p>I'm executing the following code:</p>
  
  <pre><code>from ib.opt import Connection, message
  from ib.ext.Contract import Contract
  from ib.ext.Order import Order
  from time import sleep, strftime
  
  def historical_data_handler(msg):
      print(msg)
  
  connection = Connection.create(port=7496, clientId=999)
  connection.register(historical_data_handler, message.historicalData)
  connection.connect()
  
  req = Contract()
  req.m_secType = "STK"
  req.m_symbol = "TSLA"
  req.m_currency = "USD"
  req.m_exchange = "AMEX"
  endtime = strftime('%Y%m%d %H:%M:%S')
  connection.reqHistoricalData(1,req,endtime,"1 D","1 hour","TRADES",1,1)
  
  sleep(5)
  connection.disconnect()
  </code></pre>
  
  <p>and this is the output:</p>
  
  <pre><code>&lt;historicalData reqId=1, date=20181123  16:30:00, open=333.21, high=333.33, low=331.04, close=332.92, volume=22, count=21, WAP=332.233, hasGaps=False&gt;
  &lt;historicalData reqId=1, date=20181123  16:30:00, open=333.21, high=333.33, low=331.04, close=332.92, volume=22, count=21, WAP=332.233, hasGaps=False&gt;
  &lt;historicalData reqId=1, date=20181123  17:00:00, open=332.93, high=334.2, low=327.0, close=328.2, volume=42, count=39, WAP=329.755, hasGaps=False&gt;
  &lt;historicalData reqId=1, date=20181123  17:00:00, open=332.93, high=334.2, low=327.0, close=328.2, volume=42, count=39, WAP=329.755, hasGaps=False&gt;
  &lt;historicalData reqId=1, date=20181123  18:00:00, open=329.0, high=330.37, low=327.96, close=327.96, volume=17, count=17, WAP=329.375, hasGaps=False&gt;
  &lt;historicalData reqId=1, date=20181123  18:00:00, open=329.0, high=330.37, low=327.96, close=327.96, volume=17, count=17, WAP=329.375, hasGaps=False&gt;
  &lt;historicalData reqId=1, date=20181123  19:00:00, open=328.5, high=328.6, low=326.07, close=326.07, volume=25, count=25, WAP=327.498, hasGaps=False&gt;
  &lt;historicalData reqId=1, date=20181123  19:00:00, open=328.5, high=328.6, low=326.07, close=326.07, volume=25, count=25, WAP=327.498, hasGaps=False&gt;
  </code></pre>
  
  <p>The data arrives, but the volumes of each row are impossibly low (~22 for hourly bars).</p>
  
  <p>On their website:
  <a href="https://interactivebrokers.github.io/tws-api/historical_bars.html#hd_what_to_show" rel="noreferrer">https://interactivebrokers.github.io/tws-api/historical_bars.html#hd_what_to_show</a></p>
  
  <p>it is stated that:</p>
  
  <blockquote>
    <p>Note: IB's historical data feed is filtered for some types of trades
    which generally occur away from the NBBO such as combos, block trades,
    and derivatives. For that reason the historical data volume will be
    lower than an unfiltered historical data feed</p>
  </blockquote>
  
  <p>However, the retrieved volumes are so low they are useless.</p>
  
  <p>I suppose I'm not the first to need historical volume data, and there is probably a way to get it.
  Can you please tell me how?
  Thanks!</p>