TR function

Hi,
I want to download historical stock prices from 1 Jan 1990 until 30 Jun 2022 for a certain number of companies. I use the TR function and especially "=@TR(B1;"TR.Closeprice";"Sdate=1990-12-31 EDate=2021-12-31 Frq=D CH=Fd";B3)", where on B1, I place the stock RIC and on B3, the data are placed. Although the data are retrieved, the starting date (and the first observation) changes according to the data availability or the initiation of the stock public trading. How I can create fixed columns where in case of data unavailability in the first days or any other period a "null" to be appeared? So every column (stock) includes the same number of observations. I have a large number of stocks and to adjust every column by hand is an overkill.
Thank you in advance.
Best Answer
-
hi @evan.salachas ,
Your question is about the Eikon Excel issue and the available functionality, rather than about Eikon Data API integration, and the moderators on this forum have expertise in APIs.
Hence, the best approach is to reach out to Eikon support directly, by submitting Eikon Excel questions via MyRefinitiv -> Product and Content -> I need help using the product -> Refinitiv Eikon rather than posting on dev forums after that, please expect an Eikon support expert to reach out to you shortly, via the email address that you have registered on MyRefinitiv with.
0
Answers
-
hi @evan.salachas ,
In case you'd like to retrieve the data using the Eikon Data API, the parameter 'CalcDate' can be added to show all the dates of the calculation, for example, this instrument's first trade date is on 2018-04-25 and the data returned after the 'CalcDate' was added are all <NA> before the first trade date
rics = ['BNDX.N']
fields = ['TR.PriceClose.Date','TR.PriceClose.CalcDate','TR.PriceClose']
parameters = {'SDate':'2018-04-01', 'EDate': '2019-08-31', 'Frq': 'D'}
df, err = ek.get_data(rics, fields, parameters)
dfMore information regarding the Eikon Data API can be found in the Developer portal and here's its quickstart guide
0 -
Hello @evan.salachas ,
Based on the answer from @raksina.samasiri , and applying FirstTradeDate to multiple instruments, you may:
ek.get_data(['GOOG.O','TRI.N'],['TR.FirstTradeDate'])
Resulting in dates:
( Instrument First Trade Date
0 GOOG.O 2014-03-27
1 TRI.N 2001-10-29,
None)Find minimum of them all:
df["First Trade Date"].min()
Request starting just before:
df, err = ek.get_data(['GOOG.O','TRI.N'],
['TR.CLOSEPRICE','TR.CLOSEPRICE.date'],
{'SDate':'2001-10-28','EDate':'2022-08-30','Frq':'D'})
dfAnd pivot this result:
pt = df.pivot_table(values='Close Price', index=['Date', 'Instrument']).unstack('Instrument')
ptHope this helps in addition
0 -
thank you raksina!
0 -
Thank you zoya! very helpful!
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
- 687 Datastream
- 1.4K DSS
- 621 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 4 Trading API
- 2.9K Elektron
- 1.4K EMA
- 254 ETA
- 557 WebSocket API
- 38 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
- 276 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
- 669 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
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 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
- 48 中文论坛