title: Extract fundamental data with interactive broker from specific tags in python 3
body: <p>all. I want to extract the specific fundamental data from Interactive Broker API (Python 3), however, it shows the xml version. I can't get for example Market capitalization (by ' print(callback.fundamental_Data_data.find("MKTCAP"))')</p>
  
  <pre><code>import pandas as pd
  import time
  from IBWrapper import IBWrapper, contract
  from ib.ext.EClientSocket import EClientSocket
  from ib.ext.ScannerSubscription import ScannerSubscription
  import re
  
  
  stocks=[
  '5'
  ]
  
  for x in stocks:
      callback = IBWrapper()             
      tws = EClientSocket(callback)      
      host = "127.0.0.1"
      port = 7496
      clientId = 25
      tws.eConnect(host, port, clientId) 
      create = contract()                
      callback.initiate_variables()
      contract_Details = create.create_contract(x, 'STK', 'SEHK', 'HKD')
      tickerId = 8001
  
      tws.reqFundamentalData(tickerId, 
                        contract_Details,
                        "ReportSnapshot"
                        )
      time.sleep(5)
  
      print(callback.fundamental_Data_data)
      print(callback.fundamental_Data_data.find("AATCA")) 
      print(callback.fundamental_Data_data.find("ACFSHR"))
      print(callback.fundamental_Data_data.find("ADIV5YAVG"))
      print(callback.fundamental_Data_data.find("MKTCAP"))
      print(callback.fundamental_Data_data.find("QTANBVPS"))
      print(callback.fundamental_Data_data.find("REVCHNGYR"))
      print(callback.fundamental_Data_data.find("REVTRENDGR"))
      tws.eDisconnect()
      time.sleep(5) 
  
  tws.eDisconnect()
  </code></pre>
  
  <p>Output:
  It is all in xml format, most fundamental data can be shown.</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;RepportSnapshot Major="1" Minor="0" Revision="1"&gt;
      &lt;CoIDs&gt;
              &lt;CoID Type="RepNo"&gt;AC317&lt;/CoID&gt;
              &lt;CoID Type="CompanyName"&gt;HSBC Holdings plc (Hong Kong)&lt;/CoID&gt;
      &lt;/CoIDs&gt;
      &lt;Issues&gt;
              &lt;Issue ID="1" Type="C" Desc="Common Stock" Order="1"&gt;
                      &lt;IssueID Type="Name"&gt;Ordinary Shares&lt;/IssueID&gt;
                      &lt;IssueID Type="Ticker"&gt;5&lt;/IssueID&gt;
                      &lt;IssueID Type="CUSIP"&gt;G4634U169&lt;/IssueID&gt;
                      &lt;IssueID Type="ISIN"&gt;GB0005405286&lt;/IssueID&gt;
                      &lt;IssueID Type="RIC"&gt;0005.HK&lt;/IssueID&gt;
                      &lt;IssueID Type="SEDOL"&gt;6158163&lt;/IssueID&gt;
                      &lt;IssueID Type="DisplayRIC"&gt;0005.HK&lt;/IssueID&gt;
                      &lt;IssueID Type="InstrumentPI"&gt;312270&lt;/IssueID&gt;
                      &lt;IssueID Type="QuotePI"&gt;1049324&lt;/IssueID&gt;
                      &lt;Exchange Code="HKG" Country="HKG"&gt;Hong Kong Stock                     
  Exchange&lt;/Exchange&gt;
                      &lt;MostRecentSplit Date="2009-03- 
  12"&gt;1.14753&lt;/MostRecentSplit&gt;
              &lt;/Issue&gt;
      &lt;/Issues&gt;
      &lt;CoGeneralInfo&gt;
              &lt;CoStatus Code="1"&gt;Active&lt;/CoStatus&gt;
              &lt;CoType Code="EQU"&gt;Equity Issue&lt;/CoType&gt;
              &lt;LastModified&gt;2018-07-20&lt;/LastModified&gt;
              &lt;LatestAvailableAnnual&gt;2017-12-31&lt;/LatestAvailableAnnual&gt;
              &lt;LatestAvailableInterim&gt;2018-03-31&lt;/LatestAvailableInterim&gt;
              &lt;Employees LastUpdated="2018-03-31"&gt;228899&lt;/Employees&gt;
              &lt;SharesOut Date="2018-07-24" 
   TotalFloat="19882952713.0"&gt;19952507521.0&lt;/SharesOut&gt;
              &lt;ReportingCurrency Code="USD"&gt;U.S. Dollars&lt;/ReportingCurrency&gt;
              &lt;MostRecentExchange Date="2018-07-24"&gt;1.0&lt;/MostRecentExchange&gt;
      &lt;/CoGeneralInfo&gt;
      &lt;TextInfo&gt;
              &lt;Text Type="Business Summary" lastModified="2017-03- 
   06T22:03:17"&gt;HSBC Holdings plc (HSBC) is the banking and financial services 
   company. The Company manages its products and services through four     
   businesses: Retail Banking and Wealth Management (RBWM), Commercial Banking 
   (CMB), Global Banking and Markets (GB&amp;amp;M), and Global Private Banking 
   (GPB). It operates across various geographical regions, which include 
   Europe, Asia, Middle East and North Africa, North America and Latin America. 
   RBWM business offers Retail Banking, Wealth Management, Asset Management and 
   Insurance. CMB services include working capital, term loans, payment 
   services and international trade facilitation, among other services, as well 
   as expertise in mergers and acquisitions, and access to financial markets. 
   GB&amp;amp;M supports government, corporate and institutional clients across the 
   world. GPB's products and services include Investment Management, Private 
   Wealth Solutions, and a range of Private Banking services.&lt;/Text&gt;
              &lt;Text Type="Financial Summary" lastModified="2018-07- 
  20T09:20:11"&gt;BRIEF: For the three months ended 31 March 2018, HSBC Holdings 
  plc (Hong Kong) interest income increased 10% to $7.46B. Net interest income 
  after loan loss provision increased 11% to $7.29B.  Net income applicable to 
  common stockholders decreased 1% to $3.09B. Net interest income after loan 
  loss provision reflects Asia segment increase of 22% to $3.86B, Net Interest 
  Margin, Total -% increase of 2% to 1.67%, Net Interest Spread.&lt;/Text&gt;
      &lt;/TextInfo&gt;
      &lt;contactInfo lastUpdated="2018-07-20T09:20:26"&gt;
              &lt;streetAddress line="1"&gt;8 Canada Square&lt;/streetAddress&gt;
              &lt;streetAddress line="2"&gt;&lt;/streetAddress&gt;
              &lt;streetAddress line="3"&gt;&lt;/streetAddress&gt;
              &lt;city&gt;LONDON&lt;/city&gt;
              &lt;state-region&gt;&lt;/state-region&gt;
              &lt;postalCode&gt;E14 5HQ&lt;/postalCode&gt;
              &lt;country code="GBR"&gt;United Kingdom&lt;/country&gt;
              &lt;contactName&gt;&lt;/contactName&gt;
              &lt;contactTitle&gt;&lt;/contactTitle&gt;
              &lt;phone&gt;
                      &lt;phone type="mainphone"&gt;
                              &lt;countryPhoneCode&gt;44&lt;/countryPhoneCode&gt;
                              &lt;city-areacode&gt;20&lt;/city-areacode&gt;
                              &lt;number&gt;79918888&lt;/number&gt;
                      &lt;/phone&gt;
                      &lt;phone type="mainfax"&gt;
                              &lt;countryPhoneCode&gt;44&lt;/countryPhoneCode&gt;
                              &lt;city-areacode&gt;20&lt;/city-areacode&gt;
                              &lt;number&gt;79924880&lt;/number&gt;
                      &lt;/phone&gt;
              &lt;/phone&gt;
      &lt;/contactInfo&gt;
      &lt;webLinks lastUpdated="2016-11-07T05:00:04"&gt;&lt;webSite mainCategory="Home 
   Page"&gt;http://www.hsbc.com/&lt;/webSite&gt;&lt;eMail mainCategory="Company Contact/E- 
   mail"&gt;&lt;/eMail&gt;&lt;/webLinks&gt;
      &lt;peerInfo lastUpdated="2018-07-20T09:20:26"&gt;
              &lt;IndustryInfo&gt;
                      &lt;Industry type="TRBC" order="1" reported="0" 
   code="5510101010" mnem=""&gt;Banks - NEC&lt;/Industry&gt;
                      &lt;Industry type="NAICS" order="1" reported="0" 
   code="52211" mnem=""&gt;Commercial Banking&lt;/Industry&gt;
                      &lt;Industry type="NAICS" order="2" reported="0" 
   code="52393" mnem=""&gt;Investment Advice&lt;/Industry&gt;
                      &lt;Industry type="NAICS" order="3" reported="0" 
   code="52392" mnem=""&gt;Portfolio Management&lt;/Industry&gt;
                      &lt;Industry type="SIC" order="0" reported="1" code="6035" 
   mnem=""&gt;Federal Savings Institutions&lt;/Industry&gt;
                      &lt;Industry type="SIC" order="1" reported="0" code="6029" 
   mnem=""&gt;Commercial Banks, Nec&lt;/Industry&gt;
                      &lt;Industry type="SIC" order="2" reported="0" code="6282" 
   mnem=""&gt;Investment Advice&lt;/Industry&gt;
              &lt;/IndustryInfo&gt;
      &lt;/peerInfo&gt;
      &lt;officers&gt;
              &lt;officer rank="1" since="01/01/2013"&gt;
                      &lt;firstName&gt;John&lt;/firstName&gt;
                      &lt;mI&gt;Michael&lt;/mI&gt;
                      &lt;lastName&gt;Flint&lt;/lastName&gt;
                      &lt;age&gt;48 &lt;/age&gt;
                      &lt;title startYear="2018" startMonth="02" startDay="21" 
   iD1="CEO" abbr1="CEO" iD2="EDR" abbr2="Exec. Dir."&gt;Chief Executive, 
   Executive Director&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="2" since="09/24/2010"&gt;
                      &lt;firstName&gt;Iain&lt;/firstName&gt;
                      &lt;mI&gt;J.&lt;/mI&gt;
                      &lt;lastName&gt;Mackay&lt;/lastName&gt;
                      &lt;age&gt;56 &lt;/age&gt;
                      &lt;title startYear="2010" startMonth="12" startDay="03" 
    iD1="FID" abbr1="Fin. Dir." iD2="EDR" abbr2="Exec. Dir."&gt;Group Finance 
    Director, Executive Director&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="3" since="08/01/2015"&gt;
                      &lt;firstName&gt;Andy&lt;/firstName&gt;
                      &lt;mI&gt;&lt;/mI&gt;
                      &lt;lastName&gt;Maguire&lt;/lastName&gt;
                      &lt;age&gt;51 &lt;/age&gt;
                      &lt;title startYear="2015" startMonth="08" startDay="01" 
    iD1="COO" abbr1="COO" iD2="MDR" abbr2="Mgng.Dir."&gt;Group Chief Operating 
    Officer, Group Managing Director&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="4" since="11/26/2010"&gt;
                      &lt;firstName&gt;Marc&lt;/firstName&gt;
                      &lt;mI&gt;M.&lt;/mI&gt;
                      &lt;lastName&gt;Moses&lt;/lastName&gt;
                      &lt;age&gt;60 &lt;/age&gt;
                      &lt;title startYear="2014" startMonth="01" startDay="01" 
    iD1="CRO" abbr1="CRO" iD2="EDR" abbr2="Exec. Dir."&gt;Group Chief Risk 
    Officer, Executive Director&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="5" since="NA"&gt;
                      &lt;firstName&gt;Elaine&lt;/firstName&gt;
                      &lt;mI&gt;&lt;/mI&gt;
                      &lt;lastName&gt;Arden&lt;/lastName&gt;
                      &lt;age&gt;49 &lt;/age&gt;
                      &lt;title startYear="NA" startMonth="" startDay="" iD1="MDR" 
   abbr1="Mgng.Dir." iD2="" abbr2=""&gt;Managing Director, Group Head of Human 
   Resources&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="6" since="01/01/2011"&gt;
                      &lt;firstName&gt;Samir&lt;/firstName&gt;
                      &lt;mI&gt;&lt;/mI&gt;
                      &lt;lastName&gt;Assaf&lt;/lastName&gt;
                      &lt;age&gt;57 &lt;/age&gt;
                      &lt;title startYear="2011" startMonth="01" startDay="01" 
    iD1="MDR" abbr1="Mgng.Dir." iD2="" abbr2=""&gt;Group Managing Director, Chief 
    Executive - Global Banking &amp;amp; Markets&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="7" since="NA"&gt;
                      &lt;firstName&gt;Colin&lt;/firstName&gt;
                      &lt;mI&gt;&lt;/mI&gt;
                      &lt;lastName&gt;Bell&lt;/lastName&gt;
                      &lt;age&gt;50 &lt;/age&gt;
                      &lt;title startYear="NA" startMonth="" startDay="" iD1="MDR" 
    abbr1="Mgng.Dir." iD2="" abbr2=""&gt;Managing Director, Group Head of 
    Financial Crime Risk&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="8" since="10/01/2013"&gt;
                      &lt;firstName&gt;Peter&lt;/firstName&gt;
                      &lt;mI&gt;W.&lt;/mI&gt;
                      &lt;lastName&gt;Boyles&lt;/lastName&gt;
                      &lt;age&gt;62 &lt;/age&gt;
                      &lt;title startYear="2013" startMonth="10" startDay="01" 
     iD1="MDR" abbr1="Mgng.Dir." iD2="" abbr2=""&gt;Group Managing Director; Chief 
     Executive of Global Private Banking&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="9" since="08/01/2015"&gt;
                      &lt;firstName&gt;Patrick&lt;/firstName&gt;
                      &lt;mI&gt;J.&lt;/mI&gt;
                      &lt;lastName&gt;Burke&lt;/lastName&gt;
                      &lt;age&gt;56 &lt;/age&gt;
                      &lt;title startYear="2015" startMonth="08" startDay="01" 
    iD1="MDR" abbr1="Mgng.Dir." iD2="" abbr2=""&gt;Group Managing Director; 
    President and Chief Executive of HSBC USA&lt;/title&gt;
              &lt;/officer&gt;
              &lt;officer rank="10" since="08/01/2015"&gt;
                      &lt;firstName&gt;Pierre&lt;/firstName&gt;
                      &lt;mI&gt;&lt;/mI&gt;
                      &lt;lastName&gt;Goad&lt;/lastName&gt;
                      &lt;age&gt;56 &lt;/age&gt;
                      &lt;title startYear="2016" startMonth="" startDay="" 
    iD1="MDR" abbr1="Mgng.Dir." iD2="" abbr2=""&gt;Group Managing Director, Group 
    Head of Employee Insight and Communications&lt;/title&gt;
              &lt;/officer&gt;
      &lt;/officers&gt;
      &lt;Ratios PriceCurrency="HKD" ReportingCurrency="USD" 
    ExchangeRate="7.84640" LatestAvailableDate="2017-12-31"&gt;
              &lt;Group ID="Price and Volume"&gt;
                      &lt;Ratio FieldName="NPRICE" Type="N"&gt;75.05000&lt;/Ratio&gt;
                      &lt;Ratio FieldName="NHIG" Type="N"&gt;86.00000&lt;/Ratio&gt;
                      &lt;Ratio FieldName="NLOW" Type="N"&gt;71.45000&lt;/Ratio&gt;
                      &lt;Ratio FieldName="PDATE" Type="D"&gt;2018-07- 
    25T00:00:00&lt;/Ratio&gt;
                      &lt;Ratio FieldName="VOL10DAVG" Type="N"&gt;12.50806&lt;/Ratio&gt;
                      &lt;Ratio FieldName="EV" Type="N"&gt;2466752.00000&lt;/Ratio&gt;
              &lt;/Group&gt;
              &lt;Group ID="Income Statement"&gt;
                      &lt;Ratio FieldName="MKTCAP" Type="N"&gt;1505191.00000&lt;/Ratio&gt;
                      &lt;Ratio FieldName="AREV" Type="N"&gt;321663.20000&lt;/Ratio&gt;
                      &lt;Ratio FieldName="AEBITD" Type="N"&gt;177752.30000&lt;/Ratio&gt;
                      &lt;Ratio FieldName="ANIAC" Type="N"&gt;86082.85000&lt;/Ratio&gt;
              &lt;/Group&gt;
              &lt;Group ID="Per share data"&gt;
                      &lt;Ratio FieldName="AEPSXCLXOR" Type="N"&gt;4.28869&lt;/Ratio&gt;
                      &lt;Ratio FieldName="AREVPS" Type="N"&gt;27.04842&lt;/Ratio&gt;
                      &lt;Ratio FieldName="ABVPS" Type="N"&gt;74.66691&lt;/Ratio&gt;
                      &lt;Ratio FieldName="ACSHPS" Type="N"&gt;108.96660&lt;/Ratio&gt;
                      &lt;Ratio FieldName="ACFSHR" Type="N"&gt;5.83985&lt;/Ratio&gt;
                      &lt;Ratio FieldName="ADIVSHR" Type="N"&gt;4.01226&lt;/Ratio&gt;
              &lt;/Group&gt;
              &lt;Group ID="Other Ratios"&gt;
                      &lt;Ratio FieldName="AGROSMGN" Type="N"&gt;-99999.99000&lt;/Ratio&gt;
                      &lt;Ratio FieldName="AROEPCT" Type="N"&gt;6.72498&lt;/Ratio&gt;
                      &lt;Ratio FieldName="APR2REV" Type="N"&gt;2.77242&lt;/Ratio&gt;
                      &lt;Ratio FieldName="APEEXCLXOR" Type="N"&gt;17.49954&lt;/Ratio&gt;
                      &lt;Ratio FieldName="APRICE2BK" Type="N"&gt;1.13825&lt;/Ratio&gt;
                      &lt;Ratio FieldName="Employees" Type="N"&gt;228899&lt;/Ratio&gt;
              &lt;/Group&gt;
      &lt;/Ratios&gt;
      &lt;ForecastData ConsensusType="Mean" CurFiscalYear="2018" 
     CurFiscalYearEndMonth="12" CurInterimEndCalYear="2018" 
     CurInterimEndMonth="3" EarningsBasis="PRX"&gt;
              &lt;Ratio FieldName="ConsRecom" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;1.9167&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="TargetPrice" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;86.00753&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjLTGrowthRate" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;6.9100&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjPE" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;13.07573&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjSales" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;433073.04033&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjSalesQ" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;276091.27680&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjEPS" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;5.73964&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjEPSQ" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;1.64774&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjProfit" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;168752.58051&lt;/Value&gt;
              &lt;/Ratio&gt;
              &lt;Ratio FieldName="ProjDPS" Type="N"&gt;
                      &lt;Value PeriodType="CURR"&gt;4.03148&lt;/Value&gt;
              &lt;/Ratio&gt;
      &lt;/ForecastData&gt;
      &lt;/ReportSnapshot&gt;
  
    -1
   8993
   -1
   8486
   -1
   -1
   -1
  </code></pre>