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.
0
Answers
-
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 279 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 716 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- 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
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛