question

Upvotes
Accepted
1 0 0 0

Is there a way to pull all expired contracts for a commodity?

Is there a way to pull all expired contracts for a commodity? The same process is fairly straightforward for active contracts, but I haven't been able to find a simple method for expired contracts. If none exist, is there a means of pulling expiry dates for all active contracts?

eikon#technologyrdp-api
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

· Write an Answer
Upvote
Accepted
24k 52 17 14

Hello @Krustnik2

There is the old post that use the legacy Refinitiv Data Platform - Library available here.

The similar code with the strategic Refinitiv Data Library - Python is as follows:

import refinitiv.data as rd
from refinitiv.data.content import search


# Open Session
rd.open_session()


response = search.Definition(
    view=search.Views.COMMODITY_QUOTES,
    select="RIC,ExpiryDate", 
    filter=("ExchangeCode eq 'CBT' and AssetCategory eq 'CMF' and PrimaryChainRIC eq '0#C:' and ExpiryDate lt 2021-02-05"),
    top = 1000
).get_data()
response.data.df

Result:

1696324106799.png

Other old posts that might help you too:

For more detail about the Search API, please check the Building Search into your Application Workflow article.




1696324106799.png (35.4 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.

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.