16 0 0 2

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.

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.

1 Answer

32.2k 40 11 19

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_summaries_async('VOD.L', interval = rdp.Intervals.TEN_MINUTES),
    rdp.HistoricalPricing.get_summaries_async('VOD.L', interval = rdp.Intervals.DAILY)    

historical_events, intraday_summaries, interday_summaries = tasks._result

print("\nHistorical Pricing Events")

print("\nHistorical Pricing Summaries - Intraday")

print("\nHistorical Pricing Summaries - Interday")

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 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.