Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 1 1 1

Pull futures chain (expired and current) & get all historical prices

Hi,


I would like to pull a futures chain, including expired contracts (say 0#C) and current contracts. And get the prices. Is there a simple way to do this that pulls them in a single dataframe once you have the list of contracts?

pythoncommodities
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 @Shadeun ,

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
5.7k 21 2 6

Hi @Shadeun,

The Search API is what you're after. How many are you expecting to retrieve in one call? are we talking 1k or 100 million rows?

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,

Would be a lot, perhaps 1k rows per contract and 100 contracts historically, so 100k 'cells'. But not an unrealistically large number of datapoints i think.

So you are suggesting i use the search function to find the contracts and then pull via ek.get_data?

Yes, I'd suggest that, although you don't have to use ek.get_data, you can keep with rd, which also has a get data function. you can find more details here (as well as many examples in CodeBook).

the search limits itself to 10k rows; for more, I'd advise bulking your search (e.g.: by maturity). There is a way to do just this as shown here and explained in the 'Building Search into your Application Workflow' article.

When it comes to expired instruments, I'd suggest reading this great article too.

Thanks i was hoping something that merged Pull All Expired Contracts - Forum | Refinitiv Developer Community and an active one.

I cannot seem to get the code in the link to work however. i assume rdp is always

import refinitiv.dataplatform as rdp

yeah?

Show more comments
Upvotes
14.2k 30 5 10

Hi @Shadeun ,

Is this what you're looking for?

df, err = ek.get_data('0#C:',['TRDPRC_1','OPINT_1','EXPIR_DATE'])
df

1658742607478.png

where

  • TRDPRC_1 is the Last trade price or value
  • OPINT_1 is an Open interest
  • EXPIR_DATE is the date on which the future, option or warrant expires

To find the field name to be used, Data Item Browser (DIB) in Refinitiv Workspace/Eikon Desktop can be used, here's the video regarding DIB tutorial.

Hope this helps and please let me know in case there is any further question


1658742607478.png (39.0 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.