Dsws unable to perform more than one bundle request
I am trying to request several bundles of data through pythons Datastreamdsws module, the first request processes perfectly, but when I iterate for the second and subsequent try it fails with the following error.
get_bundle_data : Exception Occured
(<class 'TypeError'>, TypeError("argument of type 'NoneType' is not iterable"), <traceback object at 0x000001D0E2929240>)
Traceback (most recent call last):
File "C:\Users\user\miniconda3\envs\test\lib\site-packages\DatastreamDSWS\DS_Response.py", line 209, in get_bundle_data
if 'DataResponses' in json_Response:
TypeError: argument of type 'NoneType' is not iterable
None
I have tried adding in some sleep time(60 seconds) to help slow it down but regardless it still happens.
I understand I can run a single request but this seems faster and better for our workflow. So I want to make it work.
Is there a way to disconnect are reconnect? or some other alternative, because I can run the script, then rerun again immediately and it works fine.
Alternatively, is there a function in the new RD Library which could replace my request?
I note in the documentation for dsws bundle request that there is a maximum of 100x5. I am operating in that with all requests having 20 tickers and 5 fields (100) and a maximum of 5 requests (500).
Here is the code I am running:
reqs =[]
for i in range(6):
for i in range(len(ticker_str_list)):
reqs.append(ds.post_user_request(tickers=ticker_str_list[i], fields=['P','ISOCUR','P.U','PI','RI'], start=calc_date, end=calc_date, kind=0)
sd = ds.get_bundle_data(bundleRequest=reqs)
successful 'sd' output example which happens on first request:
[100 rows x 5 columns], Instrument Datatype Value Currency Dates
0 <JYPE.NS> P 2.45 IR 2022-09-13
1 <GIBG.F> P 93 E 2022-09-13
2 <0503.HK> P 1.17 K$ 2022-09-13
3 <4942.TW> P 37.15 TW 2022-09-13
4 <AMA.MC> P 51.44 E 2022-09-13
.. ... ... ... ... ...
95 <HCH.AX> RI 13.41 A$ 2022-09-13
96 <CHDRAUIB.MX> RI 176.72 MP 2022-09-13
97 <1972.HK> RI 154.58 K$ 2022-09-13
98 <NEXT.TO> RI 60.41 C$ 2022-09-13
99 <CRDE.PK> RI 84.23 U$ 2022-09-13
Version:
datastreamdsws 1.0.10
Best Answer
-
Thanks for reaching out to us.
You may need to empty the reqs array for each get_bundle_data request.
The code looks like this:
for i in range(6):
reqs =[]
for i in range(len(ticker_str_list)):
reqs.append(ds.post_user_request(tickers=ticker_str_list[i], fields=['P','ISOCUR','P.U','PI','RI'], kind=0))
sd = ds.get_bundle_data(bundleRequest=reqs)Please feel free to reach out if you have any further questions.
1
Answers
-
Thanks, this was a great help0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛