Obtain Closing Price of stock on set series of dates and return NULL if there is not data for that d
Hi All,
How can I obtain the daily closing price for a stock for specified dates, returning NULL on any specific dates that do not have data?
I'd like to obtain the daily price of several stocks over a set period of time.
Ideally my output will look like this:
Where a day that the latest closing price is not available returns a NULL value.
But, when I run the following code, I get data available for the LAST valid closing price -- which I don't want.
Unfortuneately, my output looks like this, repeating the date/value for 7/1/24:
I've simplified the example and limited the size of the tables above, but this is the code I am using to pull this data on a real stock. The problem is the same as described above.
CODE:
df = rd.get_data(
universe = [ 'A1OS34.SA'],
fields = ['TR.PriceClose.date', 'TR.PriceClose'],
parameters = {
'SDate': '2024-06-01',
'EDate': '2024-08-01',
'Frq': 'D',
'Curn': 'USD'
}
)
display(df)
I appreciate any help folks can provide -- thanks!
Answers
-
Thank you for reaching out to us.
You may need to contact helpdesk via MyAccount to verify the content and parameters.
Otherwise, you can try the rd.get_history instead.
rd.get_history(
["A1OS34.SA"],
fields=["TRDPRC_1"],
start='2024-06-01',
end='2024-08-01',
interval='daily')1 -
Thank you @ Jirapongse ! Do you know what the process for getting this in the Excel plug in would be? Or if there is a way of doing this with the time series command? Thanks!
0 -
It could be this formula in Workspace Excel.
=@RDP.HistoricalPricing("A1OS34.SA","TRDPRC_1","INTERVAL:P1D SOURCE:RFV",,"CH:Fd RH:Timestamp",E2)
0 -
Jirapongse!
Is there a way to specify currency for the get_history function? Or, if I can't specify currency, can I display the currency the stock data is returned in?0 -
As far as I know, we can't specify the currency for the historical real-time data retreived via the get_history method..
We can specify the currency when using the get_data method with the TR.xxx fields.
You can get the currency of the real-time data by using the following code.
rd.get_data(
universe=['A1OS34.SA'],
fields=['CF_CURR']
)0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛