Obtain Closing Price of stock on set series of dates and return NULL if there is not data for tha...

...t date?
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!
Best Answer
-
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')0
Answers
-
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
- 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
- 685 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
- 252 ETA
- 556 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
- 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
- 651 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
- 228 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
- 46 中文论坛