title: Bloomberg APIs - historical index members in Python
body: <p>I'm trying to get index members using Bloomberg APIs in Python. I have no issues getting current constituents, but I want a historical list (<em>example: what where Russell 1000 or S&amp;P 500 constituents as of Q1 1995</em>).</p>
  <p>To get the current index members I can use following:</p>
  <p>In excel I can use INDX_MEMBERS to get the constituents:</p>
  <pre><code>=BDS(&quot;Index Ticker&quot;, INDX_MEMBERS)
  </code></pre>
  <p>In Python:</p>
  <pre><code>import pybbg
  
  def Main():
      bbg = pybbg.Pybbg()
      IndexConst = bbg.bds('IndexName', 'INDX_MEMBERS')
  </code></pre>
  <p>or:</p>
  <pre><code>from tia.bbg import LocalTerminal
  
  resp = LocalTerminal.get_reference_data(index_ticker + ' INDEX', 'INDX_MEMBERS')
  members = resp.as_frame().iloc[0,0]
  </code></pre>
  <p>Question is how can I get historical index members/constituents. For example I would generate quarterly dates and then I want to know list of constituents for each date.</p>
  <p>['2020-06-30',
  '2020-03-31',
  '2019-12-31',
  '2019-09-30',
  '2019-06-30',
  '2019-03-31',
  '2018-12-31' ... '1980-06-30',]</p>
  <p>I've tried many solutions, including one below where I'm getting an empty frame:</p>
  <pre><code>from tia.bbg import LocalTerminal
  
  date_start = datetime.date(2010,6,28)
  date_end = datetime.date(2020,6,28)
  
  members_russell1000_3 = LocalTerminal.get_historical('RIY Index', 'INDX_MEMBERS',start=date_start, end=date_end,).as_frame()
  </code></pre>
  <p>or the solution below, where regardless of date (now or 20 years ago) I'm receiving the same list of constituents:</p>
  <pre><code>from xbbg import blp
  
  members =  blp.bds('RIY Index', 'INDX_MEMBERS', DVD_Start_Dt=k[1], DVD_End_Dt=k[1])
  </code></pre>
  <p>Variable Explanation to above examples:</p>
  <ul>
  <li>'RIY Index' - Russell 1000 index ticker</li>
  <li>'INDX_MEMBERS' - Bloomberg field (flds) for list of index constituents</li>
  </ul>
  <p>Alternatively I would be happy if I could get historical list of changes to index constituents with dates (I already have current constituents)</p>