title: ibpy how to get commission using interactive broker's API?
body: <p>I have following code that use python API of IB, it should display both price and commission:</p>
  
  <pre><code>from ib.ext.ExecutionFilter import ExecutionFilter 
  from ib.ext.CommissionReport import CommissionReport
  from ib.opt import ibConnection, message 
  
  from time import sleep 
  
  #-- message handlers ------------------------------------------------- 
  
  # print all messages from TWS 
  def watcher(msg): 
      pass 
  
  def ExecutionDetailsHandler(msg): 
      global execDetails 
      execDetails = msg.execution 
      #print execDetails.m_price 
      #print execDetails.m_side 
  
  def CommissionDetailsHandler(msg): 
      global commission 
      commission = msg.commissionReport
  
  # global variable that stores the last Execution seen by 
  ExecutionDetailsHandler 
  CommissionDetailsHandler
  execDetails = None 
  commission = None
  
  #-- factories 
  #----------------------------------------------------------- 
  
  def makeExecFilter(): 
      filter=ExecutionFilter() 
      return filter 
  
  #-- utilities -------------------------------------------------------- 
  
  def getExecutionPrice(): 
      filter=makeExecFilter() 
      con.reqExecutions(744,filter) 
  
      # wait for TWS message to come back to message handler 
      while execDetails is None: 
          print 'waiting' 
          sleep(1) 
      return execDetails.m_price 
  
  def getCommission(): 
      filter=CommissionReport() 
      con.commissionReport(filter) 
  
      # wait for TWS message to come back to message handler 
      while commission is None: 
          print 'waiting' 
          sleep(1) 
      return commission.m_commission
  
  con = ibConnection() 
  con.registerAll(watcher) 
  con.register(ExecutionDetailsHandler, 'ExecDetails') 
  con.register(CommissionDetailsHandler, 'commissionDetails') 
  con.connect() 
  
  price=getExecutionPrice() 
  c = getCommission()
  con.disconnect()
  print 'The price of one execution is:', price 
  print 'The commission fee is:', c 
  </code></pre>
  
  <p>however this is only working for execution price, as it displays the price information after print out. But it does not show the commission information (in my terminal it keeps waiting forever), is there anything wrong in my code?</p>