Python Asynchronous Alternative to Polling in Tick History?
timesales-futures-demo.txt attached is a python demo to download some futures time/sales data. The example uses the polling described in your sample tutorial code. However, is there an alternative way to just post a bunch of requests, store the requestid, and then retrieve these results at a later time (e.g. skipping the pausing/polling step)? In the old version of tick history you could submit a bunch of requests. For each request you would get back a request id and then sometime later you could come back to request to download the requestid, provided it had finished populating. Can you describe how this works in the new service? i.e. there used to be ability to make multiple asynchronous calls.
Best Answer
-
Yes, this is possible:
- Issue the request as you normally do, but add the header: "Prefer: respond-async; wait=0". This will force the server to return once the request has been accepted without waiting.
- The response will include a monitor URL, like Location: .../Extractions/ExtractRawResult(ExtractionId='0x05806d0534ac2064')
- You can invoke that URL any time in the future (within 7 days of the initial request) to either get the status if it is not complete or have the results returned.
The monitor location is the handle to your job results. Do not parse this or use any id's returned, just use the monitor URL as-is since we may change this at any time.
In the link above there is a section on in-flight job management for an alternative approach.
1
Answers
-
I found a similar response re asynchronous calls via here:
-------------------------------------------------------------------
Answer by Christiaan Meihsl Jan 31 at 04:00 AM
In a nutshell: yes, and this is a desirable feature.
In detail: the DSS REST API asynchronous mechanism is designed to support long running requests, which pose several problems:
- they require the connection to remain open for the duration of the request (firewalls might close idle connections).
- the user code must maintain a running process for the duration of the request, which could be quite long for large data amounts.
- long running requests drive the need for periodic status updates and the ability to cancel the request.
The DSS REST API conforms to OASIS OData standards for async. In addition to the standard asynchronous protocol defined by OData, which supports polling and status and progress updates, we added the ability to cancel a request, as well as manage the list of active asynchronous jobs.
To avoid data retrieval issues, the recommend practice is to use the asynchronous mechanisms. Using synchronous mechanisms might result in issues, especially when requesting large data sets. The typical symptom will be data requests that timeout without returning any data; this can occur randomly, as the server load influences extraction times.
-------------------------------------------------------------------
This appears to describe the type of calls I wish to issue against the service. However, I do not see a comparable python example. Can you explain what needs to be modified in my example python code to let the service know I am making an asynchronous call?
0 -
Thanks, Troy!
0 -
Actually, when I run the request ...
r3 = requests.get(requestUrl,headers=requestHeaders)
If I print (r3) I get back the response code 202. Do you know what I need to call on r3 to get back this URL you say should look like .../Extractions/ExtractRawResult(ExtractionId='0x05806d0534ac2064')?
Nevermind -- that appears to just be available via :
r3.url or via r2.headers["location"]
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
- 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 中文论坛