Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Datastream /
avatar image
Question by danieluphromes · Aug 31, 2021 at 10:43 AM · pythondatastream-apidsws-apidatastreamconstituents

Can I use Datastream API (DSWS) to collect historical constituent data?

Can I use Datastream API (DSWS) in Python to collect constituent data such as weights in the past?

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by raksina.samasiri · Aug 31, 2021 at 11:04 AM

Hi @danieluphromes ,

Yes, to get the constituent list in the past, you can put

  • the date in format 'mmyy' after the symbol
  • then follow them with '|L' to get the list of constituents

For example, to get the list of S&P 500 constituents on Jan 2021, tickers = 'LS&PCOMP0121|L' can be used.

here's the Python code

import DatastreamDSWS as DSWS
 
# set datastream username and password
ds = DSWS.Datastream(username = '# DSWS USERNAME #', password = '# DSWS PASSWORD #')
 
# call Datastream to get a list of RICs
dat = ds.get_data(tickers='LS&PCOMP0121|L', fields=['RIC'], kind=0)
print(dat)

and here's an example, in case you would like to get the historical data of multiple months

# crate list of months and years to fetch a list of RICs on each month
mmyy_list = ['0100','0200','0300','0521']
 
# call Datastream to get RICs list
rics_list = {}
for mmyy in mmyy_list:
    dat = ds.get_data(tickers=f'LS&PCOMP{mmyy}|L', fields=['RIC'], kind=0)
    # save rics list in python dict
    rics_list[mmyy] = dat['Value'].tolist()

Hope this could help.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
8 People are following this question.

Related Questions

Get constituents for equity index at historic moment in time

Get time series data for each constituent in an equity index

[Possible Issue] Date index seems to be off by a single day.

Can't access Datastream from python

How can I use Python's Datastream DSWS to collect data above the limit of 50 instruments?

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • FX Venues
    • FX Trading – RFQ Maker
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • Yield Book Analytics
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges