question

Upvotes
Accepted
3 1 1 2

RDP asyncio.gather / HistoricalPricing.get_summaries_async / Dynamic tasks

Hello,

It seems rdp.HistoricalPricing.get_summaries_async function supports single universe. I am looking for dynamically requesting multiple universes using it. Can I find sample code in Python?

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

Hello @kazuhisa

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

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


Upvotes
Accepted
25.3k 87 12 25

Hi @kazuhisa

The current RDP Python library does not support multiple RICs only a single one - for the above functionality.
The newer RD Python library will support multiple RICs for the equivalent of the above function e.g.

tasks = asyncio.gather(
    historical_pricing.events.Definition(['VOD.L','BT.L']).get_data_async(),
    historical_pricing.summaries.Definition('AAPL.O').get_data_async(),
    historical_pricing.summaries.Definition('MSFT.O').get_data_async()
)
asyncio.get_event_loop().run_until_complete(tasks)
voda_bt, apple, microsoft = tasks.result()
print("\nVodafone  + BT")
display(voda_bt.data.df)

Examples and tutorials etc for the new RD Python Library should be available on GitHub and Dev Portal in the coming weeks.


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.

Upvotes
43 2 6 9

Thank you very much for sharing the good news!

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.

Upvotes
43 2 6 9

quick question to enable refinitiv-data, do I need to adjust app-key for this? got the following message.

ValueError: Change default 'app-key' value in config. App key value: DEFAULT_WORKSPACE_APP_KEY
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.

Upvotes
14.2k 30 5 10

Hi @Zuka1 ,

Is the code running in Codebook? if so, can you try to update the app-key from DEFAULT_WORKSPACE_APP_KEY to DEFAULT_CODE_BOOK_APP_KEY

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.

Upvotes
43 2 6 9

Hello..

I am not using codebook, purely using it as RDP... what is the required change?

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.

Upvotes
14.2k 30 5 10

Hi @Zuka1 ,

Then please try to use the app key. To generate it, you can follow this quick start guide

1638504997565.png

hope this could help


1638504997565.png (41.6 KiB)
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.

Upvotes
43 2 6 9

I am using MachineID, I thought App-key & user name is the same for machineID users. please let me know to create app key for machine ID?

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.

Upvotes
25.3k 87 12 25

Hi @Zuka1

Please see the screenshot above from my colleague - this shows the link on the quick start page which can be used to generate an AppKey.


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.

Upvotes
43 2 6 9

Hello..

I think I need to modify config (refinitiv-data.config.json) file..

I changed default session to platform.default, put username/password on it. it seems it went to RDP for historical. what is the correct use-case to switch TREP and RDP?


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.

@Zuka1

Can you please post your actual code segment and your error? I noticed you are referring to get_summaries_async and @umer.nalla did not. Yet, you didn’t comment on his example so I really don’t know what we’re working with here.

if you are work8ng with Umer’s example, can you please simplify it for a single request and post your error? And if you are using a config file, include that - no need to display your credentials.

Upvotes
43 2 6 9

スクリーンショット-2021-12-07-91614.pngIt seems get_data access to TREP instead of RDP?


refinitiv-data.config.json:

"sessions": {

"default": "platform.default",

"platform": {

"default": {

"app-key": "xxxx",

"username": "xxxx",

"password": "xxxx",

"auto-reconnect": true,


historical access seems good.スクリーンショット-2021-12-07-92018.png


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.

Upvotes
25.3k 87 12 25

Hi @Zuka1

The rd.get_data() is connecting to the RDP Streaming Service- Refinitiv Real-Time Optimized - which includes a Websocket interface.

Do you actually receive any data back for the get_data() call? If not, do you see any error - it could be your RDP credentials are not licenced for streaming data?

If you want to try and snap non-streaming data from the RDP platform instead then you can try the following:

response = rd.content.pricing.Definition(
    ['EUR=', 'GBP=', 'JPY=', 'CAD='],
    fields=['BID', 'ASK']
).get_data()


if (response.is_success):
    display(response.data.df)
else:
    print(response.http_status)



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.

Upvotes
43 2 6 9

スクリーンショット-2021-12-07-201752.png

I got data via your sample but not worked other sample of the rd.get_data() function.


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.

Hi @Zuka1

As explained above, the rd.get_data() call is connecting to RTO, and the alternative code snippet I provided is NOT connecting to RTO - it is using the snapshot API on RDP - two different services.
Upvotes
25.3k 87 12 25

Hi @Zuka1

If you note the last few lines of the error 'missing scopes' - this would indicate your RDP credentials are not licenced for the VOD.L RIC - you could try /VOD.L - i.e. delayed RIC - which you may be entitled to.

Also, one thing I forgot to mention earlier - when posting on the Q&A Forum - it is recommended that you create a new post when the subject changes somewhat from the original reason for the post.

Your original query was about asyncio - and then the query changed to issues with the get_data function.

This will help other users of the forum look for answers to similar queries.

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.

Upvotes
25.3k 87 12 25

Hi @Zuka1 / @kazuhisa

FYI - we have pushed the first beta release of tutorials and examples for RD Python Library to GitHub - Refinitiv-API-Samples/Example.DataLibrary.Python: Example projects and Tutorials demonstrating access to the Refinitiv Data Platform using the Refinitiv Data Library for Python (github.com)

They have been tested with refinitiv-data · PyPI v1.0.0b6

NOTE: The links on the README pages for the Dev Portal tutorials/Quick Start etc won't work as we have not published those yet - hopefully be there next week or in the New Year....

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.