Datastream DSWS combining series with and without currency

Hi, I am trying to run ds.get_data(tickers='USSRXBDFB,USCARTKSO', start='2021-01-01', end='-0D', freq='M') but I get error:
ValueError: Item must have length equal to number of levels.
It looks like the first ticker gives a currency level and the 2nd ticker doesn't - is there a way to run these series together in one request? This seemed to work fine until recently.
Best Answer
-
Hello @scott.barber , @haibo.chen , @Gurpreet, @raksina.samasiri,
Please be informed:
"... We have put a change in place to remedy this
This issue was due to null currency for some instruments. The currency displayed will be 'NA' in case of null currency, instead of exceptions while uploading data to dataframe. We have uploaded the new version 1.0.10. "
0
Answers
-
Hi @scott.barber ,
There must be some other issue. The query works fine for me:
>>> ds.get_data(tickers='USSRXBDFB,USCARTKSO', start='2021-01-01', end='-0D', freq='M')
Instrument USSRXBDFB USCARTKSO
Field
Dates
2021-01-15 327.796 16.778
2021-02-15 316.879 15.930
2021-03-15 344.077 17.640
2021-04-15 342.689 18.300
2021-05-15 339.043 16.890
2021-06-15 344.230 15.473
2021-07-15 338.013 14.666
2021-08-15 346.884 13.087
2021-09-15 349.714 12.215
2021-10-15 NaN 12.989
2021-11-15 NaN NaN0 -
Update, The latest version of DSWS module (1.1.0) has modified the response and is now returning a multiindex instead of single index which was the case in previous version (1.0.9).
There is no different in the JSON request and response from the server and this new index is added at the module level. To get the same desired response, please drop the Currency index from the dataframe and merge them as shown:
df1 = ds.get_data(tickers='USSRXBDFB', start='2021-01-01', end='-0D', freq='M').droplevel('Currency', axis=1)
df2 = ds.get_data(tickers='USCARTKSO', start='2021-01-01', end='-0D', freq='M')
print(df1.merge(df2, on=['Dates']))
Instrument USSRXBDFB USCARTKSO
Field
Dates
2021-01-15 327.796 16.778
2021-02-15 316.879 15.930
2021-03-15 344.077 17.640
2021-04-15 342.689 18.300
2021-05-15 339.043 16.890
2021-06-15 344.230 15.473
2021-07-15 338.013 14.666
2021-08-15 346.884 13.087
2021-09-15 349.714 12.215
2021-10-15 NaN 12.989
2021-11-15 NaN NaN0 -
Thanks @Gurpreet this works. Is there a reason for the change? Seems like an additional complication.
0 -
0
-
@Gurpreet I have similar issue when running below with version 1.1.0. it has been working until the upgrade. It is a hassle to call get_data() one ticker at a time, esp given currency is identical across tickers in my case. Any way to allow calling get_data() with MULTIPLE tickers like we were able to do in the past? Or are you going to allow this feature in your future development? thx
df = ds.get_data(
'CLCURBALA,CTCURBALA',
fields=['DPL#(4*MAV#(X~USD*X(ESMAG)/1000000.0,1Y),4)'],
start=start.strftime('%Y-%m-%d'),
freq='Q')
0 -
Hello @haibo.chen ,
In full alignment with the approach as suggested by @Gurpreet, you can group the instruments enriched with the currency information, together, and the instruments that are not, together, as well. For example:
df1 = ds.get_data(tickers='USSRXBDFB,VOD', start='2021-01-01', end='-0D', freq='M')
df2 = ds.get_data(tickers='USCARTKSO', start='2021-01-01', end='-0D', freq='M')
print(df1.merge(df2, on=['Dates']))resulting in:
(USSRXBDFB, , U$) (VOD, , £) (USCARTKSO, )
Dates
2021-01-15 327.796 120.94 16.778
2021-02-15 316.879 126.40 15.930
2021-03-15 344.077 123.64 17.640
2021-04-15 342.689 133.66 18.300
2021-05-15 339.043 136.80 16.890
2021-06-15 344.230 128.26 15.473
2021-07-15 338.013 121.70 14.666
2021-08-15 347.213 116.80 13.087
2021-09-15 348.838 122.26 12.215
2021-10-15 354.388 112.20 12.989
2021-11-15 NaN 109.36 NaN0 -
Agree with @haibo.chen that while this is a solution it is an annoying extra step, especially when I have a long list of tickers. I have to go through and see which ones have currency.
0 -
@zoya faberov @scott.barber this is not only inconvenient, this is problematic. in my example,
df = ds.get_data('CLCURBALA,CTCURBALA',fields=['DPL#(4*MAV#(X~USD*X(ESMAG)/1000000.0,1Y),4)'],...) if the ticker raw data has currency in USD, it comes back with currency (CLCURBABA), but if it is in non-USD currency, it comes back with no currency. I have to spend huge amount of time to GO THROUGH the list. The way the package releases are managed is NOT PROFESSIONAL. it should be backward-compatible, and if not, it should raise future warning, or provide a way (such as an additional argument) to allow users, in this case, to ignore currency.
0 -
Hello @scott.barber and @haibo.chen ,
We appreciate your feedback!
We have conveyed your information and suggestions to Datastream product management, for review and consideration.
The feedback from valued customers helps us to continuously improve and actively evolve our products and APIs.
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 683 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 626 Refinitiv Data Platform Libraries
- 5 LSEG Due Diligence
- 1 LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 84 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛