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 calice.l · Apr 02, 2021 at 11:24 AM · datastream-apiricsdsws-apisymbologymnemonics

how to convert rics or symbols to mnem for dsws?

hi,

I am trying to retrieve historical price data for a list of instruments with python Eikon and datastream. My dynamic list of instruments come from Eikon port


TotalList=(['Portfolio(0867/*Total List*/)'])
dataset, err=ek.get_data(TotalList,['tr.PriceClose'])
rics1 =pd.DataFrame(dataset.loc[:1,'Instrument'])
rics2 = rics1["Instrument"]
rics3 = rics2.tolist()


How do I convert the list of symbols to a list of mnemonics so that I can pass it through to a datastream query?:


ds=dsws.Datastream(username=xxxxxxxxxxxxxx,password='xx')
 
 df=ds.get_data (tickers='mnemonics',
 fields=['P'], start='2018-01-01', end='2018-01-10', freq='D')


Many thanks

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.

3 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Alex Putkov.1 · Apr 02, 2021 at 08:31 PM

@calice.l

According to the function signature, the tickers argument of get_data method of dsws library cannot be a list. It must be a string of comma separated symbols. Try

df, err = ek.get_data('Portfolio(SAMPLE_RU_LRGCORE)',['TR.CommonName'])
df['DatastreamRICs'] = '<' + df['Instrument'] + '>'
ds_rics_str = df['DatastreamRICs'].str.cat(sep=',')
ds.get_data(ds_rics_str, fields=['P'], 
            start='2018-01-01', end='2018-01-10', freq='D')

Note that the max number of symbols for get_data method of dsws library is 50. If your portfolio has more than 50 constituents, you need to split it into chunks of 50.

Comment

People who like this

0 Show 2 · 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.

avatar image
calice.l · Apr 03, 2021 at 07:48 AM 0
Share

again, that worked well (for my equity dataset), thanks!

However I'm also trying to retrieve historical pricing for a number of fixed income instruments that have matured. so I'm using

fields =['TRPA']


which does not work with "<RICs>". Is there another workaround for converting RICs to Datastream mnemonics (or is this another misunderstanding?)?

avatar image
REFINITIV
Alex Putkov.1 ♦♦ calice.l · Apr 03, 2021 at 05:29 PM 0
Share

I'm not sure I understand the scenario. Matured bonds don't have RICs. RICs for instruments that become inactive are removed from Refinitiv Real-Time network. If you have ISIN for the bond, you can use it to retrieve price history for that bond from Datastream, e.g.

ds.get_data('XS1035001921', fields=['MPD'], 
            start='2019-03-01', end='2019-04-01')

Note that in the above example I used ISIN for a bond that matured on 2019-04-18.

And if for whatever reason you need Datastream mnemonic for this bond, you can get it using

ds.get_data('XS1035001921', fields=['MNEM'], kind=0)
avatar image
REFINITIV
Answer by Alex Putkov.1 · Apr 02, 2021 at 06:08 PM

You don't need to convert RICs to Datastream mnemonics. You can use RICs in get_data method of DSWS library by enclosing each RIC into angle brackets, e.g.

ds.get_data('<MSFT.O>,<AAPL.O>,<IBM.N>', fields=['P'], 
            start='2018-01-01', end='2018-01-10', freq='D')
Comment

People who like this

0 Show 1 · 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.

avatar image
calice.l · Apr 02, 2021 at 07:04 PM 0
Share

Hi Alex,

thanks for the input!

Obviously new to this and still doing something wrong:

TotalList=(['Portfolio(500867312/*Total List*/)'])
dataset, err=ek.get_data(TotalAssetList,['tr.PriceClose'])
rics1 =pd.DataFrame(dataset.loc[:,'Instrument'])

rics1["Instrument"]='<'+rics1+'>'

rics2 = rics1["Instrument"]

rics3 = rics2.tolist()

df=ds.get_data (tickers=rics3,
fields=['ER#S'], start='2018-01-01', end='2018-01-10', freq='D')


print(df)


get_data : Exception Occured

(<class 'AttributeError'>, AttributeError("'list' object has no attribute 'rfind'"), <traceback object at 0x00000190C20DC3C0>)



avatar image
Answer by calice.l · Apr 03, 2021 at 05:32 PM

thanks, had just realised that ISIN will provide data needed!

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

How do extract symbols that fulfil regex criteria in datastream?

How can I download data from DataStream API knowing the Mnemotic which has not a corrispondent RIC?

Datastream Web Service: how to get a DSCode based on ISIN and Currency

Converting Mnemonic to RIC and getting timeseries data (RI and NR) with EIKON Data API

multiple reuters code for one branch

  • 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
  • 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
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges