question

Upvotes
Accepted
11 0 0 3

Synchronous method with asynchronous map

Hi, I'm using the Refinitiv Data Plataform for python and I was wondering if there is any, functional or structural, difference between use map_async with rdp.HistoricalPricing.get_summaries insted of

rdp.HistoricalPricing.get_summaries_async with asyncio.

pythonrdp-apiasynchronous
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@sylvio.campos

Hi,

Thank you for your participation in the forum.

Is the reply below satisfactory in answering your question?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Hi, Jirapongse.


To be honest, the answering bellow is not really an answer to my question.

And, the Asynchronous code from the Github of the new library suggested does not work properly.

https://github.com/Refinitiv-API-Samples/Example.DataLibrary.Python/blob/main/Examples/2-Content/2.01-HistoricalPricing/EX-2.01.02-HistoricalPricing-ParallelRequests.ipynb

Bests,

SCN

Hello @sylvio.campos ,

We regret to hear that this answer is not what you are looking for.

Regarding your report that the example does not work properly, we appreciate being informed about this, and would like to reproduce and investigate the issue.

Please submit the details on what does not work and how to reproduce the scenario, either by opening an issue on GitHub, then you would be communicating issue directly to RD Library team, or by adding the description of the issue and how to reproduce it here, and we will try to reproduce the issue that you observe and let you know the results on our side.

Show more comments

hi @sylvio.campos ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

1 Answer

· Write an Answer
Upvote
Accepted
32.2k 40 11 20

Hello @sylvio.campos ,

Let me try to help:

Please refer to example Example.RDPLibrary.Python/2.1.0 - Content - HistoricalPricing - Synchronous.ipynb to see an example of get_summaries synchronous call.

Please refer to example Example.RDPLibrary.Python/2.1.1 - Content - HistoricalPricing - Asychronous.ipynb to see asynch call parallelized:

tasks = asyncio.gather(
    rdp.HistoricalPricing.get_events_async('VOD.L'),
    rdp.HistoricalPricing.get_summaries_async('VOD.L', interval = rdp.Intervals.TEN_MINUTES),
    rdp.HistoricalPricing.get_summaries_async('VOD.L', interval = rdp.Intervals.DAILY)    
)

asyncio.get_event_loop().run_until_complete(tasks)
historical_events, intraday_summaries, interday_summaries = tasks._result

print("\nHistorical Pricing Events")
display(historical_events.data.df)

print("\nHistorical Pricing Summaries - Intraday")
display(intraday_summaries.data.df)

print("\nHistorical Pricing Summaries - Interday")
display(interday_summaries.data.df)

The synch call returns once the processing is completed and if you have several calls to run, they would have to be run sequentially.

With asynch, if you have several calls to run, allows you to start them in parallel and run until they are complete.

Hope that this information is of help, and additionally, would suggest to consider Refinitiv Data Library Python, the next generation of RDP Library currently in pre-release with complete deck of starter examples made available on GitHub https://github.com/Refinitiv-API-Samples/Example.DataLibrary.Python and documentation on dev portal:

Refinitiv Data Library for Python

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.