question

Upvotes
Accepted
1 0 0 3

How to download forward chain for a given date?

Hi,

I am trying to access an entire forward chain for commodities on a given day.

For example, I would like to obtain all forwards/futures data for Henry Hub on 09/29/2023 or all forwards for 12/29/2023 for ERCOT North.

I have encountered the Commodity_Futures_RIC_Search.ipynb and have used a brute force method. However, it seems that the get_futures function does not always work for all commodities, such as NG, CL, and power.

Is there a more streamlined or simpler way to access entire forward data for a given day?

Thanks.

workspace#technologydatastreamcommodities
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
Upvotes
Accepted
7.2k 23 3 6

Hi @anurag.rathore, does the below Python code using hte Refinitiv Data Library help?


import refinitiv.data as rd
rd.open_session()
NGG24 = rd.discovery.Chain("0#NGG24+")
_NGG24_df = rd.get_history(
    universe=[i.replace('/', '') for i in list(NGG24.constituents)[0:20]], # Only 1st 20
    fields=["ASK"],
    start="2024-01-01" # only that day
    )
NGG24_df = _NGG24_df.T.dropna().T


1705937745804.png


1705937745804.png (240.2 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.

Hi @jonathan.legrand ,


Thank you for your response. I am trying to extract the entire forward curve for a specific date for valuation purposes. For example, is there a way to get all forwards/futures contracts for Natural Gas on 12-29-2023?


I used the FuturesRICs class from the codebook, but it doesn't seem to work for other RICs (the default RIC is LCO).


Please find the screenshot of the notebook attached below for your reference.



1707485828305.png

Thanks,

1707485828305.png (16.7 KiB)

Hi @anurag.rathore,

the code there uses Search to find the future in question. I would suggest doing the same, using Search, then IPA to construct your curve (similarly to how I used IPA here - but for FX):

1707493768834.png

1707493768834.png (114.9 KiB)

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.