Potential bug issue with DSWS getting inconsistent results
Hi I am pulling historical price and yield information for a set of 6,068 bonds using the Datastream Enterprise API. I have defined a function (using previous suggestions here) to bypass the 50 instrument limit (picture 1).
When I run this code it works fine but I am getting inconsistent results each time. For example the results for Interest Yield (IY) the first time returned information on 5927 instruments, but the second time returned information on 6021 instruments. My code is exactly the same each run which makes me think that there is a bug issue that causes the data to change each time.
Has this issue been found before? Does anyone have any suggestions on how to fix this?
Best Answer
-
Thank you for the list.
I found that sometimes the server returned the error messages.
Object reference not set to an instance of an object.
MainframeAccessPoint error.Timed out waiting for activity from service.Therefore, the code needs to check for it and then re-requests to get the data. I have modified the code, as shown below.
def load_data():
dataframes_list = []
for x in list_of_fields:
print(x)
print(tickers_of_interest_lst[0], 1)
df = ds.get_data(tickers = tickers_of_interest_lst[0],
fields=[x],start='1992-01-31', end='2021-07-26').T
print(df.shape)
for i in tickers_of_interst_chunks:
print(i[0],"...", i[len(i)-1], len(i))
_df = ds.get_data(tickers = ','.join(i),
fields=[x],
start='1992-01-31',
end='2021-07-26').T
print(_df.shape)
while _df.shape[0] < len(i):
if "Value" in _df.index:
print(_df.loc["Value",0])
print(i[0],"...", i[len(i)-1], len(i))
_df = ds.get_data(tickers = ','.join(i),
fields=[x],
start='1992-01-31',
end='2021-07-26').T
print(_df.shape)
df = df.append(_df)
dataframes_list.append(df)
return dataframes_listIt will re-request when the number of rows in the dataframe is not equal to the number of items in the request message.
Please be informed that it is just a sample code so it may not be able to cover all issues.
0
Answers
-
@vy.nguyen
Could you please share the list.txt file? Therefore, we can try to run it and verify the result.
0 -
0
-
@jirapongse.phuriphanvichai
Thanks much. In trying the code again, I'm still running into the error message below. Could you help troubleshoot further?
MPD 244YWE 1 (1, 7692) 2445GY ... 837KW6 50 (50, 7692) 819C6N ... 7058DJ 50 (50, 7692) 218062 ... 5961NV 50 (50, 7692) 2100AL ... 595739 50 (50, 7692) 60867W ... 7998WX 50 (50, 7692) 5601LW ... 646F3A 50 (50, 7692) 851GTP ... 783XFG 50 (50, 7692) 7994HJ ... 49020F 50 (50, 7692) 786KY8 ... 606NMD 50 (50, 7692) 801ZX6 ... 79882E 50 (50, 7692) 21834H ... 234A2E 50 (50, 7692) 206AAH ... 8607DZ 50 (50, 7692) 723278 ... 832GX5 50 (50, 7692) 232AZ2 ... 222CAC 50 (50, 7692) 607ZW6 ... 838XF0 50 (50, 7692) 633J2G ... 3678V4 50 (50, 7692) 797YL1 ... 5772VF 50 (50, 7692) 5771R8 ... 5772TW 50 (50, 7692) 5772T3 ... 5772V3 50 (50, 7692) 5771VE ... 5771UN 50 (50, 7692) 5771UX ... 818Z3A 50 (50, 7692) 22325A ... 231XVD 50 (50, 7692) 19445W ... 831X75 50 get_data : Exception Occured (<class 'requests.exceptions.SSLError'>, SSLError(MaxRetryError('HTTPSConnectionPool(host=\'product.datastream.com\', port=443): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/GetData (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, \'Unexpected EOF\')")))')), <traceback object at 0x000001BECFBEE300>) NoneTraceback (most recent call last): File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\contrib\pyopenssl.py", line 485, in wrap_socket cnx.do_handshake() File "c:\Users\vnguyen\ofrconda\lib\site-packages\OpenSSL\SSL.py", line 1934, in do_handshake self._raise_ssl_error(self._ssl, result) File "c:\Users\vnguyen\ofrconda\lib\site-packages\OpenSSL\SSL.py", line 1664, in _raise_ssl_error raise SysCallError(-1, "Unexpected EOF") OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\connectionpool.py", line 376, in _make_request self._validate_conn(conn) File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\connectionpool.py", line 994, in _validate_conn conn.connect() File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\connection.py", line 352, in connect self.sock = ssl_wrap_socket( File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\util\ssl_.py", line 370, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\Users\vnguyen\ofrconda\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\connectionpool.py", line 719, in urlopen retries = retries.increment( File "c:\Users\vnguyen\ofrconda\lib\site-packages\urllib3\util\retry.py", line 436, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='product.datastream.com', port=443): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/GetData (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\Users\vnguyen\ofrconda\lib\site-packages\DatastreamDSWS\DS_Response.py", line 172, in get_data json_Response = requests.post(getData_url, json=json_dataRequest, File "c:\Users\vnguyen\ofrconda\lib\site-packages\requests\api.py", line 119, in post return request('post', url, data=data, json=json, **kwargs) File "c:\Users\vnguyen\ofrconda\lib\site-packages\requests\api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "c:\Users\vnguyen\ofrconda\lib\site-packages\requests\sessions.py", line 530, in request resp = self.send(prep, **send_kwargs) File "c:\Users\vnguyen\ofrconda\lib\site-packages\requests\sessions.py", line 643, in send r = adapter.send(request, **kwargs) requests.exceptions.SSLError: HTTPSConnectionPool(host='product.datastream.com', port=443): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/GetData (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')")))---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-e76653d54b16> in <module>
----> 1 time_series = load_data()
<ipython-input-10-2899a03b5d0d> in load_data()
18 print(i[0],"...", i[len(i)-1], len(i))
19 ---> 20 _df = ds.get_data(tickers = ','.join(i),
21 fields=[x],
22 start='1992-01-31',
AttributeError: 'NoneType' object has no attribute 'T'0 -
How often does the problem occur?
From the error message, it looks like to be a connection issue.
Exception Occured (<class 'requests.exceptions.SSLError'>, SSLError(MaxRetryError('HTTPSConnectionPool(host=\'product.datastream.com\', port=443): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/GetData (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, \'Unexpected EOF\')")))'))
0
Categories
- All Categories
- 6 AHS
- 39 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
- 370 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
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛