Retrieve Futures Contract Names at a point-in-time

Hi there, is there a way to retrieve contract names of a futures product available on a date in the past using Eikon Python API? For example, crude oil on March 1, 2002 there were CLH02,CLJ02,CLK02,....CLZ04... etc on exchanges. Would the API get these names? Need to get these names first and then to check historical info like close prices, first notice date of these contracts, thanks.
Best Answer
-
Hello @zhangjin ,
With Eikon Data API only, for a date in the past, I don't believe you will be able to have the complete solution.
For chain expansion in history, history product, such as Refinitiv Tick History, would work. We have several materials available, for instance, see article How to expand Chain RIC using the Tick History REST API in Python, but the approach described requires Tick History product.
Otherwise, you can expand today and request at a point in time, which will not result in the complete retrieval at point-in time as some constituents would be expected to have changed overtime.
Once you have the chain constituents in time, you can retrieve any information for the list of constituents in that point of time using Eikon Data API. For example:
ek.get_data(df["Instrument"].tolist(),
['TR.CLOSEPRICE','TR.CLOSEPRICE.date'],
{'SDate': '20211001','EDate':'20211101'}
)To see what fields are available, Data Item Browser tool (DIB) can be used, see article How to discover available fields for Data Grid service on JET(App Studio HTML5 SDK) API using Eikon Desktop for more info.
I hope that this information helps
0
Answers
-
Hello @zhangjin ,
I think the best pure Eikon Data API approach is described in this previous discussion thread:
1. Expand the CRUDE OIL RIC chain as it is now
2. Obtain the historical information on the dates that you require based on the instruments expanded in step 1.
With history product, for example Refinitiv Tick History, you can use Historical Chain Resolution request to expand that chain in the exact point in time, see this previous discussion thread for a discussion of this approach, and you can request close prices and other fields based on the expanded RIC list.
Hope this information helps
0 -
Hi Zoya, I still don't have a clue after reading the thread you provided. I don't need to know 'joiners' and 'leavers' or other information.
I want to know what futures contracts are available for trade on exchange given a date, like today or a date in history. Is there a way using a root RIC + a date to fetch these contract names?
0 -
Hi, My problem is not solved, thanks for asking @raksina.samasiri.
I want to know what futures contracts are available for trade on exchange given a date, like today or a date in history. Is there a way using a root RIC + a date to fetch these contract names? Thanks.
0 -
Hello @zhangjin ,
Sorry your problem is not solved and let me provide some additional information.
For today, I would suggest using Refiniv Data library, please try the following code:
import refinitiv.data as rd
from refinitiv.data.content import historical_pricing
from refinitiv.data.content import pricing
rd.open_session()
cruds = pricing.chain.Definition(name="0#CL:").get_stream()
cruds.open(with_updates=False)
cruds.close()
print(cruds.constituents)Resulting in constituents:
['CLK2', 'CLM2', 'CLN2', 'CLQ2', 'CLU2', 'CLV2', 'CLX2', 'CLZ2', 'CLF3', 'CLG3', 'CLH3', 'CLJ3', 'CLK3', 'CLM3', 'CLN3', 'CLQ3', 'CLU3', 'CLV3', 'CLX3', 'CLZ3', 'CLF24', 'CLG24', 'CLH24', 'CLJ24', 'CLK24', 'CLM24', 'CLN24', 'CLQ24', 'CLU24', 'CLV24', 'CLX24', 'CLZ24', 'CLF25', 'CLG25', 'CLH25', 'CLJ25', 'CLK25', 'CLM25', 'CLN25', 'CLQ25', 'CLU25', 'CLV25', 'CLX25', 'CLZ25', 'CLF26', 'CLG26', 'CLH26', 'CLJ26', 'CLK26', 'CLM26', 'CLN26', 'CLQ26', 'CLU26', 'CLV26', 'CLX26', 'CLZ26', 'CLF27', 'CLG27', 'CLH27', 'CLJ27', 'CLK27'...
That we can request the info that you require, for example:
non_streaming = rd.content.pricing.Definition(
cruds.constituents,
fields=['TRDPRC_1','ASK','BID']
).get_stream(
non_streaming.open(with_updates=False)
non_streaming.get_snapshot()resulting in:
InstrumentBIDTRDPRC_1ASK
0CLK299.4599.4799.47
1CLM298.5198.5198.54
2CLN297.5897.5297.61
3CLQ296.5496.5896.5
...0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 249 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 643 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛