How to Get Data from AWS instead of TRTH server using REST API
Answers
-
@pj4, glad to hear you solved it :-)
I agree fully with your comment on the polling wait time, and appreciate the fact that you are considerate about the server load. It is true that every single request is a load on the servers.
There is a trade-off to make between placing an unnecessary burden on the server and optimizing run times. I ran your sample with the parameter files you sent, for 5 FIDs and 10 base RICs. In all it took more than 15 hours to run. The average time was 11.6 minutes, fastest was 5 minutes, slowest was 30 minutes. 50% of all extractions took between 6 and 8 minutes. In these circumstances, a polling time of 5 minutes seems more appropriate than one of 15 minutes, it allows your program to terminate significantly faster without adding undue burden on our servers.
0 -
Thanks for analyzing the code/requests/time taken in this much detail. and providing insights out of it.
One more issue that i have faced many times is below:
Error Message: File "THR_TimeZoneMapped_Integrated_Modules_AWS1.py", line 458, in requestCode
shutil.copyfileobj(rr, fd, chunk_size)
IOError: [Errno 22] Invalid argumentThe line 458 is: shutil.copyfileobj(rr, fd, chunk_size)
It seems that the issue is while writing the data into file. Any idea why we get it?
While trying to extract the downloaded gzip file, it got extracted but with some error. And in the extracted file the last element seems some incorrect timestamp (snapshot attached) file incorrect-timestamp.png
0 -
@pj4, I just looked at 10 (out of 50) of the files I downloaded using your code. All zips opened correctly, and all CSVs inside ended correctly, no issues. I also did not see that error when running the code.
The code I have to retrieve and save the gzipped files is this (and useAws is true):
r5 = requests.get(requestUrl,headers=requestHeaders,stream=True)
r5.raw.decode_content = False
...
fileName = filePath0 + dateforfilename+".csv.gz"
chunk_size = 1024
rr = r5.raw
with open(fileName, 'wb') as fd:
shutil.copyfileobj(rr, fd, chunk_size)
fd.closeI have less code lines than you, there must be a difference between our codes. Can you post your latest THR_TimeZoneMapped_Integrated_Modules_AWS1.py code please, with the associated params.xlsx ?
Please also post a GZIP file that exhibits the issue. Attachments are limited to 500KB; if your file is larger (but smaller than 10MB) send it to me (christiaan.meihsl@tr.com) directly.
0 -
I tried to send you the mail since the gzip file size was more than 500KB but it didn't get delivered due to "file size violation" issue.
However, i attached the latest code and params files here for your reference. 2415-code-and-params.zip
0 -
@pj4, I will try running your new code and see what happens.
0 -
@pj4, looking at the latest code you sent I see the final request r5 for data retrieval is still made in all cases.
This requires correcting, because it should only be done if the preceding HTTP status was 200 and the JobId variable assigned.0 -
@pj4, I have been running your latest code with the latest params file on my PC since midday, with a few debugging traces added. Up to now 4 data files were produced (LC fids 70, 64, 54, 15). There were no errors, the gzip files are healthy, the CSV extracts fine and its last timestamp is correct. I will be out of office tomorrow, so I'll come back to you with the other results on Monday.
0 -
@pj4, I ran your latest code with your params file. My PC rebooted for an update in my absence, so I could not see the console output, but it seems to have worked fine: all gzips were created and can be opened, CSV files can be extracted, their content looks fine. I opened the gzip files using winrar.
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
- 280 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
- 717 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 中文论坛